hundreds-father-40409/22/2021, 6:45 AM
Pants handles dependencies with more precision than Python projects solely using workflows like requirements.txt or Poetry. Whereas normally you have a single virtual environment, Pants understands precisely which third-party dependencies each file in your project useshttps://www.pantsbuild.org/v2.7/docs/third-party-dependencies-rewrite. Feedback welcomed!
curved-television-656809/22/2021, 7:10 AM
Pants handles dependencies with more precision than Python projects using workflows like requirements.txt …Leads me to believe that Pants does not use requirements.txt at all, and as such, it is confusing when I later read about using requirements.txt files to teach Pants my universe of dependencies. Perhaps make it clear(er) that using requirements.txt is an optional method of telling about my dep universe.
UsePerhaps, “.. when the module name is not standard”, as it is the naming of the module, not the module itself, that is considered here. I understand the heading is rather long already.when the module is not standard
i.e.The conclusion here is unclear what it refers to, as it seems contradictory (I know, but if I didn’t, this could be confusing)exposes the module `my_distribution`—so those dependencies may not be inferred.
hundreds-father-40409/22/2021, 7:16 AM
Pants handles dependencies with more precision than Python projects solely using workflows likeor Poetry.
curved-television-656809/22/2021, 7:24 AM
Pants handles dependencies with more precision than Python projects solely using workflows requirements.txt or Poetry.actually, just adding the word “solely” in the original sentence, makes it a lot better. No need to get rid of requirements.txt there (as I see the
scenario kind of covers what Poetry does, too.. it felt a bit the same..)
hundreds-father-40409/22/2021, 7:25 AM
curved-television-656809/22/2021, 7:26 AM
Warning: multiple targets for the same dependencytargets here feels like implementation detail, and hides what we want to say. How about:
Warning: multiple versions of the same dependency
hundreds-father-40409/22/2021, 7:32 AM
, which we do support
curved-television-656809/22/2021, 7:34 AM
However, due to how thegoal works, it will only capture 3rdparty dependencies specified outside
./pants dependencies --type=3rdparty
hundreds-father-40409/22/2021, 7:36 AM
Unless the dependency was specified in requirements.txt, Pants will only capture it if it is actually used by your code.
curved-television-656809/22/2021, 7:36 AM
tab, cool as it is, is also very low tech (absolutely worth mentioning), however, I feel that the “this macro, when expanded is equivalent to these targets (in BUILD file syntax)” are more helpful.
If the file uses a different name thanThe same applies for poetry, so may as well have one there as well (in case you jump to the relevant section and miss it), set
hundreds-father-40409/22/2021, 7:47 AM
Oh, I missed this in the first read through, the Shell tab, cool as it is, is also very low tech (absolutely worth mentioning), however, I feel that the “this macro, when expanded is equivalent to these targets (in BUILD file syntax)” are more helpful.Oh great point! Reload the page. What do you think about having both the macro call and "this is equivalent to" in the
curved-television-656809/22/2021, 7:49 AM
hundreds-father-40409/22/2021, 7:59 AM
stuff) cc @witty-crayon-22786 and @ancient-vegetable-10556 if you have feedback on the lockfile section in particular: https://www.pantsbuild.org/v2.7/docs/third-party-dependencies-rewrite#lockfiles cc @happy-kitchen-89482, given that you wrote a lot of the original docs and thank you @curved-television-6568 🙌
witty-crayon-2278609/22/2021, 8:42 PM
happy-kitchen-8948209/22/2021, 10:27 PM
This could read as "Pants achieves X solely [by] using workflows like requirements.txt or Poetry"
Pants handles dependencies with more precision than Python projects solely using workflows like requirements.txt or Poetry.
Pants handles dependencies with more precision than traditional Python workflows.
With traditional Python workflows you typically have a single heavyweight virtual environment that includes a large set of dependencies, whether or not you actually need them for your current task. But Pants understands exactly which dependencies every file in your repo needs, and can efficiently use just that subset of dependencies.
." Should show a full example, otherwise this is unclear ("set what on what?")
hundreds-father-40409/23/2021, 5:20 AM
i have a vague sense that the “Tool Lockfiles” aspect doesn’t belong on that page though… because the page itself is about user’s requirements, in general?1) Agreed 2) I think it will fit better when user lockfile uses the
goal too 3) I needed one central place to explain all the nuance of tool lockfiles so that linters page,
page could all link to it. This seemed the best
curved-television-656809/23/2021, 7:40 AM
Does it have to be with the project name included, or does it work with just
[flake8] version = "flake8==3.8.0"
as well? I can see the benefit of allowing the name in there, in case you want to use a fork, or what not, but my first attempt would be without if I were not going for that..
hundreds-father-40409/24/2021, 5:00 PM
I can see the benefit of allowing the name in there, in case you want to use a forkThat is exactly the reason
happy-kitchen-8948209/24/2021, 6:29 PM
curved-television-656809/24/2021, 6:32 PM
hundreds-father-40409/24/2021, 6:35 PM
Or there might be multiple requirements (such as plugins for the tool), I think that can be a list no?That's the extra_requirements option --
. “requirement(s)” would perhaps be better..?We used to use this. The reason we split it out is that it's common for Pants to have default extra_requirements, like pytest-cov for Pytest. It's impossible to override a single element from the default, you have to replace the whole list if you want to change its value. So let's say you want a new Pytest version but are fine with default pytest-cov. Then you would have to do this
that was a common gotcha that people would forgot to include
[pytest] requirements = ["pytest==6.4.3", "pytest-cov>=5"]
, and it's not as easy as:
[pytest] version = "pytest==6.4.3"
happy-kitchen-8948209/24/2021, 6:41 PM
hundreds-father-40409/24/2021, 7:28 PM
happy-kitchen-8948209/24/2021, 8:08 PM
hundreds-father-40409/24/2021, 8:09 PM