-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support for PEP 621 #3
Comments
Related: python-poetry/poetry#3332 |
Just FYI, Setuptools has added experimental support in pypa/setuptools#1688 and publicly announced it. AFAIK, this will leave Poetry as the only major modern build backend lacking support for the standard. |
I tried to lay out what a PEP-621 compliant could look like. We will take the following sample project as a basis for discussion: [tool.poetry]
name = "my-package"
version = "1.2.3"
description = "Some description."
authors = [
"Sébastien Eustace <[email protected]>"
]
maintainers = [
"Sébastien Eustace <[email protected]>"
]
license = "MIT"
readme = "README.rst"
homepage = "https://python-poetry.org"
repository = "https://github.com/python-poetry/poetry"
documentation = "https://python-poetry.org/docs"
keywords = ["packaging", "dependency", "poetry"]
classifiers = [
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules"
]
# Requirements
[tool.poetry.dependencies]
python = "~2.7 || ^3.6"
cleo = "^0.6"
pendulum = { git = "https://github.com/sdispater/pendulum.git", branch = "2.0" }
tomlkit = { git = "https://github.com/sdispater/tomlkit.git", rev = "3bff550", develop = false, source = "foo" }
requests = { version = "^2.18", optional = true, extras=[ "security" ] }
pathlib2 = { version = "^2.2", python = "~2.7" }
orator = { version = "^0.9", optional = true }
# File dependency
demo = { path = "../distributions/demo-0.1.0-py2.py3-none-any.whl" }
# Dir dependency with setup.py
my-package = { path = "../project_with_setup/" }
# Dir dependency with pyproject.toml
simple-project = { path = "../simple_project/" }
# Dependency with markers
functools32 = { version = "^3.2.3", markers = "python_version ~= '2.7' and sys_platform == 'win32' or python_version in '3.4 3.5'" }
# Dependency with python constraint
dataclasses = {version = "^0.7", python = ">=3.6.1,<3.7"}
[tool.poetry.extras]
db = [ "orator" ]
network = ["requests"]
[tool.poetry.group.dev.dependencies]
pytest = "~3.4"
[tool.poetry.scripts]
my-script = "my_package:main"
[tool.poetry.plugins."blogtool.parsers"]
".rst" = "some_module::SomeClass"
[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
priority = "supplemental" Migrating it to PEP 621 could look like this: [project]
name = "my-package"
version = "1.2.3"
description = "Some description."
readme = "README.md"
requires-python = ">=3.6"
license = { file = "LICENSE" }
keywords = ["packaging", "dependency", "poetry"]
authors = [
{ name="Sébastien Eustace", email="<[email protected]>" }
]
maintainers = [
{ name="Sébastien Eustace", email="<[email protected]>" }
]
classifiers = [
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules"
]
# Requirements
dependencies = [
"cleo ~=0.6",
"pendulum @ git+https://github.com/sdispater/[email protected]",
"tomlkit @ git+https://github.com/sdispater/tomlkit.git@3bff550",
"pathlib2 ~=2.2 ; python_version = '2.7'" ,
# File dependency
"demo @ ../distributions/demo-0.1.0-py2.py3-none-any.whl",
# Dir dependency with setup.py
"my-package @ ../project_with_setup/",
# Dir dependency with pyproject.toml
"simple-project @ ../simple_project/",
# Dependency with markers
"functools32 ~=3.2.3 ; python_version ~= '2.7' and sys_platform == 'win32' or python_version in '3.4 3.5'",
# Dependency with python constraint
"dataclasses ~=0.7 ; python_full_version >= '3.6.1' and python_full_version < '3.7'"
]
[project.optional-dependencies]
db = [
"orator ~=0.9"
]
network = [
"requests[security] ~=2.18"
]
[project.urls]
homepage = "https://python-poetry.org"
repository = "https://github.com/python-poetry/poetry"
documentation = "https://python-poetry.org/docs"
[project.scripts]
my-script = "my_package:main"
[project.entry-points."blogtool.parsers"]
".rst" = "some_module::SomeClass"
[tool.poetry.dependency-options]
tomlkit = { develop = true, source = "foo" }
[tool.poetry.group.dev]
dependencies= [
"pytest ~=3.4"
]
[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
priority = "supplemental" Here are the noteworthy elements:
To ease this transition, I see a few things that should be done:
From a pure internal standpoint, the best approach would be to have two separate "format" implementations – that can be converted from one another – that can both produce a |
That looks great, but @sdispater can you maybe add some usage of |
Those are not exactly equivalent to either poetry's |
Poetry's |
I was not suggesting to continue supporting poetry's special syntax in the standard For newly added dependencies with |
Is there any real difference between |
|
I think you misunderstood the phrasing, @nyuszika7h -- indeed, the default for |
One might want to know that setuptools-scm supports PEP-621 for quite some time and that is not the only python builder that does. |
As noted above, all of the other major build backends now support PEP 621 project metadata—to correct my statement above, it is Setuptools' support for its own configuration in the |
I’m looking forward to this. They should only ever be used for applications, never libraries, and it’s hard to convince newbie library maintainers to not use this feature when it’s there and advertised in the Poetry docs. |
It's shocking this never happened. PEP 621 is – along with PEP 517, obviously – the only standard that It's been nearly two years since PEP 621 was first accepted. The window of opportunity is vanishing and may, indeed, already have closed. This is what it sounds like when build tools cry. |
Hi all, it's well-understood that PEP 621 as the default project format is desired, and it's something the maintainers are pushing toward. However, this issue hasn't had productive discussion for some time, and has mostly devolved into me-too and "this is so simple, why don't you do it?" I'm going to lock this issue for now, and encourage discussion on the implementation details to instead happen on the linked PR (python-poetry/poetry-core#567). If it becomes apparent that more discussion about the overall design direction and not the specific implementation is needed, I will unlock this issue. Thanks! |
python-poetry/poetry#9135 should be in a testable state now. (Consider it an alpha version.) Please try it out and report issues you encounter in the PR. |
Now that PEP 621 is final we will eventually need to support it.
This might be tricky since PEP 621 is not flexible enough to provide the same set of features that Poetry currently supports.
The text was updated successfully, but these errors were encountered: