Codegen Python GraphQL Entity Framework
Project description
Platformics
Platformics is a GraphQL API framework that relies on code generation to implement a full featured GraphQL API on top of a PostgreSQL database, with support for authorization policy enforcement and file persistence via S3. It's built on top of the best available Python tools and frameworks!
The libraries and tools that make Platformics work:
Links to these tools/libraries
- LinkML - Schema modeling language
- FastAPI - Async HTTP router
- Strawberry - GraphQL Framework
- Pydantic - Data validation
- Cerbos - Authorization
- SQLAlchemy - Database Access / ORM
- factory_boy - Test fixtures
- Alembic - Database migrations
Current Features
- Express your schema in a straightforward YAML format
- GraphQL Dataloader pattern (no n+1 queries!)
- Authorization policy enforcement
- Flexible Filtering
- Data aggregation
- Top-level pagination
- Relationship traversal
- DB migrations
- Generated Test fixtures
- pytest wiring
- VSCode debugger integration
- Add custom REST endpoints to generated API
- Add custom GQL queries/mutations to generated API
- Support arbitrary class inheritance hierarchies (1-level deep)
- Package and publish to PyPI
Roadmap
- Plugin hooks to add business logic to generated GQL resolvers
How to set up your own platformics API
- Copy the test_app boilerplate code to your own repository.
- Edit
schema/schema.ymlto reflect your application's data model. - Run
make buildand thenmake initto build and run your own GraphQL API service. - Browse to http://localhost:9009/graphql to interact with your api!
- Run
make tokento generate an authorization token that you can use to interact with the API. Themaketarget copies the necessary headers to the system clipboard. Paste the token into theheaderssection at the bottom of the GraphQL explorer API
Versioning platformics
Platformics can be used in downstream applications by either
- using the platformics image as the base Docker image. To select a version of platformics, add the appropriate version tags to the docker image
- installing as a python dependency,
pip install platformics.
The version in pyproject.toml is managed using poetry-dynamic-versioning which determines version based on git tags.
Iterating on your schema
- Make changes to
schema/schema.yml - Run
make codegento re-run code gen and restart the API service - If your changes require DB schema changes, run
make alembic-autogenerateandmake alembic-upgrade-headto generate DB migrations and run them.
HOWTO
- Work with platformics
- Extend the generated API
- Customize Codegen templates
- Override Default Authorization Behaviors
Contributing
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to opensource@chanzuckerberg.com.
Reporting Security Issues
Please disclose security issues responsibly by contacting security@chanzuckerberg.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file platformics-1.0.2.tar.gz.
File metadata
- Download URL: platformics-1.0.2.tar.gz
- Upload date:
- Size: 52.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fcd8333c5752202f1fd6246f785eab5fbe7af762b87523c0557c59a1aa82eac
|
|
| MD5 |
fc377363c3969c850db1699af6c5d7d8
|
|
| BLAKE2b-256 |
7df6b21618dd39f372295d40604592ed5c6b1f431f97b586c2dd96dea0eaed9b
|
Provenance
The following attestation bundles were made for platformics-1.0.2.tar.gz:
Publisher:
build-and-push.yml on chanzuckerberg/platformics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
platformics-1.0.2.tar.gz -
Subject digest:
4fcd8333c5752202f1fd6246f785eab5fbe7af762b87523c0557c59a1aa82eac - Sigstore transparency entry: 191094496
- Sigstore integration time:
-
Permalink:
chanzuckerberg/platformics@c54a8da9612415588b56b81627fd49a2b93ee469 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/chanzuckerberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-push.yml@c54a8da9612415588b56b81627fd49a2b93ee469 -
Trigger Event:
release
-
Statement type:
File details
Details for the file platformics-1.0.2-py3-none-any.whl.
File metadata
- Download URL: platformics-1.0.2-py3-none-any.whl
- Upload date:
- Size: 66.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51693a9c103c628ae02f97e8ae675a87e9c0c58b6b26ec2201d9852fa5187d46
|
|
| MD5 |
30d12fd952f7bbcddb77f32847b1a74e
|
|
| BLAKE2b-256 |
7ca3c9423c0c1877845051a53eee5d1a25ea7e4be120174ac4122f087026e165
|
Provenance
The following attestation bundles were made for platformics-1.0.2-py3-none-any.whl:
Publisher:
build-and-push.yml on chanzuckerberg/platformics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
platformics-1.0.2-py3-none-any.whl -
Subject digest:
51693a9c103c628ae02f97e8ae675a87e9c0c58b6b26ec2201d9852fa5187d46 - Sigstore transparency entry: 191094499
- Sigstore integration time:
-
Permalink:
chanzuckerberg/platformics@c54a8da9612415588b56b81627fd49a2b93ee469 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/chanzuckerberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-push.yml@c54a8da9612415588b56b81627fd49a2b93ee469 -
Trigger Event:
release
-
Statement type: