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 contain many atomic components. Asyncio makes theirs initializing a little bit complicated. It's OK, when you have 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 have to implement also graceful shutdown

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

Solution

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

Basic principles

There are 6 most significant stages of the application lifecycle:

  • on_init executes exactly once on application startup

  • pre_startup is called before event loop startup

  • on_startup is called exactly when event loop started

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

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

  • on_exit executes exactly once when application is stopping

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 worker class, which aggregate your defined callbacks and run in the right order. Depending on application type, these callbacks may be called by primary application or by you are

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.4.tar.gz (21.3 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.4-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

systempy-0.1.4-cp313-cp313-win_amd64.whl (172.6 kB view details)

Uploaded CPython 3.13Windows x86-64

systempy-0.1.4-cp313-cp313-manylinux_2_39_x86_64.whl (325.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

systempy-0.1.4-cp313-cp313-macosx_14_0_arm64.whl (316.0 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

systempy-0.1.4-cp312-cp312-win_amd64.whl (172.4 kB view details)

Uploaded CPython 3.12Windows x86-64

systempy-0.1.4-cp312-cp312-manylinux_2_39_x86_64.whl (328.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

systempy-0.1.4-cp312-cp312-macosx_14_0_arm64.whl (316.6 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

systempy-0.1.4-cp311-cp311-win_amd64.whl (171.4 kB view details)

Uploaded CPython 3.11Windows x86-64

systempy-0.1.4-cp311-cp311-manylinux_2_39_x86_64.whl (314.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

systempy-0.1.4-cp311-cp311-macosx_14_0_arm64.whl (313.0 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

systempy-0.1.4-cp310-cp310-win_amd64.whl (172.3 kB view details)

Uploaded CPython 3.10Windows x86-64

systempy-0.1.4-cp310-cp310-manylinux_2_39_x86_64.whl (321.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

systempy-0.1.4-cp310-cp310-macosx_14_0_arm64.whl (318.4 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

systempy-0.1.4-cp39-cp39-win_amd64.whl (172.2 kB view details)

Uploaded CPython 3.9Windows x86-64

systempy-0.1.4-cp39-cp39-manylinux_2_39_x86_64.whl (321.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

systempy-0.1.4-cp39-cp39-macosx_14_0_arm64.whl (318.2 kB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for systempy-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7cf4769219308ea3a3a64c56cced2a19e886079fe14d126fbeeb27017d4cf08a
MD5 6d923d98235183266afd560630296262
BLAKE2b-256 0b6dd161b71556865914cf7d84471e786d713d8af06fb9163ea23a82da8e4292

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for systempy-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 10ea59f42d65cfbc4c7a4eb3e5b4cdb78f2a4dede2528451d796eefd3da8093c
MD5 a99712c5f0a0fece630c2b60628e1f82
BLAKE2b-256 c2b917ba3d424d8675ef7bbb102773aae109304ec0329509cba2beff49d70d86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f1ee28521329bb4f6f8ecec57140f2df7e13f6c74c39ddaa3c03e74244d4ac5f
MD5 c697ad87b63fccb978d6b9692f59fe82
BLAKE2b-256 0ab3c84c65d65517f0fc4d0f416579301ae4220ddc59d94d778acefcabcaeb7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 187e8cc78c17ae790560db32048ce2a65e58bbe5d4ee2b5ec38e2506f187d513
MD5 bc1e59ecdd2072487d20f87a664fd2f2
BLAKE2b-256 407227df3fe0eae087b01d3de819fa9076119992385e89a90d6fbd47a4ed0c97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 50c01ee9725b38ccf1023a066ad30c6955a4ef13e6e78a9e4823c4550bf6fc36
MD5 48eec3fa02268a9578cfbf59e121b4cd
BLAKE2b-256 7dc96a6ee1e410c4e0c666872c1b4aa1dd9dd4926902aa46d7b8d969a044f0a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e54982259df7f336dbb117a382f90860f66dd2069ce3bd2bfa983008adca66ac
MD5 a354a5d713c5a926b603998c517862ac
BLAKE2b-256 a3d7ac51a81fa17d84211625946d4e207d1d5886f9ac1551f930b27ba74c733c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 75f9d4288c0b2c0ef4b08a905979b52f48363b25c0f044510659fdccfa3ebb7e
MD5 697eb8eaba20017b9d73e48ba624ddd5
BLAKE2b-256 611e2442d9c2462ddea2e3d7f3e7d6ba824433ce43cbba43f5f4eb2bbca53e92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 864b8ed063e213edbfcd1ff7f8135b1bd9c87da5b150286a90f5d0ee413e806c
MD5 00c75e8469148b1eb84f2a79d58aa0c0
BLAKE2b-256 86f38ecd074e106e34b81666ba49cd98bb5775488acbf476dfe735cad4aea2dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 41288c9d8a5fd11662e04dc2ce337de126e84ad8aa986abd99746272e54ada93
MD5 d6fec870b2118e2cf1c69afd8c6e0265
BLAKE2b-256 fe899999393f2477a5e91ffe0319e8d6d7450e474be8a75faa0f9955bcb21c18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 a30f2e5e06ed635a42bcbf7a3391b979f82b754f21b857c7fe138ab571f33d1e
MD5 de9e880f7bb8d852591d09823c881d74
BLAKE2b-256 0d940a5ce683c141561c00e7109e4a3a049ecebcaa9008c6735a8d45828ce84a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 6bdfd906cabee35099e7c86f3673343ef7079778c55ba6221bb179093519d664
MD5 beb4441973021f04af45ad38f14924b6
BLAKE2b-256 c6e546c2b150ed7bc2cb5095da7723af0a80a8cc1516455881c8f65b885e9e88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 17dd3a3a051f9e503409202d4e10abe66a098c6efde2459fed6bfe9b495c43c5
MD5 d87c215805d7a5b0fdb35a5284d6fd12
BLAKE2b-256 ba02220ac70877eab79d2279f6f861a0c6cd4743876205e1e20253cca706058b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 d12788b7168f3371bbf06ff3dac43c42f44e6c3b8651f95a6f41f8215d2ccf8b
MD5 159acd59e9765bc5af08e4408cf34849
BLAKE2b-256 2db1fa5999fb943c5c2c415d0491ba990f3346cac87a5805c3679b9bce9ef4e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 86fab58ee3159c5bcad17cf075e6c3fbac06abb3a0fec2d044d28fb64e471ca0
MD5 fb21932cc4d289d534c5ca8e2374c28a
BLAKE2b-256 112c2975560ede19567881d7df51d61d705c14d3892e419cfff03c6a8dd1235a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: systempy-0.1.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 172.2 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.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5fc41e632f0f6f8b033aa781ec8bc14bd8b4c7e9c9d8030cf92c8a0e19c0e593
MD5 16b486d11d421a954b77836c75240c1c
BLAKE2b-256 e9a991c3d1d18092b18ddc616e884e79ae4a52c152bdb5e7de299424ad2fdabd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 3105691723856e3d6fec2064e9fcaa0775cec81ab3efd19ec369c4cfafdcec83
MD5 264373d14b5c0799280a80c0515feb2c
BLAKE2b-256 37ffbec6d54b55459534995cd7313fd332aada1f6f30759aedaa321c0224443c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for systempy-0.1.4-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1a2f5d1f8a6b565aaf1d8526ada17def4afa279baa9c888a7ea61944c066c838
MD5 622f210c6416a6b768e8f9d4783ca9df
BLAKE2b-256 576152db3f7d5ed2fc5497a5ad49229b5c3888fcac37f4b9c1c4da9a7d3cbc6a

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