Code Monkey home page Code Monkey logo

itty3's Introduction

itty3

The itty-bitty Python web framework... Now Rewritten For Python 3!

If you're on Python 2, you're looking for itty for Python 2 instead...

Quick Start

import itty3

# Make an app (mostly just for routing & niceties).
app = itty3.App()

# Register your views with the app.
@app.get("/")
def index(request):
    return app.render(request, "Hello, world!")

if __name__ == "__main__":
    # Run a simple WSGI server!
    app.run()

Why?

itty3 is a micro-framework for serving web traffic. At its 1.0.0 release, itty3 weighed in at less than ~1k lines of code.

Granted, it builds on the shoulders of giants, using big chunks of the Python standard library. But it has no other external dependencies!

Reasons for itty3:

  • Extremely lightweight
  • Fast to start working with
  • Easy to produce initial/toy services
  • Minimal boilerplate
  • Useful for places where you can't/don't have a full Python setup
  • Useful for including directly, like when you lack permissions
  • Works with a variety of WSGI servers, including Gunicorn

If you need to produce a big application, you're probably better off with Django, Flask, or any of the other larger/more mature web frameworks. No pressure!

Setup

pip install itty3 is what most people will want.

That said, itty3 is completely self-contained to a single file & relies only on the Python standard library. You can directly copy itty3.py into your project & import it directly!

Dependencies

  • Python 3.7+

License

New BSD

Running Tests

$ pip install pytest pytest-cov
$ pytest tests

# For code coverage
$ pytest --cov=itty3 tests

Building Docs

$ pip install -r docs/requirements.txt
$ cd docs
$ make html

itty3's People

Contributors

toastdriven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

itty3's Issues

Add Logging

Problem

logging is a pretty great idea. Finish the logging branch, which currently seems to be blocked on configuration.

Setup

Python version: 3.7.4
itty3 version (itty3.get_version(full=True)): 1.0.0-alpha-2
OS: All
Any other libraries/setup: N/A

Static File Support

Problem

Being able to serve static files (while in development) can be an important barrier to entry. Providing at least a minimal implementation (while being mindful of security concerns) would be nice to have.

Setup

Python version: 3.7.4
itty3 version (itty3.get_version(full=True)): 1.0.0
OS: All
Any other libraries/setup: None

File Upload Support?

Problem

This is a rabbit hole. A common problem is wanting to support file uploads. However, history has proven this to not be particularly straight-forward.

If it can be done with minimal added complexity, it'd be nice to have.

Setup

Python version: 3.7.4
itty3 version (itty3.get_version(full=True)): 1.0.0-alpha-2
OS: All
Any other libraries/setup: N/A

Comparison with Bottle?

Forgive my silly question... How does itty compare to bottle?

I think adding this explanation to the readme would make a lot of sense. Comparing to Flask and Django (very high level) may be useful too, but itty and bottle seem to exist in a very similar space.

Example Code

Problem

Currently, the only working example code is the tiny snippet from the README.md & the code from the Tutorial.

We should ship some fully-working examples with the library, to demonstrate features/approaches to common problems.

Setup

Python version: 3.7.4
itty3 version (itty3.get_version(full=True)): 1.0.0-alpha-2
OS: All
Any other libraries/setup: N/A

More Docs

Problem

Right now, the only real docs are the Tutorial & the auto-generated API Documentation. At a minimum, we should add guides for:

  • Deploying itty3 to a production environment
  • Extending the built-in itty3 classes
  • How to troubleshoot when things aren't working

There are already stubs for these, they just need to be expanded upon.

Setup

Python version: 3.7.4
itty3 version (itty3.get_version(full=True)): 1.0.0-alpha-2
OS: All
Any other libraries/setup: N/A

Add Cookie Support

Problem

The original itty featured cookie support & it's repetitive/semi-painful code to have to write yourself. Ideally, itty3 should support it as well.

Setup

Python version: 3.7.4
itty3 version (itty3.get_version(full=True)): 1.0.0-alpha-2
OS: All
Any other libraries/setup: N/A

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.