Relask
A Relay-based web development kit on Flask.
Free software: BSD license
Documentation: https://relask.readthedocs.io.
Features
Fast web development setup with ES6, React and Relay
Batteries included: React Router, Webpack and Babel
Server is powered by Python, Flask and Graphene
JWT integrated, with a working example using Flask-Login
Usage
Install Relask:
pip install git+https://github.com/decentfox/relask
Create a Flask application, for example: http://flask.pocoo.org/docs/quickstart/
Initialize your Flask application with Relask (this requires npm):
FLASK_APP=xxx flask init-relask
Under the root path of your Flask application, create scripts/app.js with something like this:
import React from "react";
import ReactDOM from "react-dom";
import {Route, IndexRoute} from "react-router";
import Relay from "react-relay";
import {Relask, RelayContainer} from "babel-loader!relask";
@RelayContainer
class Hello extends React.Component {
render() {
return (
<div>Hello, {this.props.hello.name}!</div>
);
}
static relay = {
fragments: {
hello: () => Relay.QL`fragment on Hello { name }`
}
};
}
ReactDOM.render((
<Relask>
<Route path="/" component={Hello} queries={{
hello: () => Relay.QL`query { hello }`
}}/>
</Relask>
), document.getElementById('app'));
Initialize the Relask extension with something like this:
import graphene
from flask import Flask
from graphene import relay
from relask import Relask
class Hello(relay.Node):
name = graphene.String()
def resolve_name(self, args, info):
return 'World'
@classmethod
def get_node(cls, id, info):
return Hello(id=id)
class Query(graphene.ObjectType):
node = relay.NodeField()
hello = graphene.Field(Hello)
def resolve_hello(self, args, info):
return Hello.get_node(1, None)
app = Flask(__name__)
relask = Relask(app)
relask.schema.query = Query
See your result with one command - don’t worry about webpack any more:
FLASK_APP=xxx flask run
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2016-06-07)
First release on PyPI.
Metadata
Release files for relask 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| relask-0.1.0.tar.gz | 17.3 kB | Without provenance | Details for relask-0.1.0.tar.gz |
Release files / relask-0.1.0.tar.gz
| Download URL | relask-0.1.0.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2013cfe06dd6d25516f4b3a13ccabf42be5e31663be5892e622ca43b4c91c44c
|
|
BLAKE2b-256 checksum How to use checksums |
4f3b2cb18d0986a53095a50afbca08ec0199873fca6b55399f72c982ac7b4431
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for relask 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.