Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 5 additions & 5 deletions .github/PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ The GitHub `pypi` environment requires approval and only permits tags matching `

To publish a new version:

1. **Update the changelog** (if not already done):
```bash
# Edit CHANGELOG.md to add new version details
```
1. **Review the Release Drafter draft**:
- Label merged pull requests `breaking` for a major version or `enhancement` for a minor version; unlabelled changes default to patch.
- Review the draft release notes and OpenAPI diff; do not edit `CHANGELOG.md`.

2. **Create and push a version tag**:
```bash
# Create a new version tag (e.g., v1.2.3)
git tag v1.2.3
git tag -a v1.2.3 -m "<highlights>"

# Push the tag to trigger the workflow
git push origin v1.2.3
Expand All @@ -42,6 +41,7 @@ To publish a new version:
- Build the package using Python build
- Wait for approval on the `pypi` environment
- Publish to PyPI using a short-lived Trusted Publishing credential
- Publish the most recent Release Drafter draft regardless of its current tag, rename it to the pushed tag, and prepend the annotated tag message under "Highlights"; or create a release with generated notes if no draft exists

### 3. Version Numbering

Expand Down
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
version: 2
updates:
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 3

- package-ecosystem: "pip"
directory: "/"
schedule:
Expand Down
20 changes: 10 additions & 10 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ template: |
<!-- OPENAPI_DIFF -->

categories:
- type: version-resolver
semver-increment: major
when:
label: breaking
- type: version-resolver
semver-increment: minor
when:
label: enhancement
- type: version-resolver
semver-increment: patch
- title: 🚀 New features and improvements
labels:
- enhancement
Expand All @@ -34,16 +44,6 @@ categories:
- title: 🔐 Security
labels:
- "🔐 security"
- type: version-resolver
semver-increment: major
when:
label: major
- type: version-resolver
semver-increment: minor
when:
label: minor
- type: version-resolver
semver-increment: patch

exclude-labels:
- skip-changelog
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,48 @@ jobs:

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
release:
needs: publish-to-pypi
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 5
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Fetch annotated tag message
run: git fetch --force origin "refs/tags/${GITHUB_REF_NAME}:refs/tags/${GITHUB_REF_NAME}"
- name: Publish GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_REF="refs/tags/${GITHUB_REF_NAME}"
HIGHLIGHTS=""
if [ "$(git cat-file -t "$TAG_REF" 2>/dev/null || true)" = "tag" ]; then
HIGHLIGHTS=$(git for-each-ref "$TAG_REF" --format='%(contents)' | sed '/^-----BEGIN PGP SIGNATURE-----/,$d')
if [ -z "$(printf '%s' "$HIGHLIGHTS" | tr -d '[:space:]')" ]; then
HIGHLIGHTS=""
fi
fi

RELEASE_ID=$(gh api "repos/${GITHUB_REPOSITORY}/releases?per_page=100" --jq 'map(select(.draft))[0].id // empty')
if [ -n "$RELEASE_ID" ]; then
BODY=$(gh api "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" --jq '.body // ""')
if [ -n "$HIGHLIGHTS" ]; then
BODY=$(printf '## Highlights\n\n%s\n\n%s' "$HIGHLIGHTS" "$BODY")
fi
jq -n \
--arg tag_name "$GITHUB_REF_NAME" \
--arg name "$GITHUB_REF_NAME" \
--arg body "$BODY" \
'{tag_name: $tag_name, name: $name, body: $body, draft: false, make_latest: "true"}' \
> /tmp/release.json
gh api --method PATCH "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" --input /tmp/release.json
elif [ -n "$HIGHLIGHTS" ]; then
gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes \
--title "$GITHUB_REF_NAME" --latest \
--notes "$(printf '## Highlights\n\n%s' "$HIGHLIGHTS")"
else
gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes \
--title "$GITHUB_REF_NAME" --latest
fi
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ dmypy.json

# Serena
.serena/

