question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expand environment variables in path field

See original GitHub issue

It would be nice if the injection of environment variables worked for the path variable too

@njgrisafi from #1688

It would be nice if we can have environment variables loaded throughout the entire Pipfile. E.g.

[dev-packages]
my-package = {path="${PATH_TO_REPO}", editable = true}

Is your feature request related to a problem? Please describe.

Environment expansion does not work for path or file as observed in #2317

Describe the solution you’d like

I’d like the variable expansion to work for the path/file fields. Unfortunately, this probably involves an expansion in the Pipfile.lock too, so that both can truly be portable with respect to the environment variable

Describe alternatives you’ve considered

I tried this in pipenv/project.py as a failed POC.

    def _parse_pipfile(self, contents):
        from pipfile.api import PipfileParser
           
        try: 
            d = tomlkit.parse(contents)
        except Exception:
            # We lose comments here, but it's for the best.)
            # Fallback to toml parser, for large files.
            d = toml.loads(contents)
        return PipfileParser().inject_environment_variables(d)

I will have to use symlinks in the meantime

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
heronrscommented, May 16, 2019

Would be nice to have this feature. Currently we need to install an #egg from a private gitlab repo and the ability to inject the user token would be nice, such as:

mypkg = {git = "https://oauth2:$GITLAB_TOKEN@gitlaburl.com/my-repo#egg=mypkg"}

1reaction
frostmingcommented, Sep 2, 2020

@bkemmer Your Pipfile is not valid, [[source]] is for PyPI index, not VCS repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expand environment variables in path - Stack Overflow
I want to expand environment variables in R like ...
Read more >
Certain Variables won't expand in Windows System ...
For some reason there are certain Environment Variables that won't expand when used in the "PATH" variable in the System Variables.
Read more >
How to correctly add a path to PATH? - Unix Stack Exchange
PATH is just an environment variable, and if you want to add to the PATH, you have to rebuild the variable with exactly...
Read more >
Environment.ExpandEnvironmentVariables(String) Method
Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then...
Read more >
Use environment variables in the configuration - Elastic
If you need to use a special character in your configuration file, use $ to escape the expansion. For example, you can escape...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found