Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
tags:
# To modify to trigger the job for fork's releases
# Note: GitHub's filter pattern capabilities are limited[1], so this
# pattern matches more often than it should. A more correct regex would
# be the one found in scripts/tag.sh.
# pattern matches more often than it should. A more correct validation would
# be one compatible with scripts/git/get_version.py.
# [1] https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- "interuss/monitoring/v[0-9]+.[0-9]+.[0-9]+-?*"
permissions:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: setup-python
uses: actions/setup-python@v7
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: setup-python
uses: actions/setup-python@v7
with:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ sdist/
var/
wheels/
*.egg-info/
build/lib/
build/bdist*/
Comment on lines +26 to +27

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are those two still needed?

uv build on my machine don't write to build/, but I know you have restrictions with your python setup.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

uv build --wheel leaves these artifacts.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, should we move them out then? build is used for other purposes, having it mixed with others artifacts may be an issue no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure what the suggested action is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

diff --git a/pyproject.toml b/pyproject.toml
index aea1a74cd..984bb0152 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -130,3 +130,6 @@ namespaces = true
 
 [tool.setuptools.dynamic]
 version = {attr = "monitoring._version.__version__"}
+
+[tool.distutils.build]
+build_base = "buildpip"

(With the name to be revised, really not sure about it)

So everything goes to a different directory than the one we use for others scripts.

(It should probably be git ignored as well)

.installed.cfg
*.egg
MANIFEST
Expand Down Expand Up @@ -129,5 +131,5 @@ go
# vscode files
.vscode

# setuptools_scm
# Generated version file
_version.py
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include monitoring/_version.py
recursive-include scripts/git *.py
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
USER_GROUP := $(shell id -u):$(shell id -g)

UPSTREAM_OWNER := $(shell scripts/git/upstream_owner.sh)
COMMIT := $(shell scripts/git/commit.sh)

ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
Expand Down Expand Up @@ -56,9 +53,6 @@ image:
image-dev:
cd monitoring && make image-dev

tag:
scripts/tag.sh $(UPSTREAM_OWNER)/monitoring/v$(VERSION)

.PHONY: start-locally
start-locally:
build/dev/run_locally.sh up --wait
Expand Down
48 changes: 33 additions & 15 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,31 @@

## Background

Releases of monitoring are based on git tags in the format `interuss/monitoring/v[0-9]+\.[0-9]+\.[0-9]+`, optionally suffixed with `-[0-9A-Za-z-.]+`. This tag form follows the pattern `[owner]/[component]/[semantic version]`; see [semantic version](https://semver.org) for more information.
Releases of `monitoring` utilize git tags structured precisely as `interuss/monitoring/v[X].[Y].[Z][-rcN]` to support PEP 440 representations.

This formatting conforms to the InterUSS Component Registry pattern `[owner]/[component]/[semantic version]` where the semantic version is constrained to be easily represented as PEP 440. (See [Semantic Versioning](https://semver.org) and [PEP 440 Version Identification](https://peps.python.org/pep-0440/)).

Keeping track of breaking changes and migration instructions is done through the [NEXT_RELEASE_NOTES.md](NEXT_RELEASE_NOTES.md) file, which is updated as features are added or modified and serves as a basis for release notes.

When either an executable or image is built from a `git` checkout of the source, the most recent tag is used as the version tag. If no such tag exists, the build system defaults to v0.0.0-[commit_hash]. If commits have been added to the tag, the commit hash is appended to the version. If the workspace is not clean, `-dirty` is appended to it. The version tag is computed by [`scripts/git/version.sh`](scripts/git/version.sh).
### PEP 440 Versioning, Validation, & PyPI Releases
For compatibility with PyPI (Python Package Index) and Docker registry distributions, versions must follow the conventions below:
* **Official Releases (`vX.Y.Z`)**: Output purely as canonical, unmodified Semantic Versions (`X.Y.Z`). These artifacts are fully eligible for publishing to PyPI.
* **Release Candidates (`vX.Y.Z-rc[N]`)**:
* Pre-release tags must utilize the strictly lowercase, hyphenated `-rc[N]` suffix (e.g., `v0.31.0-rc1`).
* Build tooling normalizes these delimiters into PEP 440-compliant pre-release strings (`X.Y.Zrc[N]`) for PyPI compatibility.
* Note: Pre-releases containing uppercase identifiers (e.g., `-RC1`), space delimiters, alphabetic metadata, or non-numeric suffixes (e.g., `-alpha`, `-1.2`) are prevented to avoid accidental malformed PyPI publication attempts.
* **Development & Branch Builds (`+<metadata>`)**:
* Any image or PyPI artifact generated from a development branch, Pull Request, or commit other than an explicitly tagged release/pre-release boundary automatically appends PEP 440 Local Version Segments utilizing the `+` delimiter (e.g., `0.31.0+d56bb4d`).
* Because PyPI rejects package uploads bearing PEP 440 `+` local-version metadata, this provides a safeguard preventing non-release/development builds from accidentally polluting the public package registry.

## PyPI Package Distribution (`interuss_monitoring`)
As part of broader interoperating improvements for the InterUSS Python ecosystem:
* **Distribution Identity**: The `monitoring` Python codebase is published to PyPI under the canonical ecosystem package name **`interuss_monitoring`**.
* **Current Import Namespace**:
* Consumers install the package via `pip install interuss_monitoring`.
* Currently, internal code modules and external users importing from the PyPI package interact with the Python import namespace via **`import monitoring.<submodule>`**.
* Currently, users must ensure their active Python virtual environment does not contain a conflicting top-level `monitoring/` directory from alternative third-party packages to prevent Python import-shadowing and runtime `ModuleNotFoundError` conflicts.
* **Future**: In the future, we anticipate migrating towards a fully isolated `src/interuss_monitoring` layout and explicit `import interuss_monitoring.<submodule>` namespace, mirroring the architectural patterns established by `implicitdict` and `uas_standards`.

## Release procedure

Expand All @@ -15,21 +35,19 @@ Releasing a monitoring version requires the following steps:
- `X` is the major release number
- `Y` is the minor release number
- `Z` is the patch number
- (optionally) `W` is the prerelease
- `X.Y.Z[-W]` is according to [semantic versioning](https://semver.org)
- Note that valid examples of this form include `0.1.0`, `20.0.0`, `0.5.0-rc`, `0.5.0-1.2`
- (optionally) `W` is the pre-release candidate (**must strictly be formatted as `rcN`**, e.g., `rc1`, `rc2`)
- `X`, `Y`, and `Z` should be selected according to the nature of the changes included in the release
- See [NEXT_RELEASE_NOTES.md](./NEXT_RELEASE_NOTES.md) for the minimum version increment, and look for any changes that might suggest a more substantial category of release than the intended next version currently tracked in NEXT_RELEASE_NOTES
- Create a release tag via *one* of the following methods:
- On the InterUSS fork, click Releases -> Draft a new release
- For **Tag**, enter `interuss/monitoring/vX.Y.Z` (see below for format)
- For **Release title**, enter `vX.Y.Z` (corresponding to the tag)
- For Release notes, click **Generate release notes**, then add any content from [NEXT_RELEASE_NOTES.md](./NEXT_RELEASE_NOTES.md) to the top of the notes
- Create a release tag on main using `make tag VERSION=X.Y.Z[-W]`. The script will push a tag (`release tag`) to the remote origin under the form of `[owner]/monitoring/vX.Y.Z[-W]`, where
- `[owner]` is either the organization name or the username of the origin remote url
- Official releases are `interuss/monitoring/v#.#.#`.
- Add the pending release notes from [NEXT_RELEASE_NOTES.md](NEXT_RELEASE_NOTES.md) to the release notes.
- The github workflow ([.github/workflows/image-publish.yml](.github/workflows/image-publish.yml)) is triggered for every new release tag. On the canonical interuss fork, it builds and publishes the monitoring image to the [official docker registry](https://hub.docker.com/repository/docker/interuss/monitoring).
- Create and publish a release in GitHub:
- On the repository, navigate to **Releases** -> **Draft a new release**.
- For **Choose a tag**, enter `interuss/monitoring/vX.Y.Z` (or `interuss/monitoring/vX.Y.Z-rcN` for pre-releases) and click **Create new tag**.
- Ensure the target branch is `main`.
- For **Release title**, enter `vX.Y.Z` (or `vX.Y.Z-rcN`).
- Click **Generate release notes**, then copy and prepend any pending content from [NEXT_RELEASE_NOTES.md](./NEXT_RELEASE_NOTES.md) to the top of the release notes.
- Click **Publish release**.
- The GitHub workflows are triggered by the published release/tag:
- The image publishing workflow ([.github/workflows/image-publish.yml](.github/workflows/image-publish.yml)) is triggered for every new release tag. On the canonical interuss fork, it builds and publishes the monitoring image to the [official docker registry](https://hub.docker.com/repository/docker/interuss/monitoring).
- The package publishing workflow ([.github/workflows/publish.yaml](.github/workflows/publish.yaml)) is triggered when a release is published. It builds the `interuss_monitoring` Python distribution packages (`.tar.gz` and `.whl`) and publishes them to PyPI.
- After completing the release, open a PR to remove the pending release notes from [NEXT_RELEASE_NOTES.md](NEXT_RELEASE_NOTES.md) and update the anticipated next release version number assuming just a bug fix (e.g., v0.18.3 -> v0.18.4)
- When a PR with a change larger than the current anticipated next release version number in [NEXT_RELEASE_NOTES.md](./NEXT_RELEASE_NOTES.md) is made, it should ideally also adjust the anticipated next release version number in NEXT_RELEASE_NOTES
- Example 1: if the most recent release was v0.18.3, NEXT_RELEASE_NOTES indicated v0.18.4, and a PR made a change larger than a bug fix, that PR should change the number in NEXT_RELEASE_NOTES to v0.19.0
Expand Down
4 changes: 2 additions & 2 deletions build/build_and_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ else
fi
cd "${BASEDIR}"

VERSION=$(./scripts/git/version.sh monitoring)
VERSION=$(./scripts/git/get_version.py --format imagetag)
LATEST_TAG="latest"

if [[ -z "${DOCKER_URL}" ]]; then
Expand All @@ -39,7 +39,7 @@ else
TAG="${DOCKER_URL}/monitoring:${VERSION}"

echo "Building image ${TAG}"
./monitoring/build.sh "${TAG}"
./monitoring/build.sh normal "${TAG}"

echo "Pushing docker image ${TAG}..."
docker image push "${TAG}"
Expand Down
1 change: 0 additions & 1 deletion monitoring/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ ARG version
ARG commit_hash
ENV MONITORING_VERSION=$version
ENV GIT_COMMIT_HASH=$commit_hash
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MONITORING=$version

# Add core content from repo
ADD ./interfaces /app/interfaces
Expand Down
2 changes: 1 addition & 1 deletion monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ image: ../uv.lock ../pyproject.toml $(shell find . -type f ! -path "*/output/*"
./build.sh

image-dev: ../uv.lock ../pyproject.toml $(shell find . -type f ! -path "*/output/*" ! -path "*/.*" ! -path "*/__pycache__/*" ! -name image ! -name image-dev ! -name "*.pyc") $(shell find ../interfaces -type f)
./build_dev.sh
./build.sh dev

.PHONY: test
test:
Expand Down
56 changes: 47 additions & 9 deletions monitoring/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,52 @@ else
fi
cd "${BASEDIR}/.." || exit 1

TAG="${1:-interuss/monitoring}"
if [[ "$1" == "dev" ]]; then
IMAGE_VARIANT="dev"
TAG="${2:-interuss/monitoring}"
elif [[ "$1" == "normal" ]]; then
IMAGE_VARIANT="normal"
TAG="${2:-interuss/monitoring}"
else
IMAGE_VARIANT="normal"
TAG="${1:-interuss/monitoring}"
fi
VERSION_STR=$(scripts/git/get_version.py --format pep440)
COMMIT_HASH=$(scripts/git/get_version.py --format commitsha1)
scripts/git/write_version_file.py > /dev/null

if [[ "${IMAGE_VARIANT}" == "normal" ]]; then
DOCKER_TAG="${TAG}"
else
DOCKER_TAG="${TAG}-dev"
fi

docker image build \
-f monitoring/Dockerfile \
-t "${TAG}" \
--build-arg version="$(scripts/git/version.sh monitoring --long)" \
--build-arg commit_hash="$(git rev-parse HEAD)" \
. \
|| exit 1
echo "=== InterUSS docker ${IMAGE_VARIANT} image build ==="
echo "Version: ${VERSION_STR}"
echo "Docker tag: ${DOCKER_TAG}"
echo "Commit hash: ${COMMIT_HASH}"
echo "======================================"

echo "File created by monitoring/build.sh to keep track of the latest normal image build run date time." > monitoring/image
if [[ "${IMAGE_VARIANT}" == "normal" ]]; then
docker image build \
-f monitoring/Dockerfile \
-t "${DOCKER_TAG}" \
--build-arg version="${VERSION_STR}" \
--build-arg commit_hash="${COMMIT_HASH}" \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This changed from HEAD to COMMIT_HASH, witch may include the -dirty flag (nit: and it's not an hash).

This is injected in urls by repo_url_of and generate invalid links.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks; this was unintentional and just trying to put everything related to versions in get_version.py -- I've updated to use the full commit hash (in to-be-pushed commit).

. \
|| exit 1

echo "File created by monitoring/build.sh to keep track of the latest normal image build run date time." > monitoring/image

else
docker image build \
-f monitoring/Dockerfile \
-t "${DOCKER_TAG}" \
--build-arg BASE_STAGE=dev-dependencies \
--build-arg version="${VERSION_STR}" \
--build-arg commit_hash="${COMMIT_HASH}" \
. \
|| exit 1

echo "File created by monitoring/build.sh to keep track of the latest dev image build run date time." > monitoring/image-dev
fi
26 changes: 0 additions & 26 deletions monitoring/build_dev.sh

This file was deleted.

13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "monitoring"
name = "interuss_monitoring"
dynamic = ["version"]
authors = [
{ name="InterUSS Platform", email="tsc@lists.interussplatform.org" },
Expand Down Expand Up @@ -100,13 +100,14 @@ exclude = [
"monitoring/mock_uss/output/*",
"monitoring/uss_qualifier/output/*",
"monitoring/benchmarker/output/*",
"build/lib/*",
"dist/*",
]

[build-system]
requires = [
"setuptools>=84.0.0",
"wheel>=0.48.0", # for bdist package distribution
"setuptools_scm>=10.2.1", # for automated versioning
]

build-backend = "setuptools.build_meta"
Expand All @@ -118,16 +119,14 @@ package-dir = { "monitoring" = "monitoring" }
[tool.setuptools.packages.find]
where = ["."]
include = [
"monitoring",
"monitoring.deployment_manager*",
"monitoring.mock_uss*",
"monitoring.monitorlib*",
"monitoring.prober*",
"monitoring.uss_qualifier*",
"monitoring._version.py"
]
namespaces = true

[tool.setuptools_scm]
write_to = "monitoring/_version.py"
tag_regex = "^interuss/monitoring/v(?P<version>\\d+\\.\\d+\\.\\d+)"

[tool.setuptools.dynamic]
version = {attr = "monitoring._version.__version__"}
14 changes: 0 additions & 14 deletions scripts/git/commit.sh

This file was deleted.

Loading
Loading