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.

override version via an environment variable

See original GitHub issue

Is it possible to ovveride the version via an environment variable ? if not would it be possible to add the feature ? setuptools provides the convenient variable SETUPTOOLS_SCM_PRETEND_VERSION=“0.25.0”; for instance.

My usecase is that pandas if (very) often broken for me so I often need to use the development version. When fetching the code from github via nix, it fetches a tarball thus it misses the .git files. This ends up with pandas having a 0+unknown version. Because my setup.py enforces pandas >= 0.24.2, the pip check fails:

Collecting pandas>=0.24.2 (from mptcpanalyzer==0.3.2.dev0)
  Using cached https://files.pythonhosted.org/packages/b2/4c/b6f966ac91c5670ba4ef0b0b5613b5379e3c7abdfad4e7b89a87d73bae13/pandas-0.24.2.tar.gz
Requirement already satisfied: cmd2>=0.9.12 in /nix/store/9f7v64ns4xwfgm1dmn2aqy5vjmxspi85-python3.7-cmd2-0.9.14/lib/python3.7/site-packages (from mptcpanalyzer==0.3.2.dev0) (0.9.14)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /nix/store/xczj8g0l84dls0sx98j4zpi3cklvba3p-python3.7-pbr-5.1.3/lib/python3.7/site-packages (from stevedore->mptcpanalyzer==0.3.2.dev0) (5.1.3)
Requirement already satisfied: six>=1.10.0 in /nix/store/imf48xfhb9dg8453gx131icwxrgwnwdv-python3.7-six-1.12.0/lib/python3.7/site-packages (from stevedore->mptcpanalyzer==0.3.2.dev0) (1.12.0)
Requirement already satisfied: numpy>=1.10.0 in /nix/store/3ml16mnq11in68sdg8w4jipm7bqcvmh8-python3.7-numpy-1.16.4/lib/python3.7/site-packages (from matplotlib>=3.0.3->mptcpanalyzer==0.3.2.dev0) (1.16.4)
Requirement already satisfied: python-dateutil>=2.1 in /nix/store/p59ycm2ijqgbl3x9fzl9968ppyc5wlyl-python3.7-python-dateutil-2.8.0/lib/python3.7/site-packages (from matplotlib>=3.0.3->mptcpanalyzer==0.3.2.dev0) (2.8.0)
Requirement already satisfied: cycler>=0.10 in /nix/store/a8dhnlh3j584rkx2mnd9q88yjx0gs3dj-python3.7-cycler-0.10.0/lib/python3.7/site-packages (from matplotlib>=3.0.3->mptcpanalyzer==0.3.2.dev0) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /nix/store/rfb33kzfnbm5j7ph9j7qp54cg5y1kgvy-python3.7-pyparsing-2.3.1/lib/python3.7/site-packages (from matplotlib>=3.0.3->mptcpanalyzer==0.3.2.dev0) (2.3.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /nix/store/b60xdslw4sxy2mhfc8wl3sx4kll9rav1-python3.7-kiwisolver-1.0.1/lib/python3.7/site-packages (from matplotlib>=3.0.3->mptcpanalyzer==0.3.2.dev0) (1.0.1)
Requirement already satisfied: pytz>=2011k in /nix/store/qiri3zhvgb05cccf5mhbricxv95q2pni-python3.7-pytz-2019.1/lib/python3.7/site-packages (from pandas>=0.24.2->mptcpanalyzer==0.3.2.dev0) (2019.1)
Requirement already satisfied: attrs>=16.3.0 in /nix/store/nmzcj7vdqfch4jl4ndmkf1mvdyda4xs4-python3.7-attrs-18.2.0/lib/python3.7/site-packages (from cmd2>=0.9.12->mptcpanalyzer==0.3.2.dev0) (18.2.0)
Requirement already satisfied: pyperclip>=1.5.27 in /nix/store/xs2v9yhg3pgr6wnql2v3b5zwlz5rm145-python3.7-pyperclip-1.7.0/lib/python3.7/site-packages (from cmd2>=0.9.12->mptcpanalyzer==0.3.2.dev0) (1.7.0)
Requirement already satisfied: wcwidth>=0.1.7 in /nix/store/lnzp91myfangqfpdw18sk2yp1x7wyf3r-python3.7-wcwidth-0.1.7/lib/python3.7/site-packages (from cmd2>=0.9.12->mptcpanalyzer==0.3.2.dev0) (0.1.7)
Requirement already satisfied: colorama in /nix/store/xx29yp120h6p9fjwwgvazdr8iharpj01-python3.7-colorama-0.4.1/lib/python3.7/site-packages (from cmd2>=0.9.12->mptcpanalyzer==0.3.2.dev0) (0.4.1)
Requirement already satisfied: setuptools in /nix/store/pwqjs8nz67h4rid05vwma9z8fbsfmm16-python3.7-bootstrapped-pip-19.1.1/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib>=3.0.3->mptcpanalyzer==0.3.2.dev0) (41.0.1)
Building wheels for collected packages: pandas
  Building wheel for pandas (setup.py) ... done
  Stored in directory: /home/teto/.cache/pip/wheels/47/0a/bf/fd3647f5bc74698ed95dbdbb3d8d120cfe0280969c212cdb6c
Successfully built pandas
Installing collected packages: pandas, mptcpanalyzer
  Found existing installation: pandas 0+unknown
    Uninstalling pandas-0+unknown:
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: 'METADATA'

The most straightforward solution in my case would be to export the VERSIONEER_VERSION="0.25.0"; to fix the install. Right now, I remove the pandas’ version check from program’s setup.py, which is annoying.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
effigiescommented, Oct 23, 2020

I think there’s a common issue of finding some fallback version, and I’ve tagged the open issues that bring up different aspects of this with the fallback label.

It would be good to try to address this with each of these use cases in mind.

2reactions
costrouccommented, Dec 30, 2019

Since it doesn’t look like this issue has gained much traction here is the workaround I am using with nix. Note that dask/_version.py will need to be changed

  postPatch = ''
    # versioneer hack to set version of github package
    echo "def get_versions(): return {'dirty': False, 'error': None, 'full-revisionid': None, 'version': '${version}'}" > dask/_version.py

    substituteInPlace setup.py \
      --replace "version=versioneer.get_version()," "version='${version}'," \
      --replace "cmdclass=versioneer.get_cmdclass()," ""
  '';
Read more comments on GitHub >

github_iconTop Results From Across the Web

override version via an environment variable #199 - GitHub
My usecase is that pandas if (very) often broken for me so I often need to use the development version. When fetching the...
Read more >
CI's `version` variable overrides the version of the generated ...
This confirms that having an environment variable named version will result in a package being generated with the version defined in the environment...
Read more >
Overriding Configuration via Environment Variables
You can use environment variables to override the configuration values from the UiPath.Orchestrator.dll.config file's appSettings and connectionStrings ...
Read more >
gnuMake, How to have an environment variable override
How to prevent Make from randomly overriding files? 1 · GNU make - How to concatenate to variable depending on shell command result...
Read more >
How to change the current java version through environment ...
I imagine when it comes to system variables, first come, first serve. You need to look at the system path to figure out...
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