Closed mhw-at-yg closed 4 years ago
I've used setuptools_scm
for this in the past but not sure if there are better options nowadays.
Experimenting with setuptools_scm in branch fix-27
. It works when working with an editable pip install but fails with a regular pip install, because the .git
folder isn't available for information. There's a fallback_version
parameter but either it doesn't work or I'm not using it properly (more likely).
(archook-py36) D:\code\public\archook\test>simple-test-arcpro.bat
(archook-py36) D:\code\public\archook\test>python D:\code\public\archook\test\simple-test-arcpro.py
Traceback (most recent call last):
File "D:\code\public\archook\test\simple-test-arcpro.py", line 3, in <module>
import archook
File "C:\tools\miniconda3\envs\archook-py36\lib\site-packages\archook\__init__.py", line 9, in <module>
fallback_version = '1.3')
File "C:\tools\miniconda3\envs\archook-py36\lib\site-packages\setuptools_scm\__init__.py", line 143, in get_version
return _get_version(config)
File "C:\tools\miniconda3\envs\archook-py36\lib\site-packages\setuptools_scm\__init__.py", line 147, in _get_version
parsed_version = _do_parse(config)
File "C:\tools\miniconda3\envs\archook-py36\lib\site-packages\setuptools_scm\__init__.py", line 118, in _do_parse
"use git+https://github.com/user/proj.git#egg=proj" % config.absolute_root
LookupError: setuptools-scm was unable to detect version for 'C:\\tools\\miniconda3\\envs\\archook-py36\\lib\\site-packages'.
Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.
For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
above seems to be fixed with commit a4acd86a. closing until something comes along to say it should be open ;-)
Pip reports a static version number for Archook even when running from git repo in editable mode. This means it can't be used when troubleshooting as a means of determining exactly which version is running when troubleshooting.
Identified by way of #25 and confirmed on one of my machines.
The
Location:
line confirms we're in editable mode. If it's a normal install it will lead to PYTHONHOME\lib\site-packages.Git confirms we're using a recent dev version and not the 1.2 release from 2017: