cold-vr-15232
10/23/2022, 11:58 AMapps
├── demo_app
│ ├── BUILD
│ ├── pyproject.toml
│ ├── src
│ │ └── demo_app
│ │ ├── BUILD
│ │ ├── __init__.py
│ │ ├── main.py
│ │ └── model.py
│ └── tests
│ ├── BUILD
│ ├── test_demo_app_main.py
│ └── util.py
and the roots are
apps/demo_app/src
apps/demo_app/tests
cold-vr-15232
10/23/2022, 12:07 PMenough-analyst-54434
10/23/2022, 12:39 PMcold-vr-15232
10/23/2022, 12:41 PMwide-midnight-78598
10/23/2022, 12:53 PMmypy
- as I mentioned in another thread, like 90-95% of my mypy problems were solved with init.py's or using namespace packages.
Not suggesting blindly that will work here, but it's been my Pants mypy go-towide-midnight-78598
10/23/2022, 12:57 PMWhile it's interesting to get through the process of figuring it out oneself, it is a lot of wasted time if everyone has to do that, and it might scare off newcomersI agree with this sentiment - personally, I want to figure out how to solve these kinda things so that when they inevitably crop up again, I know where to start. But, if it's something that only crops up once every few months, then 🤷 The other side is - as interesting as it may be, fiddling with a build system isn't revenue-generating...
bitter-ability-32190
10/23/2022, 1:22 PMtest_foo.py
next to foo.py
) and we don't have any issueswide-midnight-78598
10/23/2022, 1:29 PMcold-vr-15232
10/23/2022, 1:30 PMbitter-ability-32190
10/23/2022, 1:41 PM./pants dependencies <target or file>
cold-vr-15232
10/23/2022, 2:00 PMwide-midnight-78598
10/23/2022, 2:04 PMpytest
(and I think mypy
and other tools) will happily run against tests next to code. That's how I've been running everything in the pre-pants years.wide-midnight-78598
10/23/2022, 2:05 PMwide-midnight-78598
10/23/2022, 2:07 PMI suppose pants recognizes that and doesn't package test file in the binaryI think I missed this - in your
BUILD
, if you have python_sources
and python_tests
- you're fine. As Josh mentioned, unless you actively import test code (either in your .py
files or your dependencies
field in BUILD), it won't/shouldn't be packaged