sg-python-api
sg-python-api is a Python client for Autodesk Flow Production Tracking, written for pipeline tools
and scripts built on Autodesk's shotgun_api3 client. It keeps the same import name and documented
API, so an existing integration can switch without rewriting its calls and gain shared connections,
bounded network waits, and retries that do not repeat an ambiguous write. It also adds a native
asynchronous client.
This documentation uses SG for Flow Production Tracking, formerly named Shotgun and ShotGrid.
Why use it?
- Reuse connections: share one synchronous client across threads, or one async client across tasks on the same event loop.
- Bound network waits: default connect and read timeouts help applications recover from an unavailable service.
- Handle writes carefully: retries account for whether an operation is safe to repeat. An ambiguous write is left for the application to reconcile.
- Test without a site: synchronous and asynchronous
mockgunclients provide an in-memory API for application tests.
sg-python-api is an independent implementation of the documented API of Autodesk's Python client
3.10.3. Some behavior differs on purpose, so validate your application's workflows against a test
site before replacing its production client. The migration guide walks
through the switch, and the compatibility reference lists the differences.
Installation
You need Python 3.11 or newer and an SG site running server version 7.10.0 or newer. Authenticated requests to a remote site require HTTPS.
sg-python-api and Autodesk's shotgun-api3 both install the shotgun_api3 package, so install
exactly one of them in a Python environment. If the official client is already installed, follow
the migration steps to replace it.
From a checkout, install into the Python environment that runs your application:
python -m pip install .
The base installation provides the synchronous Shotgun client and both mockgun test clients. To
use the native asynchronous client, AsyncShotgun, install the async extra, which adds the
httpx2 HTTP library:
python -m pip install '.[async]'
Quick start
These examples read one project from your site. They take the site URL and script credentials from
environment variables so the API key stays out of source code; the client does not read these
variables itself. Set SHOTGUN_URL to your site's HTTPS URL, and set SHOTGUN_SCRIPT_NAME and
SHOTGUN_API_KEY to a script account that can read projects.
Synchronous client
import os
from shotgun_api3 import Shotgun
sg = Shotgun(
os.environ['SHOTGUN_URL'],
script_name=os.environ['SHOTGUN_SCRIPT_NAME'],
api_key=os.environ['SHOTGUN_API_KEY'],
)
try:
project = sg.find_one('Project', [], ['name'])
print(project)
finally:
sg.close()
The script prints a project dictionary containing type, id, and name, or None when no
project is visible to that account. You can share one Shotgun client across threads; close()
releases its pooled connections when you no longer need it.
Asynchronous client
With the async extra installed and the same environment variables set, run:
import asyncio
import os
from shotgun_api3 import AsyncShotgun
async def main() -> None:
async with AsyncShotgun(
os.environ['SHOTGUN_URL'],
script_name=os.environ['SHOTGUN_SCRIPT_NAME'],
api_key=os.environ['SHOTGUN_API_KEY'],
) as sg:
project = await sg.find_one('Project', [], ['name'])
print(project)
asyncio.run(main())
The output matches the synchronous example. The async with block closes the client even when an
operation fails. Without the async extra, importing AsyncShotgun raises ImportError.
Share an AsyncShotgun only among tasks on one event loop, and cancel its work by cancelling the
task. A cancelled write may already have reached the server, so check its outcome before repeating
it. The async reference covers shutdown and
cancellation in detail.
Documentation
| If you want to... | Read |
|---|---|
| Replace Autodesk's client in an existing application | Migration guide |
| Check what behaves differently from Autodesk's client | Compatibility |
| Tune pooling and page prefetch, or observe requests | Configuration extensions |
| Confirm which client loads and run a smoke test | Testing an installation |
| Compare measured latency and transfer memory | Benchmarks |
| See changes by version | Changelog |
Development
See the development guide for the required tools, CI, and dependency locks. With those tools installed, run:
make setup
make check
make check also runs the live-site tests, which create and delete records, whenever the
SG_TEST_* variables described in the development guide are set.
License
sg-python-api is available under the MIT License. It is an independent project and is not affiliated with or endorsed by Autodesk. Flow Production Tracking is a product of Autodesk, Inc.
Metadata
Release files for sg-python-api 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sg_python_api-0.1.2.tar.gz | 500.6 kB | With provenance | Details for sg_python_api-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sg_python_api-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for sg_python_api-0.1.2-py3-none-any.whl |
Total release size: 644.2 kB
Release files / sg_python_api-0.1.2.tar.gz
| Download URL | sg_python_api-0.1.2.tar.gz |
|---|---|
| Size | 500.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41b9e429d818285548bd860bc3205475b24dbc492e44fc7c10650a6cb031b2f6
|
|
BLAKE2b-256 checksum How to use checksums |
0bb93109c85353b3f583c820b009c85690d3db483e8378b35df1e6b0a4b25ca2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / sg_python_api-0.1.2-py3-none-any.whl
| Download URL | sg_python_api-0.1.2-py3-none-any.whl |
|---|---|
| Size | 143.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b19a8a999f3b12725059609d2dbc1ab1ab6a86832878fbd4d2c447b30a5d22c
|
|
BLAKE2b-256 checksum How to use checksums |
ec530f5ccbee276d3201631816bdd9cc5274cdb9cb5e417e542ff2f03d039d1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logSecurity for sg-python-api 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sg_python_api-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.