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.2.0.tar.gz (12.9 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.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nopkg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 203e5d961b4e393e162c6aa3be3382b98cb1961954d0b3b307d0360b6536f424
MD5 7efa9f16bc12751a39012713c4e037d0
BLAKE2b-256 3f7a0233c2e6230254ab7252905fa35067601b891a867ac49adac69d76e58ffa

See more details on using hashes here.

Provenance

The following attestation bundles were made for nopkg-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: nopkg-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 327e521227ca0f7c70326fcecf642a20a40fd4f7945bb867e4a6eda204c9fa63
MD5 c59792fbfd3a7fcd8a43dd9f4db6d432
BLAKE2b-256 5eb14ebe8e2b76166a40214b4542a091740f2fa050b0476709cdc1aade429440

See more details on using hashes here.

Provenance

The following attestation bundles were made for nopkg-0.2.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