install-directives
install-directives contains a command line tool, install-directives, used to aid in post-install and post-uninstall steps for packages installed with pip. It also includes a class to represent packages installed with pip.
Usage
The idea is to write a custom class that inherts from InstallDirectives, overriding its package_name and module_name attributes and its _install and _uninstall functions. This should be placed in a package called install_directives in your module.
For example, if your package is called "mypackage", you could set up InstallDirectives for it to run a script on install and another script on uninstall as such.
# mypackage/install_directives/__init__.py
from python_install_directives import InstallDirectives as InstallDirectives_
class InstallDirectives(InstallDirectives_):
def __init__(self) -> None:
super().__init__("mypackage")
def _install(old_version: str, new_version: str) -> None:
run_script()
def _uninstall(version: str) -> None:
run_another_script()
These overridden functions will be called upon running the command line tool as such. You can utilize the current and incoming versions of the package to perform different actions on install, as they come in as parameters. Similarly, you can utilize the current version during uninstall.
# Do a pip install of myproject first
install-directives myproject install # Calls `run_script`
install-directives myproject uninstall # Calls `run_another_script`
Metadata
Release files for install-directives 1.0.0
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 |
|---|---|---|---|---|
| install_directives-1.0.0.tar.gz | 5.5 kB | Without provenance | Details for install_directives-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| install_directives-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for install_directives-1.0.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / install_directives-1.0.0.tar.gz
| Download URL | install_directives-1.0.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73f52521cd5b2dd0524e1c4a128c113b43af0ae766fa5978aa2ae67ed26bea6d
|
|
BLAKE2b-256 checksum How to use checksums |
e0196b91eff18b871bd1904ddedee9695804fedc2514bdef6c9249aad00b5258
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0
|
Release files / install_directives-1.0.0-py3-none-any.whl
| Download URL | install_directives-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bb0c3f3599b8e9233dbfbef7aa328caf18333fefb8ff3669a3649be7345195c
|
|
BLAKE2b-256 checksum How to use checksums |
7081dda09462b587c45db0b6b6545c0a43c53a1cbf19db5d6e159ea39650d4c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0
|
Security for install-directives 1.0.0
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.