Skip to main content

Python application component initialization system

Project description

systemPY

Logo

Python application component initialization system

python version downloads format Documentation Status GitHub issues Ruff Checked with mypy

Full documantation is available at Read the Docs

The problem

The regular application contains many atomic components. Asyncio makes their initializing a little bit complicated. It's OK, when you have a single entrypoint and initialize your application components via your framework. While you add new components to your application iteratively, you don't see any problem

When you create any new entrypoint, you have to think a lot, how to initialize application components again, which callbacks should be called and in which order. But it's a half of the problem! You also have to implement a graceful shutdown

The most painful part is one-time scripts. It's kind of The Banana Gorilla Problem: you just want a banana but you have to initialize a gorilla holding the banana and the entire jungle, and then gracefully shutdown it

Solution

This library allows you to implement application startup and shutdown in a declarative way. You have to implement a class for each your component, write the startup and shutdown code. Then you have to combine required components as mixins into the current application App class. Then create an instance and pass dependencies as keyword arguments. In case it's a self-hosted app you have to call the instance.run_sync() method

Basic principles

There are 6 the most significant stages of the application lifecycle:

  • on_init is called exactly once on the application startup

  • pre_startup is called before the event loop is started

  • on_startup is called exactly when the event loop has started

  • on_shutdown is called when the application is going to shutdown or reload but the event loop is still working

  • post_shutdown is called after event loop has stopped or drained. When application is going to reload, next it would be called pre_startup

  • on_exit is called exactly once when application is going to stop

You may to create Unit classes for each your application component where you may put your code. Then you may combine these Unit class mixins into the current App class, which composes your defined callbacks and runs in the right order. Depending on application type, these callbacks may be called by primary application or by yourself

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

