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.

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.1a1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

pypackages-0.1a1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pypackages-0.1a1.tar.gz
Algorithm Hash digest
SHA256 cfad01a9f8840c1e7fe152a03cbbc983aa65762512dcec6c1bc705b84e74ce30
MD5 417233238b3c7fc07c590d3025fe142f
BLAKE2b-256 726d3becc46b4aa1336dd829ecfe0ce9137817c429f99673e258dbd6c2c2822e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pypackages-0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6ddc62bacb067f08efe4f0765a538e2893b283343e445f99ad2394e3d05cde0
MD5 60b06d2799767f7f5e8c8590c226c89a
BLAKE2b-256 67fb725f52e136a0e2338e35ac1b8b504385a98edbff58475f05bcc39f882d19

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