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

How to keep the version when changing tracked files? #1006

Closed
njzjz opened this issue Jan 23, 2024 · 7 comments
Closed

How to keep the version when changing tracked files? #1006

njzjz opened this issue Jan 23, 2024 · 7 comments

Comments

@njzjz
Copy link
Contributor

njzjz commented Jan 23, 2024

I have read #717 and #812, but neither provides a solution.

I need to release several packages with different package names. PEP 621 requires a static name (see discussion), so I have to update pyproject.toml, which is tracked by git. However, after pyproject.toml is changed in the CI, the version is bumped, making it impossible to upload to PyPI.

ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         '2.2.9.dev0+gb875ea8f.d20240123' is an invalid value for Version.      
         Error: Can't use PEP 440 local versions. See                           
         https://packaging.python.org/specifications/core-metadata for more     
         information.      

In the above situation, I tagged v2.2.8, the GitHub Actions updated name in pyproject.toml, and then setuptools-scm gave the version 2.2.9.dev0+gb875ea8f.d20240123. PyPI rejected the package with this version. I'd like to know if there is a way to get the version 2.2.8 even when a tracked file is changed. Thanks!

@RonnyPfannschmidt
Copy link
Contributor

that use-case not supported by normal means and will never be directly supported
you can abuse the SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mypkg env var to get things working

@njzjz
Copy link
Contributor Author

njzjz commented Jan 24, 2024

you can abuse the SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mypkg env var to get things working

Thanks! The workaround works for me.

In the GitHub Action, I get the version and set SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mypkg before any file is changed.

      - run: |
          python -m pip install setuptools_scm
          python -c "from setuptools_scm import get_version;print('SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DEEPMD-KIT-CU11='+get_version())" >> $GITHUB_ENV

@njzjz njzjz closed this as completed Jan 24, 2024
wanghan-iapcm pushed a commit to deepmodeling/deepmd-kit that referenced this issue Jan 24, 2024
Fix #3168.

See:
pypa/setuptools-scm#1006 (comment)

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
iProzd added a commit to iProzd/deepmd-kit that referenced this issue Jan 24, 2024
* Fix max nbor size related issues (deepmodeling#3157)

* Merge master into devel (deepmodeling#3167)

* [pre-commit.ci] pre-commit autoupdate (deepmodeling#3163)

<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.13 →
v0.1.14](astral-sh/ruff-pre-commit@v0.1.13...v0.1.14)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* setup PyTorch C++ interface build environement (deepmodeling#3169)

See deepmodeling#3120.

- CMake: add `ENABLE_TENSORFLOW` and `ENABLE_PYTORCH`.
`BUILD_TENSORFLOW` will be enabled when `TENSORFLOW_ROOT` is not empty
or `USE_TF_PYTHON_LIBS` is on.
- api_cc: add `BUILD_TENSORFLOW` and `BUILD_PYTORCH` defination. Move
several functions from `common.h` to `commonTF.h` to prevent exposing
them to header files.
- CI: download libtorch in the build/test CC actions.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

* docs: add TF icons to platform-specific features (deepmodeling#3171)

Fix deepmodeling#3121.

The PyTorch icon can be added when a feature implemented by PyTorch is
added.

However, I can't find a way to add an icon to TOC.


![image](https://github.com/deepmodeling/deepmd-kit/assets/9496702/7f29da27-af81-4850-9da0-79310d216b2d)

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

* add universal Python inference interface DeepPot (deepmodeling#3164)

Need discussion for other classes.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

* detect version in advance before building deepmd-kit-cu11 (deepmodeling#3172)

Fix deepmodeling#3168.

See:
pypa/setuptools-scm#1006 (comment)

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: Denghui Lu <denghuilu@pku.edu.cn>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
njzjz added a commit to njzjz/deepmd-kit that referenced this issue Feb 4, 2024
…ng#3172)

Fix deepmodeling#3168.

See:
pypa/setuptools-scm#1006 (comment)

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
(cherry picked from commit 5dfbb55)
wanghan-iapcm pushed a commit to deepmodeling/deepmd-kit that referenced this issue Feb 5, 2024
Fix #3168.

See:
pypa/setuptools-scm#1006 (comment)

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
(cherry picked from commit 5dfbb55)
@CatChenal
Copy link

CatChenal commented Feb 20, 2024

In the GitHub Action, I get the version and set SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mypkg before any file is changed.

      - run: |
          python -m pip install setuptools_scm
          python -c "from setuptools_scm import get_version;print('SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DEEPMD-KIT-CU11='+get_version())" >> $GITHUB_ENV

@njzjz Would you please provide a link to the GH action you amended?
Also, I don't quite understand what "before any file is changed" means: why does it matter?
I am debating getting rid of setuptools_scm: it will depends if I can fix the same problem I have!
Thank you.

@njzjz
Copy link
Contributor Author

njzjz commented Feb 20, 2024

In the GitHub Action, I get the version and set SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mypkg before any file is changed.

      - run: |
          python -m pip install setuptools_scm
          python -c "from setuptools_scm import get_version;print('SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DEEPMD-KIT-CU11='+get_version())" >> $GITHUB_ENV

@njzjz Would you please provide a link to the GH action you amended? Also, I don't quite understand what "before any file is changed" means: why does it matter? I am debating getting rid of setuptools_scm: it will depends if I can fix the same problem I have! Thank you.

@CatChenal You can check deepmodeling/deepmd-kit#3172. The version will be bumped if any of the git-tracked files is changed.

@CatChenal
Copy link

Thanks Jinzhe! That's a great project!
Unless I'm mistaken, your pyproject.toml is telling me you are no longer using setuptools_scm.
I think I'll try your dynamic versioning scheme.
All the best to you.

@njzjz
Copy link
Contributor Author

njzjz commented Feb 20, 2024

I use setuptools_scm through scikit-build-core.

@CatChenal
Copy link

CatChenal commented Feb 20, 2024 via email

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

3 participants