Simplify your project's main entrypoint definition with @main
Project description
@main
.py
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)
Built Distribution
mainpy-1.0.0-py3-none-any.whl
(3.7 kB
view hashes)