encode / hostedapi Goto Github PK
View Code? Open in Web Editor NEWBuilding out an example Starlette service ๐
Home Page: https://hostedapi.herokuapp.com/
Building out an example Starlette service ๐
Home Page: https://hostedapi.herokuapp.com/
For more conventional JSON keys.
At the moment we have "Party Identifier" mapping to "party-identifier"
.
We'd ought to change this to "party_identifier"
.
๐ค Should be enforced by our CI.
Right now we're using the default settings for the connection pool with asyncpg
.
This ends up being 10 connections per worker process.
We're running 2 worker processes, so holding onto 20 database connections.
This just happens to also be the maximum number of allowed postgres connection against a Hobby-tier database, so when we run migrations we're now getting a failure with "Too many connections".
Because replicable build environments, please.
We should push the main table/column/row endpoints into their own app folder.
Empty search results should not display column headers, and should include a placeholder message.
Let's have the footer of the application include:
Spun out from #8
We'd like to start using httpx
for the test client.
Related issue in Starlette itself is encode/starlette#652
Currently we'd be blocked here by lack of support for the response.template
interface.
Hi, your project hostedapi(commit id: af5944b) requires "databases==0.2.6" in its dependency. After analyzing the source code, we found that the following versions of databases can also be suitable, i.e., databases 0.2.3, 0.2.4, 0.2.5, 0.3.0, since all functions that you directly (1 APIs: databases.core.Database.init) or indirectly (propagate to 6 databases's internal APIs and 4 outsider APIs) used from the package have not been changed in these versions, thus not affecting your usage.
Therefore, we believe that it is quite safe to loose your dependency on databases from "databases==0.2.6" to "databases>=0.2.3,<=0.3.0". This will improve the applicability of hostedapi and reduce the possibility of any further dependency conflict with other projects.
May I pull a request to further loosen the dependency on databases?
By the way, could you please tell us whether such an automatic tool for dependency analysis may be potentially helpful for maintaining dependencies easier during your development?
Starting point for this - local development should usually be DEBUG=True
, production should not.
Some learnings for possible improvements to uvicorn
based on deploying to Heroku.
Our Procfile needed to include a few bits that aren't neccessary with Gunicorn.
FORWARDED_ALLOW_IPS
WEB_CONCURRENCY
$PORT
?Our CI tests are currently only hooked into a stub.
We should switch that around so that we're running against a real test suite.
Setup the Sentry ASGI middleware for resolving issues in production
search=
should redirect to a URL without the "search" parameter."order"
parameter.hi,
This is very important for production usecases especially around performance or migrating apis (from Flask for e.g.) that service mobile apps that are already in the wild
gzipped json or msgpack responses - (similar issue on fastapi side tiangolo/fastapi#521 or https://fastapi.tiangolo.com/tutorial/custom-request-and-route/#create-a-custom-gziprequest-class) .
the api should respond to mimetype requests for serialization. It makes a significant difference in high traffic and large data transfer usecases.
The default behavior doesnt change - however the api should be able to honor requests (either GET or POST) that ask for a certain mimetype (e.g. application/msgpack
). I'm not sure if chunked responses need a certain way to do it ...or if it is even possible without a change to starlette.
Let's have the application hosted at a real URL, not simply "http://hostedapi.herokuapp.com/"
MOCK_GITHUB=True
- only the user auth page needs displaying to the user. The other routes are for our mock client to issue requests against.Right now we've got a single file app.py
.
Really we'll want to switch to a multi-file layout.
Probably put all the source code under a source
or src
directory.
Always good to start off with this constraint in the first place.
First, love this example. It has helped understand some parts of Starlette.
I would suggest using pre-commit to maintain code quality standards such as black. For example below is what I have in my own .pre-commit-config.yaml. This would eliminate the need to run a script for black or other code standard enforcement.
Black is run (config is in a setup.cfg), fix-encoding-pragma adds "# -- coding: utf-8 -- to the top of python files", trailing-whitespace "This hook trims trailing whitespace", and python-safety-dependencies-check to check for security vulnerabilities.
repos:
repo: https://github.com/ambv/black
rev: 19.10b0
hooks:
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.1.0
hooks:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.