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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/actions/integration_tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ outputs: {}
runs:
using: "composite"
steps:
- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.10"
- name: Install Hatch
- name: Install Dependencies
shell: bash
run: pip install hatch==${{ env.HATCH_VERSION }}
run: uv sync --group test
# we are using the "automated-tests" organization with predefined users and workspaces
- name: Run SDK Tests
shell: bash
run: |
API_KEY=${{inputs.API_KEY}} API_URL=${{inputs.API_URL}} hatch run test:integration
API_KEY=${{inputs.API_KEY}} API_URL=${{inputs.API_URL}} make tests-integration
11 changes: 6 additions & 5 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ jobs:
steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.10"

- name: Install prod dependencies
run: |
pip install hatch==v1.14.0
hatch run tools:requirements
pip install -r requirements.txt
uv sync
uv export --no-dev --no-hashes > requirements.txt

- name: Create file with full dependency list
run: |
pip freeze > requirements-full.txt
uv pip freeze > requirements-full.txt

- name: Send license report to Fossa
# This will collect all necessary information (mostly used dependencies) and send it to the Fossa API
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/continuous-deployment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
type: string
description: "The API URL for the test run"

env:
HATCH_VERSION: "v1.14.0" # keep in sync with deploy.yml

jobs:
tests:
name: Tests
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/continuous-deployment-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
type: string
description: "The API URL for the test run"

env:
HATCH_VERSION: "v1.14.0" # keep in sync with deploy.yml

jobs:
tests:
name: Tests
Expand Down
88 changes: 33 additions & 55 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,55 @@ name: CI
on:
pull_request:

env:
HATCH_VERSION: "v1.14.0" # keep in sync with deploy.yml

permissions:
pull-requests: write
contents: write

jobs:
format-black:
name: Format black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run black
run: hatch run code-quality:format


mypy:
name: MyPy
format:
name: Format Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run mypy
run: hatch run code-quality:types
- name: Install Dependencies
run: uv sync --group code-quality
- name: Run ruff format
run: make format

lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run pylint
run: hatch run code-quality:lint
- name: Install Dependencies
run: uv sync --group code-quality
- name: Run ruff check
run: make lint

isort:
name: Sort imports
mypy:
name: Type checking with mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Install dependencies
run: uv sync --group code-quality
- name: Run mypy
run: hatch run code-quality:sort

pydocstyle:
name: Check docstrings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run pydocstyle
run: hatch run code-quality:docstrings
run: make types

scan-for-secrets:
name: Scan for secrets
Expand All @@ -101,13 +77,15 @@ jobs:
with:
# for coverage comment action
fetch-depth: 1000
- uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Install Dependencies
run: uv sync --group test
- name: Run unit tests
run: hatch run test:unit-with-cov
run: make tests-with-cov
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@e623398c19eb3853a5572d4a516e10b15b5cefbc
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
- published
workflow_dispatch:

env:
HATCH_VERSION: "v1.14.0" # keep in sync with deploy.yml

permissions:
id-token: write

Expand All @@ -19,17 +16,17 @@ jobs:
env:
pypi: ${{ vars.PYPI_URL }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Bump version
# Bump version to Github action tag
run: hatch version ${{github.ref_name}}
enable-cache: true
python-version: "3.10"
- name: Bump Version
run: |
sed -i 's/^version = .*/version = "${{github.ref_name}}"/' pyproject.toml
- name: Build
run: hatch build
run: make build
- name: publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
- labeled
workflow_dispatch:

env:
HATCH_VERSION: "v1.14.0" # keep in sync with deploy.yml

jobs:
deploy-test:
if: ${{ github.event.label.name == 'test-deploy' }} || github.event.label.name !='integration'`
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ on:
permissions:
id-token: write

env:
HATCH_VERSION: "v1.14.0" # keep in sync with continuous-integration.yml

jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand All @@ -28,17 +25,17 @@ jobs:
pypi: ${{ vars.PYPI_URL }}

steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Bump version
# Bump version to Github action tag
run: hatch version ${{ inputs.version }}
enable-cache: true
python-version: "3.10"
- name: Bump Version
run: |
sed -i 's/^version = .*/version = "${{ inputs.version }}"/' pyproject.toml
- name: Build
run: hatch build
run: make build
- name: publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/merge-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ on:
API_KEY:
required: true

env:
HATCH_VERSION: "v1.14.0" # keep in sync with deploy.yml

jobs:
# the API_KEYs are stored as a secret in the repository
# we are using the "automated-tests" organization with predefined users and workspaces
Expand All @@ -40,11 +37,11 @@ jobs:
needs: [integration_tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
enable-cache: true
python-version: "3.10"
- name: Build
run: hatch build
run: make build
32 changes: 9 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,18 @@ repos:
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline.
- id: trailing-whitespace # trims trailing whitespace

- repo: https://github.com/PyCQA/autoflake
rev: v2.1.1
- repo: https://github.com/astral-sh/ruff-pre-commit
# Please keep these aligned with the versions defined in the pyproject.toml dependency-groups
rev: v0.8.4
hooks:
- id: autoflake
args:
- "--in-place"
- "--expand-star-imports"
- "--remove-duplicate-keys"
- "--remove-unused-variables"
- "-v"

- repo: https://github.com/psf/black
# Please keep these aligned with the versions defined in the pyproject.toml [tool.hatch.envs.code-quality]
rev: 23.3.0
hooks:
- id: black
# Run the linter (includes isort).
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
# Please keep these aligned with the versions defined in the pyproject.toml [tool.hatch.envs.code-quality]
# Please keep these aligned with the versions defined in the pyproject.toml dependency-groups
rev: "v1.1.1"
hooks:
- id: mypy
Expand All @@ -47,13 +40,6 @@ repos:
# - "types-python-dateutil~=2.8.19"
# - "types-redis~=4.5.1"

- repo: https://github.com/pycqa/isort
# Please keep these aligned with the versions defined in the pyproject.toml [tool.hatch.envs.code-quality]
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/zricethezav/gitleaks
rev: v8.16.1
hooks:
Expand Down
20 changes: 16 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@

### Build from source

Install hatch
Install uv
```bash
pip install uv
```
pip install hatch=="v1.14.0"

Sync dependencies
```bash
# Install all dependencies including dev dependencies
uv sync --all-groups

# Or install specific dependency groups
uv sync --group code-quality
uv sync --group test
```

### Install pre-commit hooks
```
hatch run code-quality:hooks
```bash
make hooks
# or
uv run pre-commit install
```

## CI
Expand Down
Loading
Loading