0

I am using a library I control. I would quite like to include this library and its dependencies in an app that uses setup.py. And would prefer not to go through git of pypi or my own package repository.

Would it be possible to point the app's setup.py at a directory where that directory has its own setup.py using install_requires? It isn't discussed in the setuptools document - but I'm suspicious that this documentation is written for discoverability rather than completeness - as the cool kids do noweredays. I seem to remember doing this with requirements.txt before but I am trying to use raw setup.py here.

Here is a diagram of the file structure:

/library # the library is guaranteed to be at /library - docker
   library.py
   setup.py
/app
   # this uses library
   setup.py() <- I want this to install library from /library
   app.py
Att Righ
  • 1,439
  • 1
  • 16
  • 29
  • 1
    pip install -e directoryname (heading out so if you need more, it might be a day or two) – Kenny Ostrom Oct 26 '22 at 18:38
  • Thanks for the suggestion I want to put this in `setup.py` (using `install_requires`) if possible. I also need to resolve dependencies between my library and the othe dependencies of the apps `setup.py`. I know that `-e /dir` works in `requirements.txt` - which is what I've done before. I've clarified the question. – Att Righ Oct 26 '22 at 18:40
  • so it's a module inside a module and you want them both installed from the top level setup file. Is that anything like https://stackoverflow.com/questions/21197347/setup-py-inside-installed-module – Kenny Ostrom Oct 27 '22 at 18:22
  • @KennyOstrom Well it's an app that uses a library that I don't want to install "properly" (i.e. using pypi or git) but innstead want to be at a known location on my machine like `/library`. – Att Righ Oct 27 '22 at 22:11
  • Okay, now I'm confused. It's in the folder already, so it's in your module already. If you do not want to install it as a separate module, you don't have to do anything. Maybe your question should include a little more of the layout? – Kenny Ostrom Oct 28 '22 at 01:17
  • Yeah... it appears so. Let me draw a diagram. There are specifics about docker containers that I'm hiding because they potentially distract from the question and encourage people to declare this an XY problem - which is why everything isn't in directory. – Att Righ Oct 28 '22 at 16:12
  • 1
    I set up a similar layout and didn't find a quick solution yesterday, but I did note that using setup is deprecated. This would be a lot easier with a requirements file. – Kenny Ostrom Oct 31 '22 at 14:27
  • I don't think `setup` is exactly deprecated and setuptools certainly isn't (since more or or less have pip = setuptools = setup) People want you to use `pip install .` [instead](https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html) of `setup.py install .`. There's also [pyproject.toml](https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html). Yeah, this is supported in requirements (e.g. [this](https://stackoverflow.com/questions/35064426/when-would-the-e-editable-option-be-useful-with-pip-install)). My code using setuptools tho... – Att Righ Nov 01 '22 at 12:03

0 Answers0