Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Archival information is there, but setuptools_scm can't read it #5

Open
ozagordi opened this issue Jun 7, 2017 · 0 comments
Open

Comments

@ozagordi
Copy link

ozagordi commented Jun 7, 2017

Hi.

I'm trying to use the plugin for a project of mine. I followed the instructions, created the two hidden files, tagged and pushed to GitHub. When I download the archive, the right information are written into .git_archival.txt

(minvardevel) ➜  /private/tmp/MinVar-1.0.0-alpha  cat .git_archival.txt
ref-names: tag: v1.0.0-alpha, scm_git_archive

My setup.py reads as indicated in the instructions, it seems to me.

(minvardevel) ➜  /private/tmp/MinVar-1.0.0-alpha  head -7 setup.py
#!/usr/bin/env python

import setuptools

setuptools.setup(
    use_scm_version=True,
    setup_requires=['setuptools_scm', 'setuptools_scm_git_archive'],
    ...

But if I try to run it, it complains that it cannot read the version

(minvardevel) ➜  /private/tmp/MinVar-1.0.0-alpha  python setup.py develop
zip_safe flag not set; analyzing archive contents...
zip_safe flag not set; analyzing archive contents...

Installed /private/tmp/MinVar-1.0.0-alpha/.eggs/setuptools_scm_git_archive-1.0-py3.6.egg

Installed /private/tmp/MinVar-1.0.0-alpha/.eggs/setuptools_scm_git_archive-0-py3.6.egg
Searching for setuptools_scm
Reading https://pypi.python.org/simple/setuptools_scm/
Downloading https://pypi.python.org/packages/fb/22/1f1c3b223425351cf499d04ecf9673d12c4adf1c971a0d72b9cf919d4d6a/setuptools_scm-1.15.5-py3.6.egg#md5=5c831eb5f62b4503ae76090fda1b70f0
Best match: setuptools-scm 1.15.5
Processing setuptools_scm-1.15.5-py3.6.egg
Moving setuptools_scm-1.15.5-py3.6.egg to /private/tmp/MinVar-1.0.0-alpha/.eggs

Installed /private/tmp/MinVar-1.0.0-alpha/.eggs/setuptools_scm-1.15.5-py3.6.egg
Traceback (most recent call last):
  File "setup.py", line 33, in <module>
    'minvar = minvar.__main__:main'
  File "/Users/ozagordi/miniconda3/envs/minvardevel/lib/python3.6/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/Users/ozagordi/miniconda3/envs/minvardevel/lib/python3.6/site-packages/setuptools/dist.py", line 323, in __init__
    _Distribution.__init__(self, attrs)
  File "/Users/ozagordi/miniconda3/envs/minvardevel/lib/python3.6/distutils/dist.py", line 281, in __init__
    self.finalize_options()
  File "/Users/ozagordi/miniconda3/envs/minvardevel/lib/python3.6/site-packages/setuptools/dist.py", line 392, in finalize_options
    ep.load()(self, ep.name, value)
  File "/private/tmp/MinVar-1.0.0-alpha/.eggs/setuptools_scm-1.15.5-py3.6.egg/setuptools_scm/integration.py", line 22, in version_keyword
  File "/private/tmp/MinVar-1.0.0-alpha/.eggs/setuptools_scm-1.15.5-py3.6.egg/setuptools_scm/__init__.py", line 119, in get_version
  File "/private/tmp/MinVar-1.0.0-alpha/.eggs/setuptools_scm-1.15.5-py3.6.egg/setuptools_scm/__init__.py", line 97, in _do_parse
LookupError: setuptools-scm was unable to detect version for '/private/tmp/MinVar-1.0.0-alpha'.

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

To me it looks like setuptools_scm is not falling back on setuptools_scm_git_archive, but why?
What am I doing wrong?

I would like to access the version info programmatically, like having the version info consumed by argparser, argument -v.

Thanks.


Update

If I change the content of my .git_archival.txt to v1.0.alpha, then python setup.py develop works fine. Accessing the version returns 1.0a0. I understand now that the reason for failing was in the format of the tag, although I'm a bit surprised that it failed completely rather than emitting some warning. Something that might be worth stressing in the README, together with the fact that setting the environment variable SETUPTOOLS_SCM_DEBUG=TRUE let setup print more info.

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

No branches or pull requests

1 participant