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
  • Authorized S3 file up/downloads
  • Add custom REST endpoints to generated API
  • Add custom GQL queries/mutations to generated API

Roadmap

  • Plugin hooks to add business logic to generated GQL resolvers
  • Support arbitrary class inheritance hierarchies
  • Package and publish to PyPI

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

Right now, platformics is used in downstream applications by using the platformics image as the base Docker image. To select a version of platformics, add the appropriate version tags to the docker image. 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-0.1.1.tar.gz (59.0 kB view details)

Uploaded Source

Built Distribution

platformics-0.1.1-py3-none-any.whl (78.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: platformics-0.1.1.tar.gz
  • Upload date:
  • Size: 59.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for platformics-0.1.1.tar.gz
Algorithm Hash digest
SHA256 316c3330e5b1a609790d78043b2d94cbe566ab6e758bd0000df405901e6e04d4
MD5 83409ae45e6b6f051d0149893fb44665
BLAKE2b-256 7d91ca5eaead5c3619a28b255ae08c5b766985b021ea96b0bd1053e16aba2df4

See more details on using hashes here.

File details

Details for the file platformics-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: platformics-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 78.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for platformics-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 399a5f64df00df366d4469fb80fc86fc225f4457a5b81d25ebd98e2dc724e68a
MD5 a5422bb0533e53b05cddf0492fb44305
BLAKE2b-256 3e37c935aa48fc4925533dd1449a2cdce7c0f9280e0f2ae6ac952c3ac663eac9

See more details on using hashes here.

Supported by

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