I'm having some trouble running a goal after I add...
# general
b
I'm having some trouble running a goal after I added sources related to type checking. My
src/services/app/BUILD
currently looks like this:
Copy code
python_sources(
    name="app_sources",
    sources=[
        "mypy-stubs/stub1.pyi",
        "mypy-stubs/stub2.pyi",
    ]
)

pex_binary(
    name="app",
    entry_point="main.py",
    dependencies=[
        "src/vendor/python:reqs#setuptools",
    ],
    restartable=True,
)
With this definition,
./pants run src/services/app:app
, I get
ModuleNotFoundError: No module named 'services'
. When I remove the stubs from
python_sources
, the run command works fine, except then type checking fails. With this definition,
./pants dependencies
also doesn't show anything - it's as if adding the stubs completely negates any other dependencies. Clearly I've defined things wrong, but I can't seem to find how.
b
By providing sources, you're overriding the default, so you probably wanna add those back in
b
Didn't realize it overrode the defaults, thanks!
b
I've been meaning to PR the defaults as an attribute of the target itself, but havent gotten to it
(e.g.
python_sources.sources.default
(or something)
🙌 1
w
This is one of those principles of least surprise (ditto for default args). I don't know which is more surprising. In this case, I wouldn't assume defaults to apply, because you're setting the array. But in some of the
args
examples, I'm less certain and am usually surprised by the result
b
@hundreds-father-404 and I wanna eventually rename
dependencies
as thats the only field where you're augmenting and not overriding
âž• 1
w
? How so
At input time, are there other dependencies?
b
Well, you're augmenting with the dep inference
It's... fuzzy 🙂
w
I'd say that's after input time though. You're not overriding defaults, and it's non-destructive. 🤷
h
yeah, I really wanted to rename to
additional_deps
but got stuck on the
overrides
field not being automatically updated via our automated fixers. (Old name would still work, only deprecated)
https://github.com/pantsbuild/pants/issues/15022 if anyone is interested in taking on some AST fun 🙂
w
I think we use
extra
in other places, but 🤷 I think "additional_deps" would confuse me
b
I think one proposal was
explicit_deps
âž• 2