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.1a5.tar.gz
.
File metadata
- Download URL: pypackages-0.1a5.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64e17280b92e56469cb54cf6cc8ffdb908178a31b43eaedf6d46b5c5cade7440 |
|
MD5 | 37bdb84986e645bd1897164368461da2 |
|
BLAKE2b-256 | 8c4b9827ec1d0c6b9a4e95fb527d8c1cb71eeefdf6acd5b0c02bad002ebccad9 |
File details
Details for the file pypackages-0.1a5-py3-none-any.whl
.
File metadata
- Download URL: pypackages-0.1a5-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 | 56f8d02b89d87f1d89fdb3f06117b3e25a3fec472f57a2a8b8fb3f7fb343feb2 |
|
MD5 | d06806e8d43f76f6ff5dfd06f3c0e40d |
|
BLAKE2b-256 | 2ca890cb1ab178a82ed7b63dc307b78842b474155aca0b784ed7a39a01072ec0 |