We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
dac next-v
In most scenario, a new data release corresponds to a minor version update. It would be useful to have a way to achieve this with a dac command.
dac
As of now I can think of a new subcommand that can be called like this:
dac get-next-minor-v --pkg-name PKG_NAME --major-v MAJOR
and that returns the next full minor version (e.g. 1.4.0).
Here a sample script:
import re import subprocess import typer from rich import print app = typer.Typer() @app.command() def main( library_name: str = typer.Option(..., envvar="DAC_PKG_NAME"), major: int = typer.Option(..., envvar="DAC_PKG_MAJOR"), ) -> str: """ Determine what should be the next version of a library, assuming a minor version increase. """ latest_version = determine_latest_version(library_name, major) next_version = increase_version_minor(latest_version, str(major)) print(next_version) return next_version def determine_latest_version(library_name: str, major: int) -> str: try: output = subprocess.check_output( ["pip", "install", f"{library_name}=={major}.*", "--dry-run"], stderr=subprocess.DEVNULL, ) last_line = output.decode("utf-8").splitlines()[-1] regex_rule = f"{library_name.replace('_', '-')}-{major}\.[^ ]+" match = re.search(regex_rule, last_line) assert match is not None return match[0][len(f"{library_name}-") :] except Exception: return "None" def increase_version_minor(version: str, major: str = "0") -> str: if version == "None": return f"{major}.0.0" major, minor, _ = version.split(".") return f"{major}.{int(minor) + 1}.0" if __name__ == "__main__": app()
The text was updated successfully, but these errors were encountered:
next-version
No branches or pull requests
In most scenario, a new data release corresponds to a minor version update.
It would be useful to have a way to achieve this with a
dac
command.As of now I can think of a new subcommand that can be called like this:
and that returns the next full minor version (e.g. 1.4.0).
Here a sample script:
The text was updated successfully, but these errors were encountered: