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

Allow bump version to be run only once rather than per python-package #567

Open
krassowski opened this issue Apr 12, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@krassowski
Copy link
Contributor

It would be really helpful if we could delegate version bumping to a singular script rather than have it invoked on per-python-package basis. This is especially true if both python packages and npm packages are in a monorepo.

Currently it runs in directory of each package:

def bump_version(version_spec, version_cmd, changelog_path, python_packages, tag_format):
"""Prep git and env variables and bump version"""
prev_dir = os.getcwd()
for python_package in [p.split(":")[0] for p in python_packages]:
os.chdir(python_package)
lib.bump_version(version_spec, version_cmd, changelog_path, tag_format)
os.chdir(prev_dir)

Maybe we could have a new "single_version_bump" option?

@krassowski
Copy link
Contributor Author

Both jupyter-collaboration and jupyter-chat would benefit from this.

@krassowski
Copy link
Contributor Author

krassowski commented Apr 19, 2024

Because bump version also tries check if it can create tags for python packages (although these will never be created!), if these have the same version it will fail:

def bump_version(version_spec, version_cmd, changelog_path, tag_format):
"""Bump the version and verify new version"""
util.bump_version(version_spec, version_cmd=version_cmd, changelog_path=changelog_path)
version = util.get_version()
# A properly parsed version will have a "major" attribute
parsed = parse_version(version)
if util.SETUP_PY.exists() and not hasattr(parsed, "major"):
msg = f"Invalid version {version}"
raise ValueError(msg)
# Bail if tag already exists
tag_name = tag_format.format(version=version)
if tag_name in util.run("git --no-pager tag", quiet=True).splitlines():
msg = f"Tag {tag_name} already exists!"
msg += " To delete run: `git push --delete origin {tag_name}`"
raise ValueError(msg)
return version

Se we need to customize tag_format on per-package basis if there is more than one Python package (or allow to disable pushing tags for all but the top-level metapackage)

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

No branches or pull requests

1 participant