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

Define fallback version string for non-git-aware shells #1111

Open
BenediktBurger opened this issue May 16, 2024 · 4 comments
Open

Define fallback version string for non-git-aware shells #1111

BenediktBurger opened this issue May 16, 2024 · 4 comments

Comments

@BenediktBurger
Copy link
Member

Hello,
I actually run into another issue when trying to install from the cloned repository.

If you do so:

pip install -e .

and if your shell is not aware of git (which was my case) then the installation complains it cannot find the version because it cannot find git. It troubled me for quite some time before I realized this. So if you install using pip the repo code (from a zip) of from a clone but with unaware git app, the installation will fail...

Originally posted by @seb5g in #893 (comment)

Should we define a fallback version for setuptools_scm?
According to pypa/setuptools_scm#549, the fallback is for authors (us), while the environment variable is for packages (or users).

@seb5g
Copy link
Contributor

seb5g commented May 16, 2024

Well I'm not sure why you use scm to define your version and not hardcode it into a file. Is there a reason?
Then where is the version specified within git?

@BenediktBurger
Copy link
Member Author

Well I'm not sure why you use scm to define your version and not hardcode it into a file. Is there a reason? Then where is the version specified within git?

Setuptools_scm reads the "source code management" (here git) to deduce a version info. In git it reads the last tag in the form "vMajor.Minor.Patch...".

Why someone wants to use it: you do not have to change a file and add a tag.
The tag (created on release) is sufficient.

The reason why pymeasure did it, I do not know, as it predates my participation. I guess it is the above mentioned reason.

@seb5g
Copy link
Contributor

seb5g commented May 17, 2024

well it makes sense indeed, I think my particular case where i use git wrapped into github desktop (and not shell aware) is a bit particular to make a modification of the code for this. However a fallback version like 0.0.0 would be nice (it is actually what happens when I removed the setuptools_scm bits within the pyproject.toml for the installation to work)

@bilderbuchi
Copy link
Member

bilderbuchi commented May 22, 2024

The original reason was a user request for a more accurate/precise version (e.g. when living on pymeasure master branch and working in notebooks, if I remember correctly). That we do not need to manually update some version file is an additional benefit.

First, please check if this still occurs with setuptools_scm 8.1.0.

Then, if we get a precise description of what is going wrong in the OP's case, maybe we can adapt the logic or call in https://github.com/pymeasure/pymeasure/blob/master/pymeasure/__init__.py#L30 to cover that case and fall into the fallback branch.

@bilderbuchi bilderbuchi changed the title Define fallback version in setup.py Define fallback version string for non-git-aware shells May 22, 2024
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