happy-kitchen-89482
08/20/2021, 2:16 PMhundreds-father-404
08/20/2021, 3:52 PMhappy-kitchen-89482
08/20/2021, 8:16 PMbusy-vase-39202
08/21/2021, 12:46 AMnarrow-vegetable-37489
08/21/2021, 9:44 PMmongomock
) that requires setuptools
to work, but it isn't defined as a requirement and thus not added to the pex by Pants. Right now I work around it by explicitly adding setuptools
as a dependency to all the python_library()
with code that uses mongomock
, but it would be nice if I somehow could tell Pants to always pull in setuptools
when something wants mongomock
.happy-kitchen-89482
08/23/2021, 12:15 AMpath/to/dir
on the cmd line or in BUILD target dependencies
is currently shorthand for path/to/dir:dir
. These are legacies from v1. However in v2's file-centric world, we want path/to/dir
on the cmd line to mean "all the files under `path/to/dir`" (this is what it means for pretty much every underlying tool). And, in that proposed future, we're pondering what path/to/dir
should mean in BUILD target dependencies
. Basically, we're wondering about how to get from here to there, and how much deprecation to do. This affects existing users, so we welcome your opinions: https://github.com/pantsbuild/pants/issues/12286eager-dress-66405
08/23/2021, 6:05 PM[pytest]
pytest_plugins.add = [
"pytest-django",
in my pants.toml
all the non django tests complain about not finding django settingsuser
08/23/2021, 8:25 PMuser
08/23/2021, 10:33 PMaverage-australia-85137
08/24/2021, 5:54 PMbusy-vase-39202
08/24/2021, 8:38 PMwitty-crayon-22786
08/24/2021, 9:12 PMuser
08/25/2021, 12:54 AMquick-translator-54728
08/25/2021, 2:22 PMpolite-angle-19513
08/25/2021, 3:49 PM__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
However, in a simplified pants-test setup I cannot pants to do what I think it ought too.
It's been a very frustrating and quite time consuming attempt to adopt Pants. I feel like I'm so close to a working setup and then no matter what I do it seems to work as expected in many ways and then falls over in others. (And vice versa when I setup with PEP420; mypy works in all and pylint fails - opposite to the pkgutil namespace setup).
The Pants docs, while referencing namespace packages, wasn't enough for me to glean the best way.
Maybe another monorepo user might have some wisdom on the matter? (TY)
.
βββ mypy.ini
βββ pants
βββ pants.toml
βββ pylintrc
βββ pyproject.toml
βββ src
βββ python
βββ hankai-dep (depends hankai-util)
β βββ BUILD
β βββ hankai
β β βββ init.py
β β βββ dep
β β βββ init.py
β β βββ dep.py
β βββ poetry.lock
β βββ poetry.toml
β βββ pyproject.toml
β βββ requirements.txt
βββ hankai-util (independent)
βββ BUILD
βββ hankai
β βββ init.py
β βββ util
β βββ init.py
β βββ util.py
βββ poetry.lock
βββ poetry.toml
βββ pyproject.toml
βββ requirements.txt
hankai-util is independent, hankak-dep is dependent on hankai-util
src/python/hankai-util/BUILD
python_requirements()
python_library(
name="lib",
dependencies=[
":loguru",
":pydantic",
],
sources=[
"hankai/**/*.py",
]
)
src/python/hankai-dep/BUILD
python_requirements()
python_library(
name="lib",
dependencies=[
":loguru",
":pydantic",
"src/python/hankai-util:lib",
],
sources=[
"hankai/**/*.py",
]
)
---------------------- LIST
./pants list ::
src/python/hankai-dep:colorama
src/python/hankai-dep:dist
src/python/hankai-dep:lib
src/python/hankai-dep:loguru
src/python/hankai-dep:pydantic
src/python/hankai-dep:requirements.txt
src/python/hankai-dep:typing-extensions
src/python/hankai-dep:win32-setctime
src/python/hankai-util:colorama
src/python/hankai-util:dist
src/python/hankai-util:lib
src/python/hankai-util:loguru
src/python/hankai-util:pydantic
src/python/hankai-util:requirements.txt
src/python/hankai-util:tqdm
src/python/hankai-util:typing-extensions
src/python/hankai-util:win32-setctime
---------------------- DEPENDENCIES/DEPENDEES
./pants dependencies ::
src/python/hankai-dep/hankai/__init__.py:../lib
src/python/hankai-dep/hankai/dep/__init__.py:../../lib
src/python/hankai-dep/hankai/dep/dep.py:../../lib
src/python/hankai-dep:loguru
src/python/hankai-dep:pydantic
src/python/hankai-dep:requirements.txt
src/python/hankai-util/hankai/__init__.py:../lib
src/python/hankai-util/hankai/util/__init__.py:../../lib
src/python/hankai-util/hankai/util/util.py:../../lib
src/python/hankai-util:dist
src/python/hankai-util:loguru
src/python/hankai-util:pydantic
src/python/hankai-util:requirements.txt
./pants dependencies src/python/hankai-_dep_:lib
src/python/hankai-dep/hankai/__init__.py:../lib
src/python/hankai-dep/hankai/dep/__init__.py:../../lib
src/python/hankai-dep/hankai/dep/dep.py:../../lib
src/python/hankai-dep:loguru
src/python/hankai-dep:pydantic
src/python/hankai-util/hankai/__init__.py:../lib
src/python/hankai-util/hankai/util/__init__.py:../../lib
src/python/hankai-util/hankai/util/util.py:../../lib
./pants dependencies src/python/hankai-util:lib
src/python/hankai-util/hankai/__init__.py:../lib
src/python/hankai-util/hankai/util/__init__.py:../../lib
src/python/hankai-util/hankai/util/util.py:../../lib
src/python/hankai-util:loguru
src/python/hankai-util:pydantic
./pants dependees src/python/hankai-util:lib
src/python/hankai-dep:lib
src/python/hankai-dep/hankai/__init__.py:../lib
src/python/hankai-dep/hankai/dep/__init__.py:../../lib
src/python/hankai-dep/hankai/dep/dep.py:../../lib
src/python/hankai-util:dist
---------------------- LINT
*./pants lint :: (*Successful)
./pants lint src/python/hankai-util:lib (Successful)
./pants lint src/python/hankai-dep:lib (FAILS) - Expected that the hankai-util deps would be referenced since ./pants knows about them as shown above.
src/python/hankai-dep/hankai/dep/dep.py20: E0611: No name 'util' in module 'hankai' (no-name-in-module)
src/python/hankai-dep/hankai/dep/dep.py20: E0401: Unable to import 'hankai.util' (import-error)
src/python/hankai-dep/hankai/dep/dep.py158: E1101: Module 'hankai' has no 'util' member (no-member)
./pants lint src/python/hankai-dep:lib src/python/hankai-util:lib (Successful) - But I expected the explicit dependency to be used and to not have to directly reference it.
---------------------- TYPECHECK
./pants typecheck :: (FAILS) - I'm not doing PEP420. Using pkgutil namespace packaging. How am I supposed to use pants with any form of namespace package support??
src/python/hankai-util/hankai/__init__.py: error: Duplicate module named
"hankai" (also at "src/python/hankai-dep/hankai/__init__.py")
src/python/hankai-util/hankai/__init__.py: note: Are you missing an init.py? Alternatively, consider using --exclude to avoid checking one of them.
Found 1 error in 1 file (errors prevented further checking)
./pants typecheck src/python/hankai-util:lib (Successful)
./pants typecheck src/python/hankai-dep:lib (FAILS) - Expected the hankai-util deps would be referenced since ./pants knows about them as shown above.
src/python/hankai-dep/hankai/dep/dep.py21: error: Cannot find implementation
or library stub for module named "hankai.util" [import]
import hankai.util
^
src/python/hankai-dep/hankai/dep/dep.py21: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 3 source files)
./pants typecheck src/python/hankai-dep:lib src/python/hankai-util:lib (FAILS) as before with ::
src/python/hankai-util/hankai/__init__.py: error: Duplicate module named
"hankai" (also at "src/python/hankai-dep/hankai/__init__.py")
src/python/hankai-util/hankai/__init__.py: note: Are you missing an init.py? Alternatively, consider using --exclude to avoid checking one of them.
Found 1 error in 1 file (errors prevented further checking)
============================================
I feel like I'm so close to a working but am just not getting there.
Maybe another monorepo user might have some wisdom on the matter?
Thank you all for your consideration and help.user
08/25/2021, 4:20 PMeager-dress-66405
08/25/2021, 4:23 PM[test]
output = "failed"
./pants test src/clr_commands/tests/test_data.py -- -v
09:19:08.63 [INFO] Initializing scheduler...
09:19:08.96 [INFO] Scheduler initialized.
π src/clr_commands/tests/test_data.py failed.
Without changing anything, just repeating the command:
./pants test src/clr_commands/tests/test_data.py -- -v
09:19:52.63 [INFO] Initializing scheduler...
09:19:52.92 [INFO] Scheduler initialized.
09:20:23.48 [WARN] Completed: test - src/clr_commands/tests/test_data.py failed (exit code 2).
============================= test session starts ==============================
platform linux -- Python 3.6.14, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /home/mpcusack/.cache/pants/named_caches/pex_root/venvs/short/c0a2e079/bin/python3.6
cachedir: .pytest_cache
rootdir: /tmp/process-execution1bzNig, configfile: pyproject.toml
plugins: circleci-parallelized-0.0.4, profiling-1.7.0, celery-4.4.7, cov-2.11.0, ddtrace-0.48.0
collecting ... collected 0 items / 1 error
==================================== ERRORS ====================================
_____________ ERROR collecting src/clr_commands/tests/test_data.py _____________
...truncated...
π src/clr_commands/tests/test_data.py failed.
witty-crayon-22786
08/25/2021, 6:08 PMbusy-vase-39202
08/25/2021, 8:16 PMuser
08/25/2021, 9:19 PMhttps://pbs.twimg.com/media/E9qoVPzXIAcXeh7.jpgβΎ
user
08/25/2021, 10:58 PMuser
08/25/2021, 11:27 PMclean-night-52582
08/26/2021, 12:06 AM./pants run
. I'm trying to run a command that has an argument that has spaces in it, e.g ./pants run someting:script -- --message 'add new Column'
and it will fail when running since it assumes new Column
aren't part of the same string. It says that there are no commands new or Column
. My assumption is that it's related to shell string parsing so there might not be a good solution. Works correctly when doing ./pants package someting:script && ./dist/script.pex --message 'add new Column'
user
08/26/2021, 12:30 AMambitious-actor-36781
08/26/2021, 7:14 AMpyzmq
(presumably before, it was using binaries)
Have a constraints file, no other changes.
kinda baffledcurved-television-6568
08/26/2021, 9:50 AMpoetry export
I get strange ICs.user
08/26/2021, 4:09 PMrapid-bird-79300
08/26/2021, 4:18 PMapp/example::
)?witty-crayon-22786
08/26/2021, 4:53 PMhundreds-father-404
08/27/2021, 1:48 AM