You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
I use pyscaffold for several Python projects (amazing work btw!). On one of them with pyscaffold 4.0.2, I am building with tox -e build and generate sphinx documentation with tox -e docs with theme from readthedocs. The version infered from commit tag is OK for the build, but never for the documentation build: the displayed version on the html page is always 0.0.0.
Besides, when I type python setup.py --version the result is correct, but when doing the following in the Python console:
from mypackage import __version__ as version
The result is also falling back to 0.0.0.
Describe the solution you would like to see for your use-case
In the past, we did include a setup_requires in the setup.py file, however, when we adopted pyproject.toml it started to cause problems because the dependency resolution algorithm seemed to be unreliable when both things were in place. The PyPA maintainers explicitly recommended to not use setup_requires with pyproject.toml. You can see the discussion in pypa/pyproject-hooks#86.
Can I ask you a few extra questions about this issue?
Does the documentation also show 0.0.0 when building it with tox -e docs and cleaning the cache in docs/_build?
If you do a git tag and run pip install -e . again inside your virtual environment, does the print(version) still return 0.0.0? (It might be the case setuptools_scm is just caching the version at the moment you run pip install -e . ...)
Thanks @oiesauvage for the feedback and for trying these things out.
docs/_build holds the Sphinx docs cache... For simplicity, tox -e clean is not removing those, just the intermediate steps to build the package distribution file.
So it seems that isolated_build = True is the answer...
I feel like it makes the build a bit slower, but if it is less error prone, maybe we should adopt it. @FlorianWilhelm what would it be your take on this?
I did a few extra tests myself by generating a fresh project from the master version of PyScaffold, with putup myproj.
If I create a git tag, before running tox -e docs, then the version in the docs are generated correctly.
Once I create a new tag and try to run tox -e docs again, the docs show the previous version, To fix it I need to run tox -r -e docs to recreate the virtualenv created by tox.
It might be related to the fact that currently we have usedevelop = True to speed up the tox task, and it seems that setuptools-scm requires a new installation once a new git tag is created.
@abravalheri alright, i tried deleting docs/_build without results. Besides, I did not feel a major slowdown with isolated_build = True on my project (I did not timed it though), but it may depend of your required dependencies...
Interesting @abravalheri. From the docs it seems that isolated_build = True tells tox to look at pyproject.toml. If this makes it work and since we want to move forward to more pyproject.toml anyway, I might be a good further step to make it a default. Maybe even in version 4.1 already?