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

Feat: version from git metadata #376

Merged
merged 6 commits into from
Dec 18, 2023
Merged

Feat: version from git metadata #376

merged 6 commits into from
Dec 18, 2023

Conversation

thekaveman
Copy link
Member

@thekaveman thekaveman commented Nov 30, 2023

Closes #287

I'm noticing that setuptools_scm seems to want an annotated tag, because it uses

git describe

To get the version, which by default only lists annotated tags. See more:

@thekaveman thekaveman added the enhancement New feature or request label Nov 30, 2023
@thekaveman thekaveman self-assigned this Nov 30, 2023
@thekaveman thekaveman marked this pull request as ready for review November 30, 2023 18:50
@thekaveman thekaveman requested a review from a team as a code owner November 30, 2023 18:50
@thekaveman thekaveman marked this pull request as draft November 30, 2023 18:59
@angela-tran
Copy link
Member

@thekaveman I'm wondering if you know what's going on here:

I checked out the 2023.11.1-pre1 tag, which is an annotated git tag. When I run git describe, I see 2023.11.1-pre1. I rebuild the appcontainer by running docker compose build server and then rebuild the devcontainer. I run the app by hitting F5. I expect to see a log message that prints Starting Eligibility Server 2023.11.1-pre1, but instead I see Starting Eligibility Server 2023.11.1rc2.dev0+gf91a4d1.d20231204

I'm confused on where this is coming from. Have you seen this before?

image

@thekaveman
Copy link
Member Author

but instead I see Starting Eligibility Server 2023.11.1rc2.dev0+gf91a4d1.d20231204

So I think what you're seeing is setuptools_scm computing what it thinks the next version will be; see more here: https://setuptools-scm.readthedocs.io/en/latest/usage/#default-versioning-scheme

Question: do you have untracked changes locally? I think that is where the dev0+gf91a4d1.d20231204 portion is coming from, essentially computing the "distance" from the most recent tag.

@angela-tran
Copy link
Member

Question: do you have untracked changes locally?

Ah yes, I did. I have removed all untracked changes now.

I've done as much as I can to start from a clean slate, i.e. I deleted all eligibility_server images and rebuilt the devcontainer without any caching. However, I'm still seeing a computed "next" version as the version number.

For example, when I run pip list:

calitp@ab9899e30ff7:~/app$ pip list
Package                     Version                              Editable project location
--------------------------- ------------------------------------ -------------------------
aniso8601                   9.0.1
Babel                       2.13.1
black                       23.11.0
blinker                     1.7.0
bracex                      2.4
certifi                     2023.11.17
cffi                        1.16.0
cfgv                        3.4.0
charset-normalizer          3.3.2
click                       8.1.7
colorama                    0.4.6
coverage                    7.3.2
cryptography                41.0.7
Deprecated                  1.2.14
distlib                     0.3.7
eligibility-api             2023.9.1
eligibility-server          2023.11.1rc2.dev0+gf91a4d1.d20231204 /home/calitp/app
filelock                    3.13.1
flake8                      6.1.0
Flask                       2.3.3
...

@thekaveman What does your pip list show?

support usage from the command line to print version info:

    python -m setuptools_scm
@thekaveman
Copy link
Member Author

@angela-tran I think I know what is happening?

I was also seeing the same pip list output. And I noticed when rebuilding the devcontainer that the same version was being installed.

Then I checked out the tag itself:

git checkout 2023.11.1-pre1

Then

$ python -m setuptools_scm
2023.11.1rc1

So I think all this is saying is you're currently on a commit that is further in the future than the most recent tag, hence you must be on a new version, hence calculating that new version string.

(I added setuptools_scm as a devcontainer dependency if you grab the latest commit on this branch)

@angela-tran
Copy link
Member

This can be closed if #382 is approved and merged

@angela-tran angela-tran merged commit 1de0a07 into dev Dec 18, 2023
7 checks passed
@angela-tran angela-tran deleted the feat/git-version branch December 18, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for app getting its version dynamically
2 participants