Skip to main content

Install your custom python modules into any python environment without setup.py, pyproject.toml, or any other typical python packaging setup

Project description

nopkg

Install your custom python modules into any python environment without setup.py, pyproject.toml, or any other typical python packaging setup.

Use For:

  • Personal scripts and utilities
  • Prototyping, evaluating the usefulness of a module before putting the effort into packaging
  • Sharing small utilities with your team, without maintaining a proper pip package or hosting an internal pip repository

Install python files as importable (from anywhere) modules

Install your module with nopkg

nopkg install mymodule.py 

Use it in python

from mymodule import hello

hello("I just installed a module without any setup!")

Works with venv (of course)

# Create and activate virtual environment
python -m venv myenv
source myenv/bin/activate  # On Windows: myenv\Scripts\activate

# Install your module
nopkg install mymodule.py

# Use it in your virtual environment
python -c "from mymodule import hello; hello('Virtual env works!')"

Editable installs

Install your python file(s) as an importable module, and keep them exactly where they are. Changes to your files will take effect immediately without any re-installing.

nopkg install -e mymodule.py

Install from URL

No need to limit yourself to python modules you have locally, nopkg will happily download and install modules from a URL as well!

nopkg install https://raw.githubusercontent.com/user/repo/main/utils.py

Managing Installed Modules

Ensure the expected interpreter is being used

nopkg env current

nopkg should be reasonably smart about selecting the correct interpreter, but if you ever need to tell it explicitly

nopkg env use /path/to/my/python

Most commands also accept a --python CLI option to use a specific interpreter for that command

nopkg install mymodule --python /path/to/my/python

List installed modules

nopkg ls

Remove an installed module

nopkg uninstall mymodule

Real-world Examples

Installation

pip install nopkg

How it works

nopkg installs packages directly into python's site-packages directory. It doesn't do all of the things that pip does, it's much more simple. Either:

  • a) a .pth file gets added to site-packages, which tells python the location (absolute path) of your module. This is essenially the same as appending to sys.path, but is applied automatically. This is how ediable installs in pip work as well
  • b) your source files are copied directly into site-packages as-is. Roughly equivelent to a source install with pip

In order to make sure you don't leave your site-packages in a bad state, nopkg keeps a simple registry file to track what is insalled where. This drives the nopkg ls command as well as enabling nopkg uninstall.

All this means:

  • No setup.py required
  • No pyproject.toml needed
  • No wheel building

But also means:

  • You can't publish to PyPI (still need setup.py or pyproject.toml for that)
  • You can't use C extensions or other native bindings
    • nodtl will copy ALL the files into site-packages when you give a directory -- so there is a chance this might actually work, but it isn't a supported use case
  • Inter-module dependencies can be a mess

nopkg is intended as a tool for personal utility management and prototyping, as well as sharing of ad-hoc utility modules within a team. nopkg is NOT intended as a pip replacement or production package management solution. It is a bridge that lets you get going quickly.

Things nopkg might do in the future! (Contributions Welcome)

  • nopkg pipify mymodule.py: Setup the boilerplate for full python packaging and pypi publishing

License

MIT

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

nopkg-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nopkg-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file nopkg-0.1.0.tar.gz.

File metadata

  • Download URL: nopkg-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nopkg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ef2ca06488df9c54f44f637aff032d2447d1bca51d4325411c5d19184fc9b1d0
MD5 34837b6789f35b11cf190a2e90cade92
BLAKE2b-256 40d5464c8a942e45c4f0bf39c1c573126f09ab96e59abdf65583c69e2a596876

See more details on using hashes here.

Provenance

The following attestation bundles were made for nopkg-0.1.0.tar.gz:

Publisher: pypi-publish.yml on BlakeASmith/nopkg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nopkg-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nopkg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nopkg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1be046f9d15ad836625c8ec08fc7aace4a31da50dcdeffa0c573360bb2f78bcc
MD5 17c52bf48e5dbf252a082b6c63514782
BLAKE2b-256 cfef26924027e1bd0514b23dc57024c2d74f09ff3ab22b5cb2fb27f5eb478bbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for nopkg-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on BlakeASmith/nopkg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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