Skip to main content

Simplify your project's main entrypoint definition with @main

Project description

@main.py


PyPI version shields.io PyPI pyversions PyPI license


Installation

pip install mainpy

requires python > 3.7

Usage

from mainpy import main

@main
def app(): ...

Async functions will be automatically wrapped in asyncio.run.

@main
async def async_app(): ...

Automatic uvloop usage

If you have uvloop installed, mainpy will automatically call uvloop.install() before running your async main function. This can be disabled by setting use_uvloop=False, e.g.:

@main(use_uvloop=False)
async def app(): ...

Debug mode

Optionally, python's development mode can be emulated by setting debug=True in @main. This will enable the faulthandler, configure the warnings filter to display all warnings, and activate the asyncio debug mode:

@main(debug=True)
def app(): ...

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

mainpy-1.0.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

mainpy-1.0.0-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

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