diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bae888f9..b4e71ba9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,3 +52,4 @@ repos: - id: markdown-link-check args: [--config, ".link-check.json", --quiet] stages: [manual] + exclude: \bATTRIBUTIONS\b diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bc7e2136..9127bdad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,32 @@ To see all available commands, run just ``` +## Releasing + +To release, you must be a maintainer of the [cosmos-predict2 package](https://pypi.org/project/cosmos-predict2/). + +Run pre-release check: + +```shell +just release-check +``` + +Commit any changes. + +Release to PyPI (omit `` to dry-run): + +```shell +just release +``` + +Push the new tag to GitHub: + +```shell +git push git@github.com:nvidia-cosmos/cosmos-predict2.git "v$(uv version --short)" +``` + +Merge the new commit to GitHub. + ## Code Reviews All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult diff --git a/bin/release.sh b/bin/release.sh index e132ad48..417646d4 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -24,6 +24,7 @@ fi PYPI_TOKEN="$1" shift +# Check that there are no uncommitted changes if [[ $(git status --porcelain) ]]; then echo "There are uncommitted changes. Please commit or stash them before proceeding." exit 1 @@ -31,8 +32,6 @@ fi # Bump the version and tag the release PACKAGE_VERSION=$(uv version --bump patch --short) -just license -just lint git add . git commit -m "v$PACKAGE_VERSION" git tag "v$PACKAGE_VERSION" diff --git a/justfile b/justfile index f09ce621..65d39a42 100644 --- a/justfile +++ b/justfile @@ -17,10 +17,20 @@ lint: setup # Run tests test: lint +# https://spdx.org/licenses/ +allow_licenses := "MIT BSD-2-CLAUSE BSD-3-CLAUSE APACHE-2.0 ISC" +ignore_package_licenses := "nvidia-* hf-xet certifi filelock matplotlib typing-extensions" + # Update the license license: install - uvx licensecheck --show-only-failing --ignore-packages "nvidia-*" "hf-xet" --zero + uvx licensecheck --show-only-failing --only-licenses {{allow_licenses}} --ignore-packages {{ignore_package_licenses}} --zero uvx pip-licenses --python .venv/bin/python --format=plain-vertical --with-license-file --no-license-path --no-version --with-urls --output-file ATTRIBUTIONS.md + pre-commit run --files ATTRIBUTIONS.md || true + +# Pre-release checks +release-check: + just license + pre-commit run --all-files --hook-stage manual # Release a new version release pypi_token='dry-run' *args: @@ -33,7 +43,7 @@ docker-build cuda_version='12.6.3' *args: # Run the docker container docker cuda_version='12.6.3' *args: # https://github.com/astral-sh/uv-docker-example/blob/main/run.sh - just -f {{justfile()}} docker-build "{{cuda_version}}" + just docker-build "{{cuda_version}}" docker run --gpus all --rm -v .:/workspace -v /workspace/.venv -it cosmos-predict2:{{cuda_version}} {{args}} # Run the arm docker container