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
31 changes: 31 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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
name: Publish PyPI
on:
workflow_dispatch:

release:
types: [published]

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

steps:
- uses: actions/checkout@v4

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Publish to PyPI
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.MODERATION_API_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'moderation-api/sdk-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
PYPI_TOKEN: ${{ secrets.MODERATION_API_PYPI_TOKEN || secrets.PYPI_TOKEN }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.0.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-b71e4bef3bf1d91ff75dc3414d212613e5be0efb29b773ff12363814491fc604.yml
openapi_spec_hash: 261c3af6614314fbdd6ea3f7fb61979a
config_hash: 3e15855f4c5098c08626c2728c6cbd88
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-3eaa6a0657e9f67ea196c65d3b604c71f5406108983981ec696642563fda0a93.yml
openapi_spec_hash: c417a44bb9fa62a02eca68bbb307c712
config_hash: 6d4d59b89f68ea23dddfdefeee29c973
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

## 1.0.0 (2025-12-06)

Full Changelog: [v0.0.1...v1.0.0](https://github.com/moderation-api/sdk-python/compare/v0.0.1...v1.0.0)

### Features

* **api:** api update ([bc91d96](https://github.com/moderation-api/sdk-python/commit/bc91d96e25700bf7c01fa62b7f22fa11880313dc))
* **api:** api update ([a9968a7](https://github.com/moderation-api/sdk-python/commit/a9968a7a8e5ff58d2fd87633b4afff658523cf5a))
* **api:** api update ([4823b5e](https://github.com/moderation-api/sdk-python/commit/4823b5e2fbd811e2f4eb08e3181d4674d03a59b3))
* **api:** api update ([ad12a65](https://github.com/moderation-api/sdk-python/commit/ad12a65a09be5b7eaf14f770c1c4edb321db6640))
* **api:** manual updates ([50ee715](https://github.com/moderation-api/sdk-python/commit/50ee7151e5ae1e22a2d8017e3f32a7816145a1ac))
* **api:** manual updates ([c8e371a](https://github.com/moderation-api/sdk-python/commit/c8e371ae1be439008fbfb10cfe65d7798aef5eb6))
* **api:** manual updates ([f017cbc](https://github.com/moderation-api/sdk-python/commit/f017cbcec45065e9e6a2f2bfa66cd1e5fa22b851))
* **api:** manual updates ([c49725c](https://github.com/moderation-api/sdk-python/commit/c49725cb034edec7411733f2f63a688940573cac))
* **api:** manual updates ([fa2efc8](https://github.com/moderation-api/sdk-python/commit/fa2efc8b09c8da26be5ec99c97f6ed11bdfc727b))
* **api:** manual updates ([2957153](https://github.com/moderation-api/sdk-python/commit/29571536bb27811f9bd573829884bc36beb8a61b))
* **api:** manual updates ([3ad868f](https://github.com/moderation-api/sdk-python/commit/3ad868f45c737db62e7486299e07027b608047d1))
* **api:** manual updates ([75eae97](https://github.com/moderation-api/sdk-python/commit/75eae9712e59c4a7e8554f83f3ec2a4a55b10e46))
* **api:** manual updates ([2ea195a](https://github.com/moderation-api/sdk-python/commit/2ea195a89e76808ba1957802a6394ea4bf20b039))
* **api:** removed deprecated moderate endpoints ([6c5dd93](https://github.com/moderation-api/sdk-python/commit/6c5dd93fbe80619e6e4b270dfd4624b713ba9c15))


### Bug Fixes

* ensure streams are always closed ([b4d4449](https://github.com/moderation-api/sdk-python/commit/b4d44494343f4925353071967649a414c05ae369))


### Chores

* configure new SDK language ([74c5185](https://github.com/moderation-api/sdk-python/commit/74c5185ae751945b7b24839e406f7c371c8d0b34))
* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([bbf694f](https://github.com/moderation-api/sdk-python/commit/bbf694f626644c1349960516a152a46bd8af1489))
* **docs:** use environment variables for authentication in code snippets ([166f1cf](https://github.com/moderation-api/sdk-python/commit/166f1cf82be98f8fe92607b3983144af07788da9))
* update lockfile ([ba4d9b9](https://github.com/moderation-api/sdk-python/commit/ba4d9b97fdc0d4a6a34058edc9d0b8dde4c8d5ba))
* update SDK settings ([60af1e1](https://github.com/moderation-api/sdk-python/commit/60af1e123350c2cbacd9f05320048539d28b2cc4))
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```sh
$ pip install git+ssh://git@github.com/stainless-sdks/moderation-api-python.git
$ pip install git+ssh://git@github.com/moderation-api/sdk-python.git
```

Alternatively, you can build from source and install the wheel file:
Expand Down Expand Up @@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/moderation-api-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/moderation-api/sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The REST API documentation can be found on [docs.moderationapi.com](https://docs
## Installation

```sh
# install from this staging repo
pip install git+ssh://git@github.com/stainless-sdks/moderation-api-python.git
# install from the production repo
pip install git+ssh://git@github.com/moderation-api/sdk-python.git
```

> [!NOTE]
Expand Down Expand Up @@ -85,8 +85,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
You can enable this by installing `aiohttp`:

```sh
# install from this staging repo
pip install 'moderation_api[aiohttp] @ git+ssh://git@github.com/stainless-sdks/moderation-api-python.git'
# install from the production repo
pip install 'moderation_api[aiohttp] @ git+ssh://git@github.com/moderation-api/sdk-python.git'
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
Expand Down Expand Up @@ -290,9 +290,9 @@ content = response.parse() # get the object that `content.submit()` would have
print(content.recommendation)
```

These methods return an [`APIResponse`](https://github.com/stainless-sdks/moderation-api-python/tree/main/src/moderation_api/_response.py) object.
These methods return an [`APIResponse`](https://github.com/moderation-api/sdk-python/tree/main/src/moderation_api/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/moderation-api-python/tree/main/src/moderation_api/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
The async client returns an [`AsyncAPIResponse`](https://github.com/moderation-api/sdk-python/tree/main/src/moderation_api/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.

#### `.with_streaming_response`

Expand Down Expand Up @@ -401,7 +401,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/moderation-api-python/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/moderation-api/sdk-python/issues) with questions, bugs, or suggestions.

### Determining the installed version

Expand Down
21 changes: 21 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

errors=()

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi

echo "The environment is ready to push releases!"
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "moderation_api"
version = "0.0.1"
version = "1.0.0"
description = "The official Python library for the moderation-api API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -37,8 +37,8 @@ classifiers = [
]

[project.urls]
Homepage = "https://github.com/stainless-sdks/moderation-api-python"
Repository = "https://github.com/stainless-sdks/moderation-api-python"
Homepage = "https://github.com/moderation-api/sdk-python"
Repository = "https://github.com/moderation-api/sdk-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
Expand Down Expand Up @@ -126,7 +126,7 @@ path = "README.md"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
# replace relative links with absolute links
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
replacement = '[\1](https://github.com/stainless-sdks/moderation-api-python/tree/main/\g<2>)'
replacement = '[\1](https://github.com/moderation-api/sdk-python/tree/main/\g<2>)'

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down
66 changes: 66 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "python",
"extra-files": [
"src/moderation_api/_version.py"
]
}
2 changes: 1 addition & 1 deletion src/moderation_api/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "moderation_api"
__version__ = "0.0.1"
__version__ = "1.0.0" # x-release-please-version
8 changes: 4 additions & 4 deletions src/moderation_api/resources/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def with_raw_response(self) -> AccountResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
"""
return AccountResourceWithRawResponse(self)

Expand All @@ -35,7 +35,7 @@ def with_streaming_response(self) -> AccountResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
"""
return AccountResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -66,7 +66,7 @@ def with_raw_response(self) -> AsyncAccountResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
"""
return AsyncAccountResourceWithRawResponse(self)

Expand All @@ -75,7 +75,7 @@ def with_streaming_response(self) -> AsyncAccountResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
"""
return AsyncAccountResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/moderation_api/resources/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def with_raw_response(self) -> ActionsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
"""
return ActionsResourceWithRawResponse(self)

Expand All @@ -56,7 +56,7 @@ def with_streaming_response(self) -> ActionsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
"""
return ActionsResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -384,7 +384,7 @@ def with_raw_response(self) -> AsyncActionsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
"""
return AsyncActionsResourceWithRawResponse(self)

Expand All @@ -393,7 +393,7 @@ def with_streaming_response(self) -> AsyncActionsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
"""
return AsyncActionsResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/moderation_api/resources/actions/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def with_raw_response(self) -> ExecuteResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
"""
return ExecuteResourceWithRawResponse(self)

Expand All @@ -40,7 +40,7 @@ def with_streaming_response(self) -> ExecuteResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
"""
return ExecuteResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -168,7 +168,7 @@ def with_raw_response(self) -> AsyncExecuteResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers
"""
return AsyncExecuteResourceWithRawResponse(self)

Expand All @@ -177,7 +177,7 @@ def with_streaming_response(self) -> AsyncExecuteResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response
For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response
"""
return AsyncExecuteResourceWithStreamingResponse(self)

Expand Down
Loading