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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file mainpy-1.0.0.tar.gz.

File metadata

  • Download URL: mainpy-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-39-generic

File hashes

Hashes for mainpy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c878d2a2c12565833ccd3a56467880e6bceedb1d8ef4f2fe2a6d8ec807471605
MD5 9c59355c9114a91677fb13872af4c7e4
BLAKE2b-256 a32de33b59f9cdb8a0e3bb7f6de2b21c5d60f40feee6f0967e0c62d7f8002f45

See more details on using hashes here.

File details

Details for the file mainpy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mainpy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-39-generic

File hashes

Hashes for mainpy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1810411c9c7d2954f9acd223bf828f64df5bac0d5d93d758a3d9ee817585930d
MD5 185567c3966ecee3033639be28f234bb
BLAKE2b-256 e838a4fa9559108aea2f09e74ab1d109fee108a0927e0f417c8cc1ac58c45f4c

See more details on using hashes here.

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