Script specific packages
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pypackages-0.1a6.tar.gz
.
File metadata
- Download URL: pypackages-0.1a6.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd4e258dab6a67badb37dd815604462df923927fedf6bc77070310b14aa99a41 |
|
MD5 | c131e53723c069e8b8a1604a04851f51 |
|
BLAKE2b-256 | b28d584e9b686dab85f1bf46b81893e7059919d0dab04e714e1156a5aeb3296a |
File details
Details for the file pypackages-0.1a6-py3-none-any.whl
.
File metadata
- Download URL: pypackages-0.1a6-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f6319c7a3bbac609db53ecf14db6a75d8e157c86a0bcadc9b2b5870964bd8b9 |
|
MD5 | c8949bb25f6b03ff010bb0ecc919e870 |
|
BLAKE2b-256 | 9878ed9962b46871f48f5cb611ceb458f155fe0a753126367e0d3f3f1c780f94 |