Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inaccurate version reporting #27

Closed
mhw-at-yg opened this issue May 13, 2020 · 3 comments
Closed

inaccurate version reporting #27

mhw-at-yg opened this issue May 13, 2020 · 3 comments

Comments

@mhw-at-yg
Copy link
Collaborator

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
Copy link
Contributor

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

@mhw-at-yg
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants