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
  •  
  •  
  •  
8 changes: 0 additions & 8 deletions .devcontainer/Dockerfile

This file was deleted.

43 changes: 0 additions & 43 deletions .devcontainer/devcontainer.json

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This allows generated code to be indexed correctly
*.py linguist-generated=false
100 changes: 15 additions & 85 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,25 @@
# Maintained in moderation-api/sdk-generator (custom/python). Edits here are overwritten.
name: CI
on:
push:
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
branches: [main]
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.10.2'

- name: Install dependencies
run: uv sync --all-extras

- name: Run lints
run: ./scripts/lint
permissions:
contents: read

jobs:
build:
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.10.2'

- name: Install dependencies
run: uv sync --all-extras

- name: Run build
run: uv build

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/moderation-api-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: |-
github.repository == 'stainless-sdks/moderation-api-python' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh

test:
timeout-minutes: 10
name: test
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.10.2'

- name: Bootstrap
run: ./scripts/bootstrap

- name: Run tests
run: ./scripts/test
version: "0.9.13"
- run: uv sync --group dev
- run: uv run pylint --rcfile=pylintrc src
- run: uv run mypy src
- run: uv run pyright src
- run: uv build
- name: Import the package
run: uv run python -c "from moderation_api import ModerationAPI; from moderation_api.webhook_signature import construct_event"
29 changes: 15 additions & 14 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/moderation-api/sdk-python/actions/workflows/publish-pypi.yml
# Maintained in moderation-api/sdk-generator (custom/python). Edits here are overwritten.
name: Publish PyPI
on:
workflow_dispatch:

release:
types: [published]
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
with:
version: '0.9.13'

- name: Publish to PyPI
version: "0.9.13"
- name: Check the release tag matches pyproject.toml
if: github.event_name == 'release'
run: |
bash ./bin/publish-pypi
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' pyproject.toml | head -1)
if [ "${GITHUB_REF_NAME#v}" != "$version" ]; then
echo "::error::Release tag $GITHUB_REF_NAME does not match pyproject.toml version $version"
exit 1
fi
- run: bash scripts/publish.sh
env:
PYPI_TOKEN: ${{ secrets.MODERATION_API_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21 changes: 0 additions & 21 deletions .github/workflows/release-doctor.yml

This file was deleted.

27 changes: 12 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
.prism.log
.stdy.log
_dev

__pycache__
.mypy_cache

dist

.venv
.idea

.venv/
venv/
src/*.egg-info/
**/__pycache__/
.pytest_cache/
.python-version
.DS_Store
pyrightconfig.json
**/.speakeasy/temp/
**/.speakeasy/logs/
.speakeasy/reports
.env
.envrc
codegen.log
Brewfile.lock.json
.env.local
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

3 changes: 0 additions & 3 deletions .release-please-manifest.json

This file was deleted.

Loading
Loading