fmaussion / salem

Add geolocalised subsetting, masking, and plotting operations to xarray
http://salem.readthedocs.io
Other
186 stars 44 forks source link

conda version is 0.0.0 #250

Closed fmaussion closed 3 months ago

fmaussion commented 3 months ago

When installing salem via conda, the version shown by python is 0.0.0. This explains what's happening:

Installing via pip:

(oggm_env_recommended) uu23343@DF9X9PDH6T oggm-mac % pip install salem
Collecting salem
  Downloading salem-0.3.11-py2.py3-none-any.whl.metadata (2.9 kB)

[...]

Downloading salem-0.3.11-py2.py3-none-any.whl (86 kB)
Installing collected packages: salem
Successfully installed salem-0.3.11
(oggm_env_recommended) uu23343@DF9X9PDH6T oggm-mac % python
Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:45:13) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import salem
>>> salem.__version__
'0.3.11'

Installing via conda:

(oggm_env_recommended) uu23343@DF9X9PDH6T oggm-mac % mamba install salem

[...]

  Package  Version  Build         Channel                  Size
─────────────────────────────────────────────────────────────────
  Install:
─────────────────────────────────────────────────────────────────

  + salem   0.3.11  pyhd8ed1ab_0  conda-forge/noarch     Cached

  Summary:

  Install: 1 packages

  Total download: 0 B

─────────────────────────────────────────────────────────────────

Confirm changes: [Y/n] Y

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(oggm_env_recommended) uu23343@DF9X9PDH6T oggm-mac % python
Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:45:13) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import salem
>>> salem.__version__
'0.0.0'

Probably our versioning support in salem is not adapted for conda - what do we need to do? Any idea @TimoRoth ?

TimoRoth commented 3 months ago

This really should just work with setuptools_scm. How did you make the archives that are uploaded to pypi? Cause the .git_archival.txt file in those archives is still the unprocessed placeholders, so setuptools_scm has nothing to derive the version from.

TimoRoth commented 3 months ago

What they should look like when downloaded from for example https://github.com/fmaussion/salem/archive/refs/tags/v0.3.11.tar.gz :

node: db78e906f882d2e2f8da44744d34d5466eaa293b
node-date: 2024-07-12T11:19:11+09:00
describe-name: v0.3.11
ref-names: tag: v0.3.11
fmaussion commented 3 months ago

I'm still using these instructions here which are getting older: https://github.com/fmaussion/salem/blob/master/HOWTO_RELEASE.md

fmaussion commented 3 months ago

I'm getting quite a lot of deprecation messages when I do this though, and there may be a better way.

fmaussion commented 3 months ago

I actually remember having had troubles with twine upload but somehow I made it work in all the stress this summer. Happy to learn a better way to do it and rerelease

TimoRoth commented 3 months ago

I have no experience with twine or uploading to pypi, I just know that the source tarball that ends up on there contains an invalid .git_archival.txt, which is likely what causes the broken version.

A quick google suggests that you are supposed to use "python -m build" instead of the old setup.py stuff, since a setup.py is technically not even supposed to exist anymore. But when I do that, the archive is still invalid.

fmaussion commented 3 months ago

Fixed on conda-feedstock by @TimoRoth ! 🎉