Skip to main content

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:

image

Links to these tools/libraries

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

  1. Copy the test_app boilerplate code to your own repository.
  2. Edit schema/schema.yml to reflect your application's data model.
  3. Run make build and then make init to build and run your own GraphQL API service.
  4. Browse to http://localhost:9009/graphql to interact with your api!
  5. Run make token to generate an authorization token that you can use to interact with the API. The make target copies the necessary headers to the system clipboard. Paste the token into the headers section 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

  1. Make changes to schema/schema.yml
  2. Run make codegen to re-run code gen and restart the API service
  3. If your changes require DB schema changes, run make alembic-autogenerate and make alembic-upgrade-head to generate DB migrations and run them.

HOWTO

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

platformics-1.0.2.tar.gz (52.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

platformics-1.0.2-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

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

Hashes for platformics-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4fcd8333c5752202f1fd6246f785eab5fbe7af762b87523c0557c59a1aa82eac
MD5 fc377363c3969c850db1699af6c5d7d8
BLAKE2b-256 7df6b21618dd39f372295d40604592ed5c6b1f431f97b586c2dd96dea0eaed9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for platformics-1.0.2.tar.gz:

Publisher: build-and-push.yml on chanzuckerberg/platformics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for platformics-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51693a9c103c628ae02f97e8ae675a87e9c0c58b6b26ec2201d9852fa5187d46
MD5 30d12fd952f7bbcddb77f32847b1a74e
BLAKE2b-256 7ca3c9423c0c1877845051a53eee5d1a25ea7e4be120174ac4122f087026e165

See more details on using hashes here.

Provenance

The following attestation bundles were made for platformics-1.0.2-py3-none-any.whl:

Publisher: build-and-push.yml on chanzuckerberg/platformics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page