What is the proper way to build and reference an editable local Python module?

59 Views Asked by At

I am trying to build a module that will be shared among more than one Python application in a project.

I have a folder with a pyproject.toml with the following content.

[project]
name = "data_audit_shared"
version = "0.0.1"
authors = [
    { name="Josh Russo", email="[email protected]" },
]
description = "Shared code for data audit"
requires-python = ">=3.8"
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
]

When I try to reference data_audit_shared I get the message No module named 'data_audit_shared'.

My dependency in my project is -e ../../data_audit_shared and it installs properly.

This is what my venv site-packages looks like.

enter image description here

How do I update module or the reference to be able to use this module?


Edit - Tried removing -e

So when I remove -e I get the module listed in the installed modules. Is there something I am missing to be able to properly install and reference my module with -e?


Edit - Relative paths

I'm assuming that this is because I'm trying to reference a package outside of my project folder root. The strange part in my mind is that you can use this syntax with a Git repo. Why would it not behave similarly?

0

There are 0 best solutions below