4

A similar question has been asked before, but this time I am asking for the newer setuptools config file — setup.cfg.

Consider my use case, where I have a project with multiple Python packages that depends on each other. For simplicity let's say mypkg1 depends on mypkg2:

mypkg1/
  mypkg1/
  setup.cfg
mypkg2/
  mypkg2/
  setup.cfg

How do I write the setup.cfg file for mypkg1 such that it depends on a local copy of mypkg2?

[metadata]
name = mypkg1
version = 0.0.1

[options]
packages = find:
python_requires = >= 3.7
install_requires =
    ../mypkg2  # Does not work

The answer cannot be to distribute mypkg2 to a package repository (e.g., PyPI) or some VCS release (e.g., GitHub Release) as these solutions makes the package external and no local.


Related Questions

Keto
  • 1,470
  • 1
  • 12
  • 25

1 Answers1

1

Direct references still work. Looks like this:

install_requires =
    my_package @ file:///home/code/my_package

Note the triple-slash in file:/// - the first two are the usual schema://, the third one is what separates the empty <host> (defaults to localhost) from the path.

Sören
  • 1,803
  • 2
  • 16
  • 23