Reputation: 1
I recently added the package typepigeon
to conda-forge
. On conda-forge
it is currently at version 1.0.9
; however, when installing typepigeon
via conda install
, the output of pip list
shows its version to be 0.0.0.post2.dev0+a27ab2a
instead of 1.0.9
.
conda list
:
typepigeon 1.0.9 pyhd8ed1ab_0 conda-forge
pip list
:
typepigeon 0.0.0.post2.dev0+a27ab2a
I think the issue arises from the way I am assigning the version (I am using dunamai
to extract the Git tag as the version number). This version extraction is done within setup.py
of typepigeon
.
try:
__version__ = Version.from_any_vcs().serialize()
except RuntimeError as error:
warnings.warn(f'{error.__class__.__name__} - {error}')
__version__ = '0.0.0'
When conda-forge
builds the feedstock, I think it might be looking at the Git tag of the feedstock repository instead of the version from PyPI (as it is locally executing setup.py
).
How can I modify the Conda Forge recipe to force the PyPI version?
Upvotes: 0
Views: 259
Reputation: 1
I've figured out a solution; it might not be the best possible way to do this, but it works for my workflow.
I injected the version into the setup.py
by looking for an environment variable (that I called __version__
):
if '__version__' in os.environ:
__version__ = os.environ['__version__']
else:
from dunamai import Version
try:
__version__ = Version.from_any_vcs().serialize()
except RuntimeError as error:
warnings.warn(f'{error.__class__.__name__} - {error}')
__version__ = '0.0.0'
Then, in the conda-forge
recipe, I added an environment variable (__version__
) to the build step:
build:
noarch: python
script: export __version__={{ version }} && {{ PYTHON }} -m pip install . -vv
Upvotes: 0