systempy-0.1.5.tar.gz (21.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

systempy-0.1.5-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

systempy-0.1.5-cp313-cp313-win_amd64.whl (172.0 kB view details)

Uploaded CPython 3.13Windows x86-64

systempy-0.1.5-cp313-cp313-manylinux_2_39_x86_64.whl (323.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

systempy-0.1.5-cp313-cp313-manylinux_2_35_x86_64.whl (317.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

systempy-0.1.5-cp313-cp313-macosx_14_0_arm64.whl (313.1 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

systempy-0.1.5-cp312-cp312-win_amd64.whl (171.9 kB view details)

Uploaded CPython 3.12Windows x86-64

systempy-0.1.5-cp312-cp312-manylinux_2_39_x86_64.whl (325.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

systempy-0.1.5-cp312-cp312-manylinux_2_35_x86_64.whl (320.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

systempy-0.1.5-cp312-cp312-macosx_14_0_arm64.whl (313.9 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

systempy-0.1.5-cp311-cp311-win_amd64.whl (171.1 kB view details)

Uploaded CPython 3.11Windows x86-64

systempy-0.1.5-cp311-cp311-manylinux_2_39_x86_64.whl (312.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

systempy-0.1.5-cp311-cp311-manylinux_2_35_x86_64.whl (309.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

systempy-0.1.5-cp311-cp311-macosx_14_0_arm64.whl (310.8 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

systempy-0.1.5-cp310-cp310-win_amd64.whl (171.9 kB view details)

Uploaded CPython 3.10Windows x86-64

systempy-0.1.5-cp310-cp310-manylinux_2_39_x86_64.whl (317.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

systempy-0.1.5-cp310-cp310-manylinux_2_35_x86_64.whl (312.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

systempy-0.1.5-cp310-cp310-macosx_14_0_arm64.whl (315.8 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

systempy-0.1.5-cp39-cp39-win_amd64.whl (171.8 kB view details)

Uploaded CPython 3.9Windows x86-64

systempy-0.1.5-cp39-cp39-manylinux_2_39_x86_64.whl (317.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

systempy-0.1.5-cp39-cp39-manylinux_2_35_x86_64.whl (312.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.35+ x86-64

systempy-0.1.5-cp39-cp39-macosx_14_0_arm64.whl (315.4 kB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

File details

Details for the file systempy-0.1.5.tar.gz.

File metadata

  • Download URL: systempy-0.1.5.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.3

File hashes

Hashes for systempy-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1cc4dc89b063a7306ba8f1984dd88d261a9f49d78e7bb8c108bc3a4130de1863
MD5 8e20933b45d3ca446ba5bc75ca3db1b7
BLAKE2b-256 a3155b59f58ad47f6ce405aac6a5f1bf8c5b8596b6164268f24ed3c9a22e3c06

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: systempy-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.3

File hashes

Hashes for systempy-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c2c31d371e96231a819c67d91d4d94605d6131113a3bb99581b35dfd520c49
MD5 a0a6c17cb4b749f0aaff80432ec1d942
BLAKE2b-256 fa1b1dc9b0b5fbf83684d82a4b647b8d62f05c232b7c06f50af827b93e2cbe56

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 42951838ec7a9e61de4221f41c945d7e894cb4e7a7ca499351446508c313b708
MD5 8a2dcd6674bcd804d5ee28f5244b6126
BLAKE2b-256 e2094a974098e81d44df374612dc36474f5b8eceeab0a1f2e27c47aaf96c9065

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 a6c367c8de4c2e41fe450da6e79ccfe351c103039e2385a1d07e448cb73af06a
MD5 abd38c4d2b7c6347c9d3ce00d0f259d0
BLAKE2b-256 535708c2df721e0941bfe221687ff5d7c89005d0ac97c55b6043cf9e9616971f

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 4a62ec7e0ee4f7effbe02849b32cd0de3a36042c9e477c87a2765a65eb9bff21
MD5 85b10f02c6bc8aad5f73d561222e6204
BLAKE2b-256 30d7cf4823416e1334be5fbea4359b623ac6c42a0cde15f42e9b8ec7005ba5a3

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 0cb7f69b9cb1b2762eee4bfb86142da16384af0c26c5dd8999fc462a25b0c0f9
MD5 ba3765d7a2ca1667f743b68c495445ce
BLAKE2b-256 075353f52c94e9031a14c90f97951ac16030ee1ae42d6ee4c21c151caff2d854

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8bf8bdae6491fa40e0e60d7ab4c4f8e88d10d66faa6d0e3ecf049ce004b99dac
MD5 ab9f818d7d5c1cd7b779a785d4b2544b
BLAKE2b-256 91a800e8f57b8b7de7717dd88608c188bc7a10844ce10142bb667b9afa8985c2

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 89d563ee467caaf1dbaab682843772d849f1453b8359c5ffc3b7b9fc5b424928
MD5 431200c9a5b683e295f7ed8979066ee0
BLAKE2b-256 a298500ea43dd714ee5de99d756bc6e49be5d9ca4d6a080fee6df74cca7295e1

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 c7187dd6e202eccde859ffa4feb8c8570a0ed240b04e19498d009b21148e3a09
MD5 5c81aec9ece79c7bd8f5eb21edb7997e
BLAKE2b-256 eeb8d9311d1097c56eb3caadf9c7c0ab5b8f738f5cb9289c877124e466b5f1bc

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 653774e98230010a00bb6e04382c215282a46b543c8a313e5a9dcc5a47a23027
MD5 8297cef58cd9cde6ab921c53a11ca732
BLAKE2b-256 abdd0ea3b9eb73ab4d528c594dfa9efbb5e0a36a9b1da37ae43d602cf4b001fd

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b7f6a903dc8c6e1e2fec976a60b82bf1967e0d7a8da9917f082e69601ccaa2ac
MD5 b058a9e1432f03c8118d7a9325c65033
BLAKE2b-256 27440dccb35301428d7b1a185edbc23a72f112a2e080364d6cc3e83250793fdb

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 9a03dff021384bbd7475fc0d5fd81fefbe41497ab628366308a6d90b11190535
MD5 341c16f4445e53141dac736c21b5ab31
BLAKE2b-256 170d845ea89a373723d5cfb433a48520cf0a3ede451b993d439744c679c0e1cf

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 e9e51b72966b49d25552e964f0c1001f201d5fa705a754c110ffed6a60ede9eb
MD5 cbb7ceb33f68bbe1eb3f0c0def51f012
BLAKE2b-256 f9d50fa674ec6c301e168633da737969719dfcd9a943fa14caf2212f9b8cb53e

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 8f6ed69696a8b8a4bb5ee6b043a65a85a0cf15847da80413658001948d29bacc
MD5 cbfa43ad9670b6e9ba7151393489c9bc
BLAKE2b-256 65af84c1af99b8c30f7163f7e32a0d7785058ca5a6354c557652da1bf36b1600

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 77eba4c7a7ee5ebb3423dd01a80d0dd7a0b4b2efb053f24650073c02320991dd
MD5 aec346cc74d983c82a560901d7138655
BLAKE2b-256 4752ac2eafa97bb650e2fd1dbf38f683ee471301bbb39ca1622fde627cce6077

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 4f0e22083caa56d0407bb3dfce9f144fb07c33c22fe7e377861cc294ee20e227
MD5 fecf11039d384810f0e19a278c8908df
BLAKE2b-256 b0f7bca3aa5091f7b0504560cc1f6d73f319bec36ef99866b5abc4c926ab4c4c

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 9d6c7a2c30e293e54ad364d1cc0d79a4a694d5b0ee4b988cd9bbc20a3e2e4d85
MD5 0792c81cf957140c488c2c36cd7e167d
BLAKE2b-256 d03560fd0d5ea42e69d9fe0a4a37541b9a287e6e67afeb699e04b1ff60ffefda

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 5b76eeaf2a5299efbf85cf4b1d516002793de2ceb49c8ed657a1f006b67f8dc8
MD5 3ba866decb28a025e5733b20fbcb4d3a
BLAKE2b-256 bdca2b1761b2c3e8d6cb3d40ef42c1442e0e769565a9c7c32d48c3327810a1cc

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: systempy-0.1.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 171.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.3

File hashes

Hashes for systempy-0.1.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b5ef9028d760e93352cd78a2f59da28c3f129a5d563e46fec2a1ad60a70488bf
MD5 1963ccb58cfe7bd474ef1f2661a06dda
BLAKE2b-256 cc1b6fd34035cddf963da4143f1c7f0bc4c82f9a535d212967d3f88deb7305ea

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 7544d986c5aecaf1af7f3f5e6d0fcd482e72012cd2e8a6a224200aad365da88c
MD5 3c66e251dbb87d33527cd90f1cddac85
BLAKE2b-256 af42232b44a1803ebe0a2f8a835bfb44fd78ca8c49f15f006331e58d16ef09ba

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp39-cp39-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp39-cp39-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 63473d902f57ed1527e2f8a459ec3fa6edb8aad2026b354fba39bf1965528e94
MD5 6d9da3ec296867b718bb38ccd582c016
BLAKE2b-256 32caa3063bd226464ab670c5d7fd8edd79299c3d33402a343e4261c2a98ff8ed

See more details on using hashes here.

File details

Details for the file systempy-0.1.5-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for systempy-0.1.5-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c33e37b83039e3112862e58bffc4f9d4e9b6a0652aedd72048c67bfaeab1162d
MD5 4ac7d6c8e75793a3a6eb05d147b3afa7
BLAKE2b-256 e212217c5ee542a0d7668db0773f72c624a3c4587a63bbae7c50a0735b9017a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page