Metadata-Version: 2.4
Name: pythonpath-project
Version: 0.0.2
Summary: Pseudo install a package which is accessible via a PYTHONPATH
Description-Content-Type: text/markdown
Requires-Dist: setuptools
Provides-Extra: test
Requires-Dist: pytest; extra == "test"

# 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

```toml
[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:

```python
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.
