6

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there any way to this dynamically?. I mean something like my_package @ file:///{PATH_to_PACKAGE}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.