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.1.tar.gz (53.7 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.1-py3-none-any.whl (70.2 kB view details)

Uploaded Python 3

File details

Details for the file platformics-1.0.1.tar.gz.

File metadata

  • Download URL: platformics-1.0.1.tar.gz
  • Upload date:
  • Size: 53.7 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.1.tar.gz
Algorithm Hash digest
SHA256 ff5592e777c1395d7ac947f09db4f6af6132a3ff98356897537f5d5dcf334bcb
MD5 8420646bfdabdadacda7f980df31a995
BLAKE2b-256 a2786db2fe172df910fbcd01c48ca653f7294f08887cf17bb5e7363afbf25d20

See more details on using hashes here.

Provenance

The following attestation bundles were made for platformics-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: platformics-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 70.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79dba33e6bc88039f9e6a91755288b317065c2077627560bb50341deb4676731
MD5 aa8c27a8cf281b54d013139aa48d8af8
BLAKE2b-256 a2c0537d68173fa8ddcd5a8c8bfeb4b108ecb7330a67d7e367d0f4fbf79441bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for platformics-1.0.1-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