JamesRamm / archook

Searches the system for arcgis and makes arcpy available to python (regardless of pythonpath/system path/registry settings)
GNU General Public License v2.0
81 stars 28 forks source link

inaccurate version reporting #27

Closed mhw-at-yg closed 4 years ago

mhw-at-yg commented 4 years ago

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.

$ pip show archook
Name: archook
Version: 1.2.0
Summary: Locates arcpy and makes it available to the running python distribution
Home-page: https://github.com/JamesRamm/archook
Author: None
Author-email: None
License: UNKNOWN
Location: d:\code\public\archook
Requires:
Required-by:

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:

(archook-py36) D:\code\public\archook
$ git log -1
commit fb0c710c17b1d48c3df8a7b8ef665c3f59df55cd (HEAD -> master, origin/master, origin/HEAD)
Author: mhw-at-yg <matt.wilkie@gov.yk.ca>
Date:   Tue May 12 10:56:03 2020 -0700

    switch f-string for format() for py27 (closes #24)
logan-pugh commented 4 years ago

I've used setuptools_scm for this in the past but not sure if there are better options nowadays.

mhw-at-yg commented 4 years ago

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
mhw-at-yg commented 4 years ago

above seems to be fixed with commit a4acd86a. closing until something comes along to say it should be open ;-)