plain-night-5132401/05/2023, 12:13 AM
to work: Got errors that it can’t find 3rd party libraries like sqlalchemy, google.protobuf, factory (see inside)
./pants test <single-file>
Alternatively, you can remove the ambiguity by deleting/changing some of the targets so that only 1 target owns this module. Refer to <https://www.pantsbuild.org/v2.14/docs/troubleshooting#import-errors-and-missing-dependencies>. 16:10:48.37 [WARN] Pants cannot infer owners for the following imports in the target common/application/models.py: * sqlalchemy.Boolean (line: 8) * sqlalchemy.Column (line: 8) * sqlalchemy.DateTime (line: 8) * sqlalchemy.String (line: 8) * sqlalchemy.dialects.postgresql.JSON (line: 9) * sqlalchemy.dialects.postgresql.UUID (line: 9) * sqlalchemy.func (line: 8) If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see <https://www.pantsbuild.org/v2.14/docs/troubleshooting#import-errors-and-missing-dependencies> for common problems. 16:10:48.37 [WARN] Pants cannot infer owners for the following imports in the target <>/proto/tfdv_pb2.py: * google.protobuf.descriptor (line: 6) * google.protobuf.internal.enum_type_wrapper (line: 5) * google.protobuf.message (line: 7) * google.protobuf.reflection (line: 8) * google.protobuf.symbol_database (line: 9)
ImportError while loading conftest '/private/var/folders/xz/gwhmgmz14510pl52tgmhdl740000gn/T/pants-sandbox-YH9TnA/common/conftest.py'. common/conftest.py:8: in <module> import factory E ModuleNotFoundError: No module named 'factory'
broad-processor-9240001/05/2023, 12:17 AM
or one of the generators, from a
), and will then infer which files use them. https://www.pantsbuild.org/docs/python-third-party-dependencies has more docs
plain-night-5132401/05/2023, 12:27 AM
and the test is in common/foo/tests/test_foo.py I also took out the first base-requirements.txt and to make sure and still have the same error
python_sources() python_requirements( name="reqs", source="base-requirements.txt", ) python_requirements( name="reqs0", )
, saw some first party files. not sure how to check if any 3rd party dependencies are installed there
broad-processor-9240001/05/2023, 12:31 AM
plain-night-5132401/05/2023, 12:31 AM
[python] tailor_pex_binary_targets = false enable_resolves = true
./pants dependencies common/foo/tests/test_foo.py
so thats probably why..
16:39:31.68 [INFO] Initializing scheduler... 16:39:31.95 [INFO] Scheduler initialized. 16:39:38.45 [WARN] The target common/foo/tests/test_foo.py:tests0 imports `grpc`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['…']. Please explicitly include the dependency you want in the `dependencies` field of common/foo/tests/test_foo.py:tests0, or ignore the ones you do not want by prefixing with `!` or `!!` so that one or no targets are left. Alternatively, you can remove the ambiguity by deleting/changing some of the targets so that only 1 target owns this module. Refer to <https://www.pantsbuild.org/v2.14/docs/troubleshooting#import-errors-and-missing-dependencies>.
broad-processor-9240001/05/2023, 12:44 AM
are being imported into pants multiple times? Are they listed in multiple requirements.txt files?
plain-night-5132401/05/2023, 12:44 AM
broad-processor-9240001/05/2023, 12:50 AM
that specifies all dependencies, and then subprojects like
that don't have their own requirements.txt. If you're migrating an existing codebase to pants, I think you can leave the individual-project
where they are without a
(and use https://www.pantsbuild.org/docs/reference-python#tailor_requirements_targets to ensure
doesn't add them), and have a single top-level requirements.txt that is imported via
./pants tailor ::
. (This is what we did for our migration.) Alternatively, a path that seems to be harder would be to have a separate 'resolve' per sub-project (https://www.pantsbuild.org/docs/python-third-party-dependencies#multiple-lockfiles).
plain-night-5132401/05/2023, 12:51 AM