Skip to main content

Pseudo install a package which is accessible via a PYTHONPATH

Project description

pythonpath-project

This Python module allows to register to pip Python modules that are loaded from their dynamic libraries in the PYTHONPATH. pip registering the modules allow to add a module that is not pip installable in a Python package requirements.

How to use?

A Python module called pythonpath_project proposes to override the setuptools Python function to add a Python module using its name, its version ID and its actual definition location.

To install a module, a folder needs to be created with inside:

  • a pyproject.toml: It defines the code name and its dependancies
[build-system]
requires = ["setuptools", "pythonpath-project"]
build-backend = "setuptools.build_meta"

[project]
name = "YourModule"
dependencies = [...]
dynamic = ["version"]
  • a setup.py: It actually adds the module to the pip environment using the pythonpath_project module:
import os
import sys
#   Import setup from pythonpath_project instead of setuptools
from pythonpath_project import setup

def get_version():
    #   Python function to catch the installed module version to dynamically set it, it can also be hard writen
    sys.path.insert(0, os.environ["YOURMODULE_PYTHONPATH"])
    import YourModule
    # Replace with any way to get the code pip compatible version id
    return YourModule.__version__

setup(
    name="YourModule",
    get_version=get_version,
    packages_names=["YourModule"]
)

The installation procedure creates a fresh environment in which the module from imported, a module compatible python path will be required. It needs to be set provided in the environment variable YOURMODULE_PYTHONPATH where YOURMODULE is the module name in upper case.

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

pythonpath_project-0.0.2.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

pythonpath_project-0.0.2-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file pythonpath_project-0.0.2.tar.gz.

File metadata

  • Download URL: pythonpath_project-0.0.2.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for pythonpath_project-0.0.2.tar.gz
Algorithm Hash digest
SHA256 47e2f87eaabbdff51dcb2bca74ce510a6d10388a844eba152e5843c641ce771a
MD5 5a6fa7aa01e79a8ecb56c635de43581f
BLAKE2b-256 4fc4649e43d5a4fe9ed337c009faeddeb53425227bea91aa5f4967b6fea1138c

See more details on using hashes here.

File details

Details for the file pythonpath_project-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pythonpath_project-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 69c3e14c7d0897710d3ea7cf302fe6c712e339cf170b4266ac656fcc5631908e
MD5 796fd5b6baafd3b4f7d14b2ea8f9bbaf
BLAKE2b-256 4186c88321a627c7d7daf7773c0e771bc32493e4697123ec95ff30ca0be5c6e5

See more details on using hashes here.

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