-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misleading description of poetry #506
Comments
Thanks, @sdispater - do you have any specific wording you'd like to suggest that we use when linking to poetry? |
The config file for poetry is The reason Historically that distinction was framed as The folks most likely to find that choice inconvenient are those that would prefer to define everything in |
@ncoghlan Thanks for your detailed explanation. I understand the distinction the PyPA makes about the two files, but the way it's written leads to believe that the workflow Also, it seems to me that this separation puts the Python ecosystem in the minority. Most of the other languages use one single configuration file (with an associated lock file): |
Honestly, it's not even really about which file it goes in, you could implement It really comes down to abstract vs concrete dependencies, and for the developing library use case extra dependencies which are not part of the dependency of my library. Not to "pick" on poetry here (pbr used to get this same distinction wrong too imo, and was the impetus for my blog post). If you look at a [tool.poetry.dependencies]
cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" } Having that git dependency there makes this something that can't be uploaded to PyPI, because that points to a concrete location and dependencies inside of a package are only abstract until they're fully resolved. This same thing is also true if you're using the power of other things that can exist in It also requires non-dependencies into your dependency metadata in the library case. While this isn't the end of the world, it is generally useless information for end users. The common way to implement this is something like a Finally, it requires some base set of metadata like name/version. When I was writing Warehouse I originally started out using a Cargo and Go are bit of misnomers here, because they're solving somewhat of a different problem-- they're not working on a deployment story, they're working on a build story, so the concept of abstract dependencies don't fully apply there. The other languages are working on similar problems, so they're more directly relevant. They ultimately come down to whether you think it's more confusing to have constructs that are syntactically valid, but which cannot be used in certain conditions (e.g. can't use if publishing to PyPI) or whether it's more confusing to have independent files (or a atleast, areas within the same file) where the constructs are more constrained to solving the specific problem, which allows you to avoid misusing construsts that can't be used in a particular context. Effectively, whether two specific, well fit examples makes more sense or one general, not quite perfect for either case example. I do take issue with this statement though:
If you're duplicating your dependencies between [packages]
"mylib" = {path = ".", editable = true} and then all of your duplication is now gone. |
That's why if you want to depend on a git dependency in development you would put it in the [tool.poetry.dependencies]
cleo = "^0.6.6"
[tool.poetry.dev-dependencies]
cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" } That way, you can have concrete dependencies and abstract dependencies all in one file. |
@sdispater Development dependencies are not the only case where you'll want to depend on "concrete" dependencies (I had assumed To be clear, I don't think either answer is right or wrong. I was mostly trying to delve into what the actual differentiating thing (in my mind) between the two approaches are. The two files things is a distraction, since you could just as easily implement Fundamentally the difference comes down to whether you try to reuse the same constructs for publication as consumption (because the venn diagram of what you want to do with these two things overlap a lot, but are not a perfect circle) or if you want them separate because you think they're different enough that they deserve their own targeted tooling. This is mostly targeted at @ncoghlan, cuz I think the "does it belong in [build-system]
requires = ["flit"]
build-backend = "flit.buildapi"
[tool.flit.metadata]
module = "foobar"
author = "Sir Robin"
author-email = "[email protected]"
home-page = "https://github.com/sirrobin/foobar"
requires = ["requests (>=2.6)",
"configparser; python_version == '2.7'"
]
[tool.pipfile.packages]
"foobar" = {path = ".", editable = true} Where the abstract dependencies get defined in The real difference between the two approaches is whether you reuse the same constructs for abstract and concrete dependencies or not. There isn't a right answer here, there are just different tradeoffs. |
Thanks for clarifying your concerns with the current reference wording @sdispater - I'll put together a PR that hopefully clarifies things, and we can iterate on some specific wording there. @dstufft Agreed on the fact that we could have nested |
#508 is the PR with the rewording. The commit message is longer than the docs are, and it does focus on the file structure, as that seems to be what folks sometimes find most counter-intuitive about the While concrete vs abstract dependencies is the explanation for why we have that split, I don't think it's why folks sometimes object to having two files: I think that's because for their particular use case, they're in a situation where they don't lose any clarity by dropping back to |
As the author of Poetry, I find this somewhat misleading.
Like I said on Twitter, there is a misconception around Poetry and what its purpose is. Poetry is a tool to manage Python projects, being an application or a library.
This is not true, the only metadata necessary in Poetry are the project name, its version and one or more author. That’s it. I made this choice because for me every project should have a name and a version.
The only difference when managing an application compared to a library is that the lock file should be check into version control and you won’t have to use the build and publish command. Nothing more.
Basically, the workflow you have with pipenv can be replicated with poetry:
Installing packages for your project
This displays an output like this:
Using installed packages
So it’s seems that this was written by someone who has not used Poetry and has preconceptions about what it does or not. So I thought I would try to clarify things a bit.
The text was updated successfully, but these errors were encountered: