flaky-artist-57016
09/11/2024, 8:30 PMpyproject.toml
. I can pip install -e mypackage
successfully. I have added an entry to my <http://requirements.in|requirements.in>
(e.g., file:mypackage
) and pip-compile
resolves dependencies and produces a requirements.txt
that also contains a file:mypackage
entry. I can run pip install -r requirements.txt
successfully.
When I run pants goals such as pants dependencies
, pants raises the following error:
ValueError: Invalid requirement 'file:mypackage' in requirements.txt at line 705: Parse error at "':mypacka'": Expected string_end
Is it possible to include a local requirement this way? The docs [here](https://www.pantsbuild.org/2.18/docs/python/overview/third-party-dependencies#local-requirements) indicate that .whl or sdist are required or is there another solution?
(apologies if this has already been answered, search didn’t seem to return any relevant results)flaky-artist-57016
09/11/2024, 9:14 PMflaky-artist-57016
09/11/2024, 9:21 PM<http://requirements.in|requirements.in>
to include just ./mypackage
(without file:
), pip-compile
generates a requirements.txt
that contains file:///absolute/path/to/project
that pants infers as a dependency.
I am now looking for a solution to pip-compile
compiling a relative path to an absolute path which isn’t portable… (here’s the rabbit hole: https://github.com/jazzband/pip-tools/issues/204)broad-processor-92400
09/16/2024, 12:06 AMrequirements.txt
of package B, just from A import whatever
and let Pants' dependency inference handle that.
For instance, in my work repo, we have a few different "packages" that we import from, but only one top-level pyproject.toml
that only defines the third-party (i.e. from PyPI) dependencies, no internal ones.
Does that sound like it might work for you?flaky-artist-57016
09/16/2024, 1:42 PMsrc
layout etc.broad-processor-92400
09/16/2024, 3:55 PMpath/to/src/A
with imports like from A import ...
then making sure path/to/src
is a source root should satisfy that. (root_patterns = ["src"]
would be one approach)flaky-artist-57016
09/16/2024, 3:56 PM