al78 tools
Tools for Python setup file
Simple tools to complete setup.py file
Installation
pip3 install al78tools
Usage
Handle App first run
There is no way to run some post install bash code after pip package installation. But you can use this simple tool to run some bash code after first run of your app.
Example
main.py file
import os
from al78tools.pysetup.first_run import first_run_decorator
from al78tools.pysetup.tools import get_file_content
APP = "my-app-name"
VERSION = get_file_content(os.path.join(os.path.dirname(__file__), "VERSION"))
@first_run_decorator(APP, VERSION)
def _handle_first_run():
import subprocess
result = subprocess.run([os.path.join(os.path.dirname(__file__), "postinstall.sh")])
if result.returncode != 0:
print("Postinstall script failed.")
def main():
_handle_first_run()
# rest of your code
if __name__ == '__main__':
main()
!!! Warning !!! Do not forget to add postinstall.sh file to your MANIFEST.in file.
After this, you can use postinstall.sh file to run some bash code after first run of your app.
There is a version string compare mechanism. If version differs from previous version, the postinstall.sh will be run.
If you want to run postinstall.sh only once during all package updates, do not fill version paremeter in first_run_decorator function
and it will run only for the first time of package installation.
File content reading
setup.py file
import os
from al78tools.pysetup.tools import get_file_content, get_file_content_as_list
pwd = os.path.dirname(__file__)
VERSION = get_file_content(os.path.join(pwd, "VERSION"))
README_MD = get_file_content(os.path.join(pwd, "README.md"))
requirements = get_file_content_as_list(os.path.join(pwd, "requirements.txt"))
Metadata
Release files for al78tools 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| al78tools-1.0.4.tar.gz | 3.9 kB | Without provenance | Details for al78tools-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| al78tools-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for al78tools-1.0.4-py3-none-any.whl |
Total release size: 8.2 kB
Release files / al78tools-1.0.4.tar.gz
| Download URL | al78tools-1.0.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40d18bf5fd5c10108532f040729da191d8a14664508ad0466b8663c50e21e795
|
|
BLAKE2b-256 checksum How to use checksums |
198d3be18be3b210646219142ac944dc7fa5bb40fe9d791a8fe6ee6cb91ca565
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / al78tools-1.0.4-py3-none-any.whl
| Download URL | al78tools-1.0.4-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff7874064beace260e60d40c611235492d21b488e8a3fc9791da83e076dbb963
|
|
BLAKE2b-256 checksum How to use checksums |
1cf969fe3c63267eeff850deb94dda7053be286a78c714afe3a40ebd56c81e50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for al78tools 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.