Skip to main content

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 mockgun clients 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.2. 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.

When a release is available on your package index, install into the Python environment that runs your application:

python -m pip install sg-python-api

To install from a checkout instead, run:

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 'sg-python-api[async]'

From a checkout, use:

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sg-python-api 0.1.0
File Size Uploaded Provenance Actions
sg_python_api-0.1.0.tar.gz 491.7 kB With provenance Details for sg_python_api-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sg-python-api 0.1.0
File Interpreter ABI Platform Actions
sg_python_api-0.1.0-py3-none-any.whl Python 3 none any Details for sg_python_api-0.1.0-py3-none-any.whl

Total release size: 634.6 kB

Release files / sg_python_api-0.1.0.tar.gz

Download URL sg_python_api-0.1.0.tar.gz
Size 491.7 kB
Tags Source
SHA-256 checksum
How to use checksums
26497d94650f9f74435ba13689981cb0d3adcbecd5da97214a56732dfe9e85b5
BLAKE2b-256 checksum
How to use checksums
b5d9340f44e9b51a4dd0b6c698e5af45de8160f7544e038d3c01fd04b3d05a02
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 12, 2026.

Transparency log

Release files / sg_python_api-0.1.0-py3-none-any.whl

Download URL sg_python_api-0.1.0-py3-none-any.whl
Size 143.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dc6f3c9c6e588f49667e7d702d0806da1da469bc96762616fc00bdf9527d2b4
BLAKE2b-256 checksum
How to use checksums
726382d0c58294ba9fde4d19dce504793ff144181a11cbc7daa97087984bf895
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 12, 2026.

Transparency log

Security for sg-python-api 0.1.0

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.

Select from 2 files

Attestation for sg_python_api-0.1.0.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 12, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page