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

After switching to setuptools_scm my package installed as version 0.0.0 #386

Open
polm opened this issue Dec 27, 2019 · 9 comments
Open

Comments

@polm
Copy link

polm commented Dec 27, 2019

I tried switching to setuptools_scm for my package fugashi for v0.1.7 but when installing from pip the version is shown as 0.0.0. I saw the notes about conflicting settings in setup.cfg and such but I don't have any of that. In the source PKGINFO the version seems to be correctly set to 0.1.7. What did I do wrong?

Here's a link to setup.py at the 0.1.7 release.

I saw several other issues about this in this repository but none of them seemed to be the same as this.

@RonnyPfannschmidt
Copy link
Contributor

i think its related to a pip interaction issue i had trouble replicating before, i'm going to investigate if your particular issue fits that

if that's the case then #345 should eventually fix it after i managed to reproduce

@darrenburns
Copy link

darrenburns commented Jan 17, 2020

I hit the same problem with a pyproject.toml like:

[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]

[tool.setuptools_scm]
write_to = "ward/_ward_version.py"

Running setuptools results in my package having version 0.0.0, even if I change the version_scheme.

It seemed to work fine when I used setuptools 41, and setup.py.

@RonnyPfannschmidt
Copy link
Contributor

@darrenburns that release is not out - it should be tommorow

@georgek
Copy link

georgek commented Feb 11, 2020

It doesn't work for me either. I have set it up using pyproject.toml exactly like the docs say:

[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]

[tool.setuptools_scm]

Invoking python setup.py --version returns 0.0.0 and any build will have that version. I had to add the stuff to setup.py to get it to work.
I have the latest setuptools installed in my virtualenv. I'm not sure what I'm doing wrong.

@RonnyPfannschmidt
Copy link
Contributor

@georgek to use setup.py as you write, you either need the latest setuptools and the latest setuptools_scm pre-installed or as setup_requires in setup.py/cfg,

setup.py invocations will NOT install build requirements from pyproject.toml

if you have a modern pip installed, i believe a pip wheel . should produce the desired results

@georgek
Copy link

georgek commented Feb 12, 2020

@RonnyPfannschmidt Thanks for the clarification. It makes sense. But I think there is a gap in the documentation currently because it suggests the the pyproject.toml method is a direct replacement for using the "legacy" setup.py settings.

The gap seems to be some way to actually install your build requirements from a pyproject.toml file. Is there any recommended way to do that? pip wheel isn't a great solution and I don't want to maintain a dev-requirements.txt which duplicates those build requirements.

@RonnyPfannschmidt
Copy link
Contributor

there is currently indeed no good way, currently they have to be replicated

unfortunately the peps for package metadata do not yet have the accompanying pep for editable installs, there is some work on those pep's from volunteers but they are stretched and its a topic where passovr/coop can be hard to facilitate

@georgek
Copy link

georgek commented Mar 4, 2020

For anyone finding this, one way to ensure the build deps are present is to use tox to do your builds. Add to your tox.ini:

[testenv:build-dist]
skipsdist = True
skip_install = True
deps =
     -U
     setuptools>=42
     wheel
     setuptools_scm[toml]>=3.4
commands = python setup.py sdist

And then: tox -e build-dist

@Flameeyes
Copy link
Contributor

FWIW I stumbled across this and found that the "easiest" way to make sure this works as intended (instead of silently falling back to 0.0.0) is to import setuptools_scm at the top of setup.py — it'll fail to import if the package is not installed.

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

5 participants