This release is a pre-release and may not be stable for production use.
pypackages
Script specific packages similar to PEP 582 using a __pypackages__ directory.
The __pypackages__ directory is created in the same directory as the script being executed.
A requirements.txt file must exist in the same folder to activate package installation.
Intent
Avoid dependency conflicts when installing python command line utilities.
Automatic requirements install
Place requirements.txt in the folder to install or upgrade on startup using pip.
This saves the need for distributing python version specific packages explicitly.
This also avoids the package having explicit dependencies that are installed along side the package therefore creating the potential for package version conflicts.
Activating
import pypackages
pypackages.packages()
Execute pypackages.packages() to perform a local installation of requirements.txt
Pre-requisites
pip must already exist in the python environment if requirements.txt is used.
Example setup.cfg
[metadata]
name = demo
version = 1.0
[options]
packages =
demo
install_requires =
pypackages
[options.package_data]
demo =
*.txt
[options.entry_points]
console_scripts =
demo = demo.app:cli
Structure of deployment for scripts
myapp.py
pypackages/
__init__.py
requirements.txt
Example (requirements.txt)
sanic==22.12.0
Example (myapp.py)
#!/usr/bin/python
import pypackages
pypackages.packages()
from sanic import Sanic
from sanic.response import text
app = Sanic('myapp')
@app.route('/')
async def hello(request):
return text('Hello, world')
if __name__ == '__main__':
app.run(port=9999)
References
Release files for pypackages 0.1a6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pypackages-0.1a6.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pypackages-0.1a6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / pypackages-0.1a6.tar.gz
| Download URL | pypackages-0.1a6.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd4e258dab6a67badb37dd815604462df923927fedf6bc77070310b14aa99a41
|
|
BLAKE2b-256 checksum How to use checksums |
b28d584e9b686dab85f1bf46b81893e7059919d0dab04e714e1156a5aeb3296a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / pypackages-0.1a6-py3-none-any.whl
| Download URL | pypackages-0.1a6-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f6319c7a3bbac609db53ecf14db6a75d8e157c86a0bcadc9b2b5870964bd8b9
|
|
BLAKE2b-256 checksum How to use checksums |
9878ed9962b46871f48f5cb611ceb458f155fe0a753126367e0d3f3f1c780f94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|