rough-rain-21579
01/26/2024, 7:29 PMwide-midnight-78598
01/26/2024, 7:32 PMrough-rain-21579
01/26/2024, 7:49 PMwide-midnight-78598
01/26/2024, 7:53 PMrough-rain-21579
01/26/2024, 7:56 PMwide-midnight-78598
01/26/2024, 8:30 PMcold-jackal-89755
01/26/2024, 9:07 PMwide-midnight-78598
01/26/2024, 11:12 PMfresh-cat-90827
01/28/2024, 10:10 PMapt install python3-apt
you'll be able to do import apt
in your Python code that has access to the system site-packages
.
If you only want Pants to understand the imports in your code and not throw an
UnownedDependencyError: Pants cannot infer owners for the following imports in the target
when it finds import apt
, then you could either ignore it with pants: no-infer-dep
pragma or abuse the default python_requirement
target:
python_requirement(
name="python-requirement",
modules=[
"apt",
],
requirements=[
"python3-apt",
],
tags=[
"debian-package",
],
)
this will let Pants link the import apt
to this package so you can reason about it.
However, you won't be able to install those packages which is necessary if you'd like to do pants run
or pants test
. This is because Pants won't be able to install a system dependency into a sandbox where a goal process is running.
If that's what you want, then you would need to extend Pants to provide support for Debian packages to be used as Python requirements so they are treated in the same way a Python requirement distributed via a Python wheel would. One way to achieve this would be to instruct Pants to bring system packages along when creating a virtual environment in a sandbox, so that all the Debian packages present in the runtime environment would be available in the sandbox virtual environment as well.
Even though Pants is all about hermetic environments and having resources external to this hermetic sandbox would violate its principles, one can decide not to attempt to reproduce an "isolated" virtual environment and instead extend Pants to run tests with access to all (or some) system resources accessible on PATH
.fresh-cat-90827
01/28/2024, 10:13 PMrough-rain-21579
04/03/2024, 4:49 PMrough-rain-21579
04/09/2024, 10:53 PMpython_requirement(
name="ros-noetic",
modules=[
"apt",
],
requirements=[
"python3-apt",
],
tags=[
"ros-noetic-ros-base",
],
)
but I get the following error when I run `pants generate-lockfiles`:
ERROR: Could not find a version that satisfies the requirement python3-apt (from versions: none)
ERROR: No matching distribution found for python3-apt
I understand the error but I do not know why. What is/is not pants looking for?fresh-cat-90827
04/09/2024, 10:55 PMpython3-apt
PyPI package which is what Pants telling you in
ERROR: Could not find a version that satisfies the requirement python3-apt (from versions: none)
ERROR: No matching distribution found for python3-apt
fresh-cat-90827
04/09/2024, 10:56 PMfresh-cat-90827
04/09/2024, 10:57 PMimport apt
because user knows that python3-apt
installed in the build environment will provide this module (given PEX will have access to the extra system path, if apt
module is not on a path already in the PATH
)rough-rain-21579
04/11/2024, 12:51 PM