How to refer to sibling/parent directory in `setup.cfg`

Viewed 91

Suppose I have the following directory structure:

`- Root
  `- ProjectA
    `- setup.{cfg,py}
    `- PackageA
      `- __init__.py
  `- ProjectB
    `- setup.{cfg,py}
    `- PackageB
      `- __init__.py

which I am not allowed to change.

Also supposed that Root has many other unrelated folders, which make it not suitable to turn into a Python project folder.

PackageB wants to import PackageA. How can I declare this dependency in Root/ProjectB/setup.cfg, such that running pip install . in Root/ProjectB/ will create a copy of ProjectA/ in Root/ProjectB/.venv/lib/.../site-packages.

Seems somewhat reasonable?

Any attempt at using .. in package_dir has failed me. Pip does not complain, but also does nothing.

So far the only working solution I have is to create a symbolic link Root/ProjectB/PackageA -> ../ProjectA/PackageA, and to put:

# in Root/ProjectB/setup.cfg
package_dir =
  PackageA = .
packages =
  PackageA

But in reality there's more than one PackageA, and symbolically linking to every package that ProjectA defines is tedious and ugly.

This seems like a reasonable ask: how do I make it so that ProjectB can import any package from ProjectA without altering the directory structure, and without turning Root into a Python project itself?

0 Answers
Related