diff --git a/.github/workflows/bump_version.yaml b/.github/workflows/bump_version.yaml new file mode 100644 index 00000000000..acf8ebd0f15 --- /dev/null +++ b/.github/workflows/bump_version.yaml @@ -0,0 +1,54 @@ +name: bump-python-sdk-version + +# This workflow is used to bump the version of the Weave Python SDK. +# It will take 2 steps: +# 1. Drop the pre-release tag and push a new commit to the main branch. +# 2. Bump the version to the next pre-release version and push a new commit to the main branch. +# +# see weave/version.py for more details on the versioning scheme. + +on: + workflow_dispatch: + inputs: + bump_type: + description: "Version bump type (major, minor, patch)" + required: true + default: "patch" + options: + - "patch" + - "minor" + - "major" + +jobs: + build-assets: + name: Build frontend assets + runs-on: ubuntu-8core + timeout-minutes: 10 + environment: + name: release + permissions: + contents: "write" + id-token: "write" + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.WANDBMACHINE_GITHUB_TOKEN }} + fetch-depth: 0 + - id: "Setup Git" + run: | + git config --global user.name 'Weave Build Bot' + git config --global user.email weave@wandb.com + - id: "Bump the version" + run: | + bump-my-version bump ${{ github.event.inputs.bump_type }} ./weave/version.py --tag --commit + git push + git push --tags + - id: "Start the next development cycle" + # This might seem weird to bump patch and then pre_n, but since semver + # dictates that pre-release versions have lower precedence, this ensures + # that the next commit on main will have a pre-release version. + run: | + bump-my-version bump patch ./weave/version.py + bump-my-version bump pre_n ./weave/version.py --commit + git push + git push --tags diff --git a/pyproject.toml b/pyproject.toml index 4e09cbf6b51..adec4b37b59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,3 +113,37 @@ exclude = [ "weave/legacy/**/*.py", "examples", ] + +[tool.bumpversion] +current_version = "0.51.2-dev1" +parse = """(?x) + (?P0|[1-9]\\d*)\\. + (?P0|[1-9]\\d*)\\. + (?P0|[1-9]\\d*) + (?: + - # dash separator for pre-release section + (?P[a-zA-Z-]+) # pre-release label + (?P0|[1-9]\\d*) # pre-release version number + )? # pre-release section is optional +""" +serialize = [ + "{major}.{minor}.{patch}-{pre_l}{pre_n}", + "{major}.{minor}.{patch}", +] +search = "{current_version}" +replace = "{new_version}" +regex = false +ignore_missing_version = false +ignore_missing_files = false +tag = false +sign_tags = false +tag_name = "v{new_version}" +tag_message = "Release version: {current_version} → {new_version}" +allow_dirty = false +commit = false +message = "Release version: {current_version} → {new_version}" +commit_args = "" + +[tool.bumpversion.parts.pre_l] +values = ["dev"] + diff --git a/requirements.dev.txt b/requirements.dev.txt index e0aad74fd36..8e7a65c626e 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -24,3 +24,4 @@ build twine lazydocs nbconvert +bump-my-version diff --git a/weave/version.py b/weave/version.py index 452c38578ea..e365789de54 100644 --- a/weave/version.py +++ b/weave/version.py @@ -1 +1,47 @@ -VERSION = "0.51.2" +"""Contains the version of the Weave SDK. + +This version is used by pyproject.toml to specify the version of the Weave SDK and +imported by the library for runtime access. It must be kept in sync with pyproject.toml, +specifically the [tool.bumpversion] section: + +``` +[tool.bumpversion] +current_version = "M.m.p-dev0" +``` + +We use Semantic Versioning (https://semver.org/). The version number is in the format +MAJOR.MINOR.PATCH[-PRERELEASE]. + +- MAJOR version when you make incompatible API changes, +- MINOR version when you add functionality in a backwards compatible manner, and +- PATCH version when you make backwards compatible bug fixes. + +For the most part, we are incrementing PATCH until we complete the core functionality. + +As specified by Semantic Versioning, the PRERELEASE version is optional and can be +appended to the PATCH version. Specifically: + +``` +When major, minor, and patch are equal, a pre-release version has lower precedence than a normal version: + +Example: 1.0.0-alpha < 1.0.0. +``` + +The intention is to have a PRERELEASE version of the form of `dev0` for nearly every commit +on the main branch. However, the released commit will not have a PRERELEASE version. For example: + +* Development happens on X.Y.Z-dev0 +* Release commit bumps the version to >=X.Y.Z, noted X'.Y'.Z', tagging such commit +* Development continues on (>X.Y.Z)-dev0. + * Note: if X' == X, Y' == Y, and Z' == Z, then the version is bumped to X'.Y'.(Z'+1)-dev0. Else, the version is bumped to X'.Y'.Z'-dev0. + + +This is all facilitated using `make bumpversion` which is a wrapper around `bump-my-version`. + +Please see the `bump-my-version` documentation for more information: +https://github.com/callowayproject/bump-my-version. Additional configuration can be found in +`pyproject.toml`. + +""" + +VERSION = "0.51.2-dev1"