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.3.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.3-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: platformics-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 5fdebe98db5630fb9c13ee38c3461a07b78091059bc9761758fe7928ef532aaf
MD5 905d979f60be9e885902433e02c3f887
BLAKE2b-256 177af7ca9d1467d54fc4c0b42a2b57a35fd0786f5bea58241327c497f9f060b8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: platformics-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 19e1de43507b109e51de7ec6f5249ab516a46e045dd1a572a6040b1d9df9c36a
MD5 510924893bd3f49cbacc73677be8b6fc
BLAKE2b-256 9f5ddc2ea417feb38f2ae2a8d382b12cead07a95542cda928e06c1156c45594f

See more details on using hashes here.

Provenance

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