Giter Site home page Giter Site logo

hostedapi's People

Contributors

tomchristie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hostedapi's Issues

Use lower connection pool defaults โฌ‡๏ธ

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".

Suggest to loosen the dependency on databases

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?

Improve Uvicorn defaults ๐Ÿฆ„

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.

  • --proxy-headers should be automatically deteremined based on FORWARDED_ALLOW_IPS
  • We should automatically determine a number of worker processes based on WEB_CONCURRENCY
  • We should possibly default to using $PORT?
  • Should we default the host to 0.0.0.0? Only in certain environments?

Add test suite

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.

Tidy up database tables

  • Drop redundant data migrations.
  • Drop redundant "election" table.
  • Consistent user and naming of foreign keys.

URL finessing ๐Ÿ”—

  • An empty search= should redirect to a URL without the "search" parameter.
  • Searching should preserve the "order" parameter.
  • Detail pages should preserve "order" and "search" parameters, and breadcrumbs should link back to the original table page.

consider adding serialization middleware

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.

Cleanup mock GitHub app

  • Rename from "mock_github" to "github".
  • We're including more routes than we need to when 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.

Switch to a multi-file layout ๐Ÿ—‚

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.

Use pre-commit

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:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.