nice-france-74763
07/04/2021, 10:07 AMclick
but not astroid
, did I do something to confuse it?
2. I can't seem to run tests
Also any general "this is bad style" feedback is welcome, I'm unfamiliar with the library still and open to find out more. The ultimate goal is to release 3 pypi packages via a CI/CD pipeline once I'm done.nice-france-74763
07/04/2021, 3:52 PMenough-analyst-54434
07/04/2021, 4:06 PMPANTS_SHA=0182de9814c7694eed2b9407e3577684db26ea2e ./pants ...
is off in another thread.enough-analyst-54434
07/04/2021, 4:09 PM$ git diff
diff --git a/pants.toml b/pants.toml
index 3229711..a37c531 100644
--- a/pants.toml
+++ b/pants.toml
@@ -2,3 +2,6 @@
pants_version = "2.5.1rc3"
backend_packages = ["pants.backend.python"]
+
+[python-setup]
+interpreter_constraints = ["==3.9.*"]
I get:
$ $ PANTS_SHA=0182de9814c7694eed2b9407e3577684db26ea2e ./pants test modular_provider_architecture_definition/::
09:03:59.47 [INFO] Initializing scheduler...
09:03:59.62 [INFO] Scheduler initialized.
09:04:00.76 [WARN] Unmatched glob from python_architecture_linter:tests's `sources` field: "python_architecture_linter/**/test_*.py"
Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to (<https://www.pantsbuild.org/v2.6/docs/troubleshooting#pants-cannot-find-a-file-in-your-project>).
09:04:03.81 [INFO] Completed: Building requirements.pex with 1 requirement: astroid<3.0.0,>=2.5.8
09:04:06.90 [INFO] Completed: Building pytest.pex with 2 requirements: pytest-cov>=2.10.1,<2.12, pytest>=6.0.1,<6.3
09:04:07.96 [INFO] Completed: Building pytest_runner.pex
09:04:08.63 [WARN] Completed: test - modular_provider_architecture_definition/tests/test_definition.py:../tests failed (exit code 1).
============================= test session starts ==============================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/process-executionnzdAfn
plugins: cov-2.11.1
collected 1 item
modular_provider_architecture_definition/tests/test_definition.py F [100%]
=================================== FAILURES ===================================
_______________________________ test_definition ________________________________
def test_definition():
path = os.path.dirname(os.path.realpath(__file__)) + "/cases/modular_provider_architecture" # noqa: E501
linter = Linter(project_definition)
results = list(linter.lint(path))
> assert results == [
ValidationResult(
explanation="No issues found",
is_valid=True,
location=path + "",
validator="must_only_have_provider_in_module_root",
),
...
ValidationResult(
explanation="No issues found",
is_valid=True,
location=path + "/modular_provider_architecture/module_runtime/run.py",
validator="must_only_be_in_run_modules",
),
]
E AssertionError: assert [ValidationRe...module_root')] == [ValidationRe...method'), ...]
E Right contains 33 more items, first extra item: ValidationResult(explanation='No issues found', is_valid=True, location='/tmp/process-executionnzdAfn/modular_provider...0', validator='python_architecture_linter.ast_validators.nodeng_validator.validate_node_children_exclusive_allow_list')
E Use -v to get the full diff
modular_provider_architecture_definition/tests/test_definition.py:14: AssertionError
=========================== short test summary info ============================
FAILED modular_provider_architecture_definition/tests/test_definition.py::test_definition
============================== 1 failed in 0.25s ===============================
š modular_provider_architecture_definition/tests/test_definition.py:../tests failed.
That much looks legit I think.enough-analyst-54434
07/04/2021, 4:10 PMenough-analyst-54434
07/04/2021, 4:33 PMpoetry_requirements()
, it doesn't know which requirement to use (never mind that these reqs happend to be identical - Pants isn't peering that deep when doing dep inference). As such, as you discovered, you needed to add manual ':astroid'
dependencies.
2. Pants doesn't correctly special case the python
dependency. If you $ PANTS_SHA=0182de9814c7694eed2b9407e3577684db26ea2e ./pants repl python_architecture_linter::
things go boom trying to resolve the python
distribution.
3. Pants doesn't correctly special case path dependencies. Presumably as a result, your python_architecture_linter_cli/pyproject.toml
has to lie to appease Pants which presumably breaks Poetry since python_architecture_linter_cli
depends on python_architecture_linter
which Pants can infer but I'm pretty sure Poetry cannot.enough-analyst-54434
07/04/2021, 4:35 PMenough-analyst-54434
07/04/2021, 4:37 PMenough-analyst-54434
07/04/2021, 4:37 PM:astroid
dependencies in BUILD files.enough-analyst-54434
07/04/2021, 4:38 PMenough-analyst-54434
07/04/2021, 4:42 PMhappy-kitchen-89482
07/04/2021, 4:51 PMhappy-kitchen-89482
07/04/2021, 4:52 PMastroid
requirement was only defined once, there would be no ambiguity and Pants could infer the dependency automatically.happy-kitchen-89482
07/04/2021, 4:54 PMhappy-kitchen-89482
07/04/2021, 4:54 PMhappy-kitchen-89482
07/04/2021, 4:55 PMhappy-kitchen-89482
07/04/2021, 4:55 PMhappy-kitchen-89482
07/04/2021, 4:55 PMhappy-kitchen-89482
07/04/2021, 4:56 PMastroid
) where you don't have conflicts, you might as well list that req in just one place, and let Pants do the work for you.happy-kitchen-89482
07/04/2021, 4:56 PMenough-analyst-54434
07/04/2021, 5:02 PMenough-analyst-54434
07/04/2021, 5:03 PMnice-france-74763
07/04/2021, 5:57 PMA
uses features introduced in C v1.2.0
and B
uses features introduced C v1.3.0
I should not force A
in my monorepo to use C v1.3.0
just by chance that another "unrelated" package might want it. The direct dependency is on a feature set of v1.2.0 and not v1.3.0. I've been burned a lot in the past when I would do this kind of "everyone gets the latest" moves and release hundreds of modules that depend on the "latest". My customers would write me long emails asking why I forced them into superficial upgrades for no real reason, so now I don't opt for "this is an easy model for me, the author of the repo to think about" but I opt for "this is the set of software releases that permits the most users the easiest installations because the constraints reflect what is actually used, not what I wrote in the file". I can't do it if I keep everything in the monorepo on one level or at "latest since I last ran update"
The third diagram in a short post I wrote here explains a bit of the mental model I use when thinking about releasing packages: https://statagroup.com/articles/intuitive-guide-to-dependenciesenough-analyst-54434
07/04/2021, 7:04 PMenough-analyst-54434
07/04/2021, 7:08 PMenough-analyst-54434
07/04/2021, 7:09 PMnice-france-74763
07/04/2021, 7:15 PMhappy-kitchen-89482
07/05/2021, 6:24 AMenough-analyst-54434
07/05/2021, 10:53 PMpackage
goal on it), Brian wants to control the version range of exactly one of B's dependencies, the local project dependency on A. All the third-party dependencies just transfer over to the published package as written in pyproject.toml / inferred by Pants. This is in contrast to what Pants currently does, which is to pin B's dependency on A to the single version A has written down in its python_distribution
BUILD file target at the time of running the package
goal.hundreds-father-404
07/09/2021, 4:55 PMnice-france-74763
07/09/2021, 5:24 PM