Skip to content

Use bumpversion for epidata client #1436

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

Merged
merged 3 commits into from
May 17, 2024
Merged

Conversation

rzats
Copy link
Contributor

@rzats rzats commented May 14, 2024

Closes #1431.

Summary:

Updates the versioning in the Python client to the same method used in the JS and R clients. With this method, the version is set to a simple hardcoded string; however, during a new Delphi release, GitHub Actions will run bump2version during the release process and automatically update this string in the code.

This can be replicated in a local environment; the following code should bump the version in the Python client (as well as the .bumpversion.cfg file itself, and 7 other files) to 4.1.21:

python3 -m pip install bump2version
bump2version --current-version 4.1.20 patch

Prerequisites:

  • Unless it is a documentation hotfix it should be merged against the dev branch
  • Branch is up-to-date with the branch to be merged with, i.e. dev
  • Build is successful
  • Code is cleaned up and formatted

@rzats rzats requested review from melange396 and dshemetov May 14, 2024 12:28
@melange396 melange396 mentioned this pull request May 14, 2024
4 tasks
Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already duplicating the version number twice in this package, once in the __init__.py and once in the setup.py, which is kinda ugly. i would feel better if we could avoid adding a third copy of it. What if we keep the literal in delphi_epidata.py and make https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/packaging/pypi/delphi_epidata/__init__.py just look like:

from .delphi_epidata import Epidata, __version__

name = "delphi_epidata"

@melange396
Copy link
Collaborator

and dont forget to add to CHANGELOG.md!

@rzats rzats force-pushed the rzatserkovnyi/client-version branch from c94b464 to 01c8823 Compare May 17, 2024 20:15
_version = version("delphi-epidata")
except PackageNotFoundError:
_version = "0.script"
_version = "4.1.20"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to agree with the change in __init__.py:

Suggested change
_version = "4.1.20"
__version__ = "4.1.20"

(and then change the other references to this variable as well)

_version = version("delphi-epidata")
except PackageNotFoundError:
_version = "0.script"
_version_ = "4.1.20"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still doesnt match whats in __init__.py!

Suggested change
_version_ = "4.1.20"
__version__ = "4.1.20"

the convention is for this to be a "dunder", as seen in the good ol:

if __name__ == '__main__':

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@melange396 melange396 merged commit 68ded7c into dev May 17, 2024
8 checks passed
@melange396 melange396 deleted the rzatserkovnyi/client-version branch May 17, 2024 22:19
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

Successfully merging this pull request may close these issues.

Fix python client's user-agent version
2 participants