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

Add git commit sha to displayed version (useful when running from source) #148

Open
fedelibre opened this issue Nov 25, 2022 · 6 comments
Open

Comments

@fedelibre
Copy link
Member

Looking at the git history, the version bump is usually made just before a new release.
IMO the version bump should be made after a release (of course, for the next unreleased version). Why? Two main reasons:

  1. If I run Frescobaldi and want to test python-ly from source, I can be sure that this is really the case if the git version shows an unreleased version.
  2. No risk of forgetting the version bump when you do a release :-)

@PeterBjuhr What do you think? Can you do the version bump?

@alerque
Copy link

alerque commented Nov 26, 2022

No, bumping versions before a release causes all sorts of problems later. People start using a HEAD version for some bug fix then later think they are running the later release and report against it.

The best way to handle this is with a VCS versioning system that shows the exact commit with the last release tag + N commits + commit sha. If this project doesn't want to adopt an SCM aware automated version tag then saving the bump until just before release is the right way to go.

@PeterBjuhr
Copy link
Collaborator

No, bumping versions before a release causes all sorts of problems later.

You mean after?

adopt an SCM aware automated version tag

Could Github actions be used to synchronize the release and the code change?

@alerque
Copy link

alerque commented Nov 26, 2022

No, bumping versions before a release causes all sorts of problems later.

You mean after?

No, I meant before, but more specifically long before. The version bump should be at or immediately prior to the release tag, not long before (e.g. at the very end of the dev cycle not the beginning).

adopt an SCM aware automated version tag

Could Github actions be used to synchronize the release and the code change?

Yes, but that's also unnecessary. The correct way to handle this is to remove the version info from the code entirely and rely on a build system that deduces it from the repo tags on every build. This can be done both for Git based source builds and tarballs if done correctly, but takes a bit of careful tooling.

@PeterBjuhr
Copy link
Collaborator

Thanks for clarifying!

@fedelibre
Copy link
Member Author

The best way to handle this is with a VCS versioning system that shows the exact commit with the last release tag + N commits + commit sha.

I agree, this is a good common practice.

@fedelibre fedelibre changed the title version bump right after a release Add git commit sha to displayed version (useful when running from source) Nov 26, 2022
@alerque
Copy link

alerque commented Nov 27, 2022

Since this project uses Python's setuptools build system, the logical step would be to adapt the versioning using setuptools_scm and adjust the release workflow around that.

jeanas added a commit to jeanas/python-ly that referenced this issue Mar 2, 2023
Modern Python packaging standards rely on static metadata in
pyproject.toml rather than dynamic metadata in setup.py.

Porting notes:

- In modern packaging, console scripts are installed via entry points.
  The bin/ directory containing the ly and ly-server scripts is removed;
  instead, entry points specify a module and function to run, and pip
  automatically creates a wrapper script when installing the project.

- The pkginfo is trimmed down to contain only the version. This is
  because pyproject.toml is not Python code, and the ways in which it
  can read metadata dynamically are limited. The conf.py file for Sphinx
  now declares the metadata as well; this might be considered duplication,
  but things like the name 'python-ly' and the author 'Wilbert Berendsen'
  are unlikely to change.

- There are now a few more URLs in the [project.urls] table.

- This does not use setuptools_scm to display the version, but that could
  be done in the future (see frescobaldi#148). However, getting the version for conf.py
  needs having the package installed, so this will impose certain constraints
  for developers.

- This change was tested by executing "python -m build" before and after,
  unpacking the sdists, and checking that the differences were intended.
jeanas added a commit to jeanas/python-ly that referenced this issue Mar 2, 2023
Modern Python packaging standards rely on static metadata in
pyproject.toml rather than dynamic metadata in setup.py, which is
considered deprecated.

Porting notes:

- In modern packaging, console scripts are installed via entry points.
  The bin/ directory containing the ly and ly-server scripts is removed;
  instead, entry points specify a module and function to run, and pip
  automatically creates a wrapper script when installing the project.

- The pkginfo is trimmed down to contain only the version. This is
  because pyproject.toml is not Python code, and the ways in which it
  can read metadata dynamically are limited. The conf.py file for Sphinx
  now declares the metadata as well; this might be considered duplication,
  but things like the name 'python-ly' and the author 'Wilbert Berendsen'
  are unlikely to change.

- There are now a few more URLs in the [project.urls] table.

- This does not use setuptools_scm to display the version, but that could
  be done in the future (see frescobaldi#148). However, getting the version for conf.py
  needs having the package installed, so this will impose certain constraints
  for developers.

- This change was tested by executing "python -m build" before and after,
  unpacking the sdists, and checking that the differences were intended.
jeanas added a commit that referenced this issue Mar 3, 2023
Modern Python packaging standards rely on static metadata in
pyproject.toml rather than dynamic metadata in setup.py, which is
considered deprecated.

Porting notes:

- In modern packaging, console scripts are installed via entry points.
  The bin/ directory containing the ly and ly-server scripts is removed;
  instead, entry points specify a module and function to run, and pip
  automatically creates a wrapper script when installing the project.

- The pkginfo is trimmed down to contain only the version. This is
  because pyproject.toml is not Python code, and the ways in which it
  can read metadata dynamically are limited. The conf.py file for Sphinx
  now declares the metadata as well; this might be considered duplication,
  but things like the name 'python-ly' and the author 'Wilbert Berendsen'
  are unlikely to change.

- There are now a few more URLs in the [project.urls] table.

- This does not use setuptools_scm to display the version, but that could
  be done in the future (see #148). However, getting the version for conf.py
  needs having the package installed, so this will impose certain constraints
  for developers.

- This change was tested by executing "python -m build" before and after,
  unpacking the sdists, and checking that the differences were intended.
ksnortum pushed a commit to ksnortum/python-ly that referenced this issue Jul 7, 2023
Modern Python packaging standards rely on static metadata in
pyproject.toml rather than dynamic metadata in setup.py, which is
considered deprecated.

Porting notes:

- In modern packaging, console scripts are installed via entry points.
  The bin/ directory containing the ly and ly-server scripts is removed;
  instead, entry points specify a module and function to run, and pip
  automatically creates a wrapper script when installing the project.

- The pkginfo is trimmed down to contain only the version. This is
  because pyproject.toml is not Python code, and the ways in which it
  can read metadata dynamically are limited. The conf.py file for Sphinx
  now declares the metadata as well; this might be considered duplication,
  but things like the name 'python-ly' and the author 'Wilbert Berendsen'
  are unlikely to change.

- There are now a few more URLs in the [project.urls] table.

- This does not use setuptools_scm to display the version, but that could
  be done in the future (see frescobaldi#148). However, getting the version for conf.py
  needs having the package installed, so this will impose certain constraints
  for developers.

- This change was tested by executing "python -m build" before and after,
  unpacking the sdists, and checking that the differences were intended.
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