I have the following ```python_sources( sourc...
# general
s
I have the following
Copy code
python_sources(
    sources=[
        "*.py",
        "!test_*.py",
        "!*_test.py",
        "!tests.py",
        "!conftest.py",
        "!test_*.pyi",
        "!*_test.pyi",
        "!tests.pyi",
        "!settings.py",
    ]
)

python_source(
    name="settings",
    source="settings.py",
    dependencies=[...]
)
and in my tests I have a dependency on
project/src/foo/settings.py
. When I run `pants test
project/::
I get the error
Copy code
ValueError: The explicit dependency `project/src/foo/settings.py` of the target at `project/tests/test_dummy.py` does not provide enough address parameters to identify which parametrization of the dependency target should be used.

Target `project/src/hydra:hydra` can be addressed as:
  * project/src/foo:foo
  * project/src/foo/__init__.py
  * project/src/foo/asgi.py
  * project/src/foo/urls.py
  * project/src/foo/wsgi.py
  ...
When I check
pants peek project/src/foo/settings.py
, it only returns one dict (I guess one address?). Now referencing the file as
project/src/foo/settings.py:settings
works, but why do I need to do that? Edit - Clarify problem and question
c
There is no good way currently to declare file level targets in BUILD files that will behave the same as what you get from a target generator, such as the
python_sources
that produce a
python_source
target for each file. So generated file level targets you can address by their filename alone, but for any file level target you explicitly declare yourself directly need to include the target name, as you discovered. Quirky and not ideal. Just what it is, for now. 🤷