Skip to main content

Script specific packages

Project description

pypackages

Script specific packages similar to PEP 582 using a __pypackages__ directory. The __pypackages__ directory must be in the same directory as the script being executed.

Intent

Simplify the distribution of python scripts with dependencies. No need to use virtual environments or explicitly install dependencies using pip.

(Optional) Automatic requirements install

Place requirements.txt in the __pypackages__ folder to install or upgrade on startup using pip.

This saves the need for distributing python version specific packages explicitly.

Requirements

pip must already exist in the python environment if requirements.txt is used.

Installation

Install pypackages directly into your project as follows:

pip install --target . --upgrade pypackages

Structure of pypackages

myapp.py
__pypackages__/
    requirements.txt  (optional)
    bin/
    lib/
        python3.11/
            site-packages/

Structure of deployment

myapp.py
pypackages/
    __init__.py
__pypackages__/
    requirements.txt

Example (requirements.txt)

sanic==22.12.0

Example (myapp.py)

#!/usr/bin/python
import pypackages
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

https://peps.python.org/pep-0582/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypackages-0.1a3.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

pypackages-0.1a3-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pypackages-0.1a3.tar.gz.

File metadata

  • Download URL: pypackages-0.1a3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pypackages-0.1a3.tar.gz
Algorithm Hash digest
SHA256 193c428ae82677651135dee0992e4f497e70138af6bb9cadd88a1f79270b0062
MD5 18c0a56691d741356647f55b2c002880
BLAKE2b-256 60ca1bd8d3b767a69c9a2724347797a257bb61a0af0065d1727d6b21f49f9a06

See more details on using hashes here.

File details

Details for the file pypackages-0.1a3-py3-none-any.whl.

File metadata

  • Download URL: pypackages-0.1a3-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pypackages-0.1a3-py3-none-any.whl
Algorithm Hash digest
SHA256 9529fffb001094ced3825f2c7ddbbbf624cef8adee4a214c82df165a1ba8f01f
MD5 68fa34667a54c3736dd9815f939d8d3e
BLAKE2b-256 99cdfddc592bcc975828e72ad8d142ba5d1d0f2c50b596082160631dcbf06363

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page