fpt-api
A thread-safe wrapper around Flow Production Tracking (formerly ShotGrid) that extends shotgun_api3 to support query field retrieval and parallel processing.
It also supports the retrieval of all Entities of a given Page, applying the Page filters.
Features
- 🔍 Retrieves query fields (not supported in base
shotgun_api3) - 📄 Retrieves all Entities of a given Page, applying the Page filters
- 🧵 Thread-safe operations (not supported in base
shotgun_api3) - ⚡ Parallel processing for improved performance
- 🔄 Streaming results for processing large datasets
- 🔌 Drop-in replacement for basic shotgun_api3 operations
- • Supports dotted query fields, e.g.
entity.Shot.sg_assets_count
Installation
From PyPI:
pip install fpt-api
pip install git+https://github.com/shotgunsoftware/python-api.git
From source:
pip install git+https://github.com/ksallee/fpt-api.git
pip install git+https://github.com/shotgunsoftware/python-api.git
Why This Wrapper?
The standard shotgun_api3 library has two main limitations:
- No support for query field retrieval, which is essential for reporting and analytics
- Not thread-safe, which can cause issues in multi-threaded applications
This wrapper addresses both issues by:
- Implementing query field retrieval
- Adding thread safety
- Parallelizing query field retrieval for better performance
- Supporting streaming for large result sets
Usage
Basic Usage
from fpt_api import FPT
# Initialize the client
fpt = FPT(
"https://yourshotgunurl.com",
script_name="your_script_name",
api_key="your_script_key"
)
# Find a single shot
shot = fpt.find_one(
"Shot",
[["id", "is", 1234]],
["code", "sg_status_list", "sg_query_field"]
)
# Find multiple shots (returns all results at once)
shots = fpt.find(
"Shot",
[["id", "in", [1234, 12345]]],
["code", "sg_status_list", "sg_query_field"]
)
# Stream results one by one
for shot in fpt.yield_find(
"Shot",
[["id", "in", [1234, 12345]]],
["code", "sg_status_list", "sg_query_field"]
):
process_shot(shot) # Process each shot as it becomes ready
# Get the value of a dotted query field
version = fpt.find_one(
"Version",
[["id", "is", 1234]],
["entity.Shot.sg_assets_count"]
)
# Get all Entities of a given Page, applying the Page filters
for shot in fpt.yield_page_entities(5105):
print(shot)
API Reference
Check out the Official Shotgun API Reference for more information on the base shotgun_api3 library.
FPT does not change the base API, but rather extends it with additional functionality.
Yield all Entities of a given Page, applying the Page filters:
def yield_page_entities(
self,
page_id: int,
additional_filters: Optional[List] = None,
fields: Optional[List[str]] = None,
) -> Iterator[Entity]:
"""
Yield entities from a Page, applying the Page filters.
:param page_id: ID of the Page to process
:param additional_filters: Additional filters to apply
:param fields: Fields to retrieve
:yields: Entities found
"""
Performance Notes
- Query fields are retrieved in parallel using threads
- For standard find(), results are returned after all query fields are retrieved
- yield_find() streams results as they become available
- Connection pooling reduces overhead for multiple requests
Contributing
Contributions are welcome! Please feel free to submit pull requests.
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Metadata
Release files for fpt-api 0.3.5
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 |
|---|---|---|---|---|
| fpt_api-0.3.5.tar.gz | 24.3 kB | Without provenance | Details for fpt_api-0.3.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fpt_api-0.3.5-py3-none-any.whl | Python 3 | none | any | Details for fpt_api-0.3.5-py3-none-any.whl |
Total release size: 47.4 kB
Release files / fpt_api-0.3.5.tar.gz
| Download URL | fpt_api-0.3.5.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adf1b761390eba5d942c996f0d4862a0a482dcf6f8f574b4a45a2d1ed053d9c9
|
|
BLAKE2b-256 checksum How to use checksums |
b3b3254c4192430826f719819643c5d6a4d2f1263845cd6217d7b8ea0c81feec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / fpt_api-0.3.5-py3-none-any.whl
| Download URL | fpt_api-0.3.5-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ec43df1b304194ae33b3b728de73cfbc0f2bad26dd806a1dea0ed298b15a0f6
|
|
BLAKE2b-256 checksum How to use checksums |
fe368b7a651717460e8cd6793eef3503d03adae3ffe51446fb943617b3dc7d3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Security for fpt-api 0.3.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.