hundreds-father-404
09/22/2021, 6:45 AMPants 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-6568
09/22/2021, 7:10 AMPants 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 standardmodule_mapping
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.My-distribution
hundreds-father-404
09/22/2021, 7:16 AMPants handles dependencies with more precision than Python projects solely using workflows likeor Poetry.virtualenv
curved-television-6568
09/22/2021, 7:24 AMPants 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
virtualenv
scenario kind of covers what Poetry does, too.. it felt a bit the same..)hundreds-father-404
09/22/2021, 7:25 AMcurved-television-6568
09/22/2021, 7:26 AMWarning: 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-404
09/22/2021, 7:32 AM--find-links
, which we do supportcurved-television-6568
09/22/2021, 7:34 AMHowever, due to how thegoal works, it will only capture 3rdparty dependencies specified outside./pants dependencies
requirements.txt
./pants dependencies --type=3rdparty
hundreds-father-404
09/22/2021, 7:36 AMUnless the dependency was specified in requirements.txt, Pants will only capture it if it is actually used by your code.
curved-television-6568
09/22/2021, 7:36 AMShell
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), setrequirements.txt
requirements_relpath=
hundreds-father-404
09/22/2021, 7:47 AMOh, 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
BUILD
tab for requirements.txt
?curved-television-6568
09/22/2021, 7:49 AMhundreds-father-404
09/22/2021, 7:59 AM--find-links
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-22786
09/22/2021, 8:42 PMhappy-kitchen-89482
09/22/2021, 10:27 PMpython
Pants handles dependencies with more precision than Python projects solely using workflows like requirements.txt or Poetry.
This could read as "Pants achieves X solely [by] 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.
requirements.txt
, set requirements_relpath=
, e.g. requirements_relpath="reqs.txt"
." Should show a full example, otherwise this is unclear ("set what on what?")hundreds-father-404
09/23/2021, 5:20 AMi 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
generate-lockfiles
goal too
3) I needed one central place to explain all the nuance of tool lockfiles so that linters page, test
page, and typeheck
page could all link to it. This seemed the bestcurved-television-6568
09/23/2021, 7:40 AM[flake8]
version = "flake8==3.8.0"
Does it have to be with the project name included, or does it work with just version="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-404
09/24/2021, 5:00 PMI can see the benefit of allowing the name in there, in case you want to use a forkThat is exactly the reason
happy-kitchen-89482
09/24/2021, 6:29 PMcurved-television-6568
09/24/2021, 6:32 PMhundreds-father-404
09/24/2021, 6:35 PMOr 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
[pytest]
requirements = ["pytest==6.4.3", "pytest-cov>=5"]
that was a common gotcha that people would forgot to include pytest-cov
, and it's not as easy as:
[pytest]
version = "pytest==6.4.3"
happy-kitchen-89482
09/24/2021, 6:41 PMhundreds-father-404
09/24/2021, 7:28 PMhappy-kitchen-89482
09/24/2021, 8:08 PMhundreds-father-404
09/24/2021, 8:09 PM