adorable-plastic-34434
12/13/2024, 9:13 AMpants.toml
packages/
projA/
src/projA
tests/
pyproject.toml
setup.py
projB/
src/projB
tests/
pyproject.toml
setup.py
projC/
src/projC
tests/
pyproject.toml
setup.py
projB and projC depend on projA. I found https://github.com/jsirois/pants-issues-11118/tree/72b3d80283dcb66f80078201d474cc3fcef8cb6c and with that I could see that the tests are finding the package, meaning the tests of projA found projA at all. However, how do I now add third-party dependencies? My root patterns all look like this:
root_patterns = [
'/packages/projA/src',
'/packages/projA/tests',
...
]
The projects were all created with PyScaffold if that helps. It is basically a package generator https://pyscaffold.org/en/stable/usage.html
I would appreciate any help!elegant-florist-94385
12/13/2024, 11:18 AM3rdparty/python
directory at the root (ie. so it is global to all projects)
3. Create a requirements.txt (or pyproject.toml) in 3rdparty/python
4. Add your 3rd party dependencies (see link for details)
5. Import a dep from a source code file and it should work.
The idea is that you teach pants about your "universe of dependencies", and it will use dependency inference to make the 3rd party dependencies available to any source code that needs them.
This is probably the simplest approach, and it comes with the benefit that all your source projects will use the same versions of each library (but not be bloated by any libraries that are not used).
The downside is that if you have multiple projects that must use different versions of the same library (eg. a project using Django 3 and another using Django 4), this approach will not work, and you will need to look into "multiple resolves". It gets a bit more complicated, so I would only go there if you really need it.elegant-florist-94385
12/13/2024, 11:20 AMadorable-plastic-34434
12/18/2024, 12:34 PM