tools/swagger.json
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.
Release notes for every version are published on [GitHub Releases](https://github.com/rootlyhq/rootly-python/releases). They are drafted automatically by Release Drafter from merged pull requests and include an OpenAPI diff against the previous release.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Older releases

## [Unreleased]
_Entries below predate GitHub Releases and are no longer updated._

## [2.0.1] - 2026-08-31

Expand Down
11 changes: 6 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ This is a Python SDK for the Rootly API v1.

## Dependencies

- Python 3.9+
- Python 3.10+
- httpx (HTTP client)
- attrs (data classes)
- python-dateutil (date parsing)

## Development

- Uses Poetry for dependency management
- Uses uv for dependency management
- Follows Ruff linting rules (line length 120, select F/I/UP)
- Generated from OpenAPI specification

Expand All @@ -33,11 +33,12 @@ python -c "import rootly_sdk; print('SDK imports successfully')"

## Regenerating the Client

To regenerate the client from the OpenAPI specification:
Use `make regenerate` to fetch and preprocess the OpenAPI specification, run the generator pinned in `uv.lock`, and apply the post-generation fixes. Never run a global `openapi-python-client`.

```bash
openapi-python-client generate --url https://rootly-heroku.s3.amazonaws.com/swagger/v1/swagger.json --no-fail-on-warning --output-path . --overwrite --config tools/config.yaml
make regenerate
```

## Building

Uses Poetry build system with `poetry-core` backend.
Uses `poetry-core` as the build backend.
28 changes: 17 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: bump-major bump-minor bump-patch regenerate test
.PHONY: bump-major bump-minor bump-patch fetch-spec generate regenerate test

# Get current version from pyproject.toml
CURRENT_VERSION := $(shell grep -E '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
Expand All @@ -18,34 +18,40 @@ RUFF_VERSION := 0.16.3
bump-major:
@echo "Bumping version: $(CURRENT_VERSION) -> $(NEW_MAJOR)"
@sed -i '' 's/version = "$(CURRENT_VERSION)"/version = "$(NEW_MAJOR)"/' pyproject.toml
@sed -i '' 's/## \[Unreleased\]/## [Unreleased]\n\n## [$(NEW_MAJOR)] - $(TODAY)/' CHANGELOG.md
@echo "Version bumped to $(NEW_MAJOR)"

bump-minor:
@echo "Bumping version: $(CURRENT_VERSION) -> $(NEW_MINOR)"
@sed -i '' 's/version = "$(CURRENT_VERSION)"/version = "$(NEW_MINOR)"/' pyproject.toml
@sed -i '' 's/## \[Unreleased\]/## [Unreleased]\n\n## [$(NEW_MINOR)] - $(TODAY)/' CHANGELOG.md
@echo "Version bumped to $(NEW_MINOR)"

bump-patch:
@echo "Bumping version: $(CURRENT_VERSION) -> $(NEW_PATCH)"
@sed -i '' 's/version = "$(CURRENT_VERSION)"/version = "$(NEW_PATCH)"/' pyproject.toml
@sed -i '' 's/## \[Unreleased\]/## [Unreleased]\n\n## [$(NEW_PATCH)] - $(TODAY)/' CHANGELOG.md
@echo "Version bumped to $(NEW_PATCH)"

regenerate:
openapi-python-client generate \
--url https://rootly-heroku.s3.amazonaws.com/swagger/v1/swagger.json \
fetch-spec:
curl -fsSL https://rootly-heroku.s3.amazonaws.com/swagger/v1/swagger.json -o tools/swagger.json
uv run python tools/fix_openapi_escalation_paths.py tools/swagger.json
uv run python tools/fix_nullable_severity.py tools/swagger.json

# openapi-python-client requires Python 3.11+.
generate:
uv run --python 3.12 --group dev openapi-python-client generate \
--path tools/swagger.json \
--no-fail-on-warning \
--output-path . \
--meta none \
--output-path rootly_sdk \
--overwrite \
--config tools/config.yaml
@echo "Applying nullable enum fix..."
@python tools/fix_nullable_enums.py
@uv run --python 3.12 python tools/fix_nullable_enums.py
@echo "Fixing lint errors..."
@uvx --from ruff==$(RUFF_VERSION) ruff check --fix .
@uv run --python 3.12 --group dev ruff check --fix .
@echo "Formatting patched files..."
@uvx --from ruff==$(RUFF_VERSION) ruff format .
@uv run --python 3.12 --group dev ruff format .

regenerate: fetch-spec generate

test:
python -m unittest discover -s tests
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rootly"
version = "2.0.1"
version = "3.0.0"
description = "A client library for accessing Rootly API v1"
authors = []
readme = "README.md"
Expand All @@ -17,11 +17,14 @@ classifiers = [
]
dynamic = ["dependencies"]

[dependency-groups]
dev = ["openapi-python-client==0.29.0; python_version >= '3.11'", "ruff==0.16.3"]

[project.urls]
Homepage = "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/rootlyhq/rootly-python"
Issues = "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/rootlyhq/rootly-python/issues"
Repository = "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/rootlyhq/rootly-python.git"
Changelog = "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/rootlyhq/rootly-python/blob/master/CHANGELOG.md"
Changelog = "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/rootlyhq/rootly-python/releases"

[tool.poetry]
packages = [
Expand Down
Loading