Skip to main content

No project description provided

Project description

# Polecat

A lean, powerful, and enjoyable web framework.

## Warning

This is very alpha software. It is not yet fully functional and will certainly eat your cat.

## Discussion

Django has always been one of my favorite web frameworks. The Django community have absolutely hit the nail on the head for developer experience. Python is fantastic to work with, and Django’s documentation is second to none. However, constructing high-performance APIs can be a little tricky. There are plenty of excellent libraries to leverage (Django Rest Framework, Graphene), but there are also traps. The n + 1 problem for example: one needs to be sure to properly prefetch required data or performance will rapidly degrade. I’ve always found this to be a frustrating experience, GraphQL provides an interface to freely select nested relationships, yet I need to curate each database query to ensure it’s formulated correctly, making the freedom provided by GraphQL moot.

Enter Postgraphile, a fantastic NodeJS library to automatically create GraphQL APIs from a PostgreSQL database schema. Producing a typed, n + 1-safe, API “free of charge” can be amazingly useful, especially for all those typical CRUD operations needed. But no auto-generated API is without the need for customisation. There are always unique mutations and edge-cases. Postgraphile provides a number plugins which ease the pain of extensions, but the developer experience begins to suffer: there is no ORM available out of the box to assist in performing database operations, and the documentation surrounding the schema builder is a little scarce. Postgraphile encourages development of customised queries using PostgreSQL’s internal scripting language(s). This works very well so long as you’re able to write your scripts without error. Debugging PostgreSQL functions can be a trying experience, with unhelpful error messages and very limited ability for stepping through your code. Again, developer experience suffers.

Polecat is inspired by both Django and Postgraphile. It borrows the automatic creation of APIs from Postgraphile, and attempts to wrap it in the same kind of convenience as Django. Polecat attempts to be “batteries included”, you should be able to use Polecat to build a highly-performant, scalable API server, deployed to popular cloud services, all the while enjoying a pleasant developer experience.

## Features

  • Built-in high-performance ORM.

  • No n + 1 query issues.

  • Automatically produces JSON-API specification and GraphQL APIs.

  • Includes (limited) database migrations.

  • Testing facilities, including automatic model factories.

## Installation

Polecat comes as a PyPi package, and as such the easiest way to install it is with pip:

` bash pip install polecat[cli] `

The extras keyword cli indicates that the command line interface and its dependencies should be installed. For production deployments those dependencies are omitted.

## Getting Started

Getting started with Polecat is designed to be a trivial excercise. Once installed, the polecat command should now be accessible from your command line:

` bash polecat --help `

Everything you’ll need is available using the Polecat command. Let’s start by generating a basic “hello world” project.

` bash polecat example helloworld `

The above command will create a helloworld folder in your current directory, populated with a minimal project. Within, you’ll find just two files:

  • models.py - the data/API definition.

  • project.py - the entrypoint for your project.

  • bundle.js - the client side application.

To see your project working, from within the helloworld directory run:

` bash polecat server `

A local development server will be launched, navigate to http://localhost:8000 to see your new hello world project.

## Documentation

Coming soon (slowly).

## Contributing

As with Django, Polecat is intended to be a free, community driven, framework.

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

polecat-0.0.6.tar.gz (47.7 kB view details)

Uploaded Source

File details

Details for the file polecat-0.0.6.tar.gz.

File metadata

  • Download URL: polecat-0.0.6.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for polecat-0.0.6.tar.gz
Algorithm Hash digest
SHA256 68ceaf2611bef055650cbf703599fe9648fb35c35d3590b12e59876433dce381
MD5 6ef2d5b05e905a99db96378c9c2d37f0
BLAKE2b-256 2397b9eada66f3c69bd0c2b3345d38ab2a5f72010d9e2d2f9bcc90ef03664492

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