-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[DOC] PEP 621 - pyproject.toml vs setup.cfg #3683
Comments
The discussion over at #3214 may be helpful. I've since moved my projects to a pure- I'd love to hear some more experienced developers chime in though. Is pure- |
@mcrumiller I am curios in which sense the is a The new editable install path however, depends on the implementation of pep660 and not pep621 as far as I am aware. E.g. as long as you have
or similar in your pyproject.toml file |
@jenshnielsen I was a little gushy in my over-use of the word awful, I apologize. Here are my main gripes:
I admit I am quite the noob on build backends so I'm not here to complain but rather see if others have gone through and resolved any of my issues outlined above. |
Thanks, those sounds like they are related to #3518
As far as I understand that does not depend on the existence of the setup.py file |
@jenshnielsen I swear I tried compat mode in the past and pylance failed to recognize editable installs--but now it works! Thank you so much. |
Spoke too soon: compat mode doesn't seem to work at all:
I tried using
Any suggestions? |
I assume that python-toolbox is https://github.com/cool-RR/python_toolbox . It seems like that is a pure setup.py project? To me it looks like compat mode is not working correctly in that case. Not sure it that is a bug but I would think so? (I am not a setuptool dev just a user) |
Sorry nope, it's my own local package located in |
Ok could you share the pyproject.toml file from that project? |
Update the version of |
Here's the gist of it: [build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
authors = [
{ name = "me", email = "[email protected]" },
]
name = "python-toolbox"
description = "Python toolbox"
dynamic = ["version"]
dependencies = [
"my_dependencies"
]
[project.scripts]
script_name = "module:function"
[tool.setuptools]
include-package-data = true
packages = [
"toolbox",
"toolbox.subpackages",
"my_subpackages"
]
[tool.setuptools.package-dir]
toolbox = "src/python/toolbox"
[tool.setuptools.package-data]
"toolbox" = "my_resource"
"toolbox.subpackage" = "subpackage_resource"
[tool.setuptools.dynamic]
version = { attr = "toolbox.__version__" }
readme = { file = ["README.md"] } My project is setup like the following:
|
@mcrumiller @jenshnielsen Happy to see you guys hash out some kinks with editable installs using pyproject.toml but that seems like it should perhaps be in a dedicated issue specifically for addressing editable install issues when using a I'm afraid this discussion may lead to the focus getting shifted away from the core issue which was a call for more clarity and better guidance on which type of config file to go for when setting up or updating a Python package to meet today's packaging standards. I do thank you for pointing me to #3214 because I learnt that |
Agreed, @mcrumiller perhaps it makes more sense for you to create a new bug for the issue that you are seeing with the information from here |
@vancromy, I am sorry to disappoint, but I don't think you are going to find objective technical reasons for using one or the other. If I am not wrong the Using If you are OK with these constraints, my personal recommendation (and I don't speak for setuptools here) is:
|
@abravalheri is there any update on the beta status of [tools.setuptools] in pyproject.toml. I have a few projects that uses pyproject.toml but I have kept around setup.cfg for the setuptools specific config. This is mainly for stuff like zip_safe and package_data since I am not using setuptools-scm. |
Any update? |
@abravalheri This is exactly what I ended up doing except for part 4. I was able to get Cython working without a setup.py. It still requires a .py file, but it doesn't rely on setup.py being special. This essentially makes it so I have a pure pyproject.toml solution which is what I think the future is going to be. For anyone interested in an example you can checkout my repo https://github.com/MoseleyBioinformaticsLab/MESSES. |
Summary
Hello,
As a newcomer to the python packaging world I was redirected from python.org to the setuptools documentation because python recommended it as the first choice for packaging. I had a quick read through the documentation and see that there are three different files for specifying project metadata/settings
setup.py
(for legacy projects - to be deprecated and kept to a bare minimum),setup.cfg
(as I understood from the docs, some sort of successor of setup.py but with no code execution) and finallypyproject.toml
. On theConfiguring setuptools using pyproject.toml files
page, the documentation mentions that since PEP 621 the python community has adopted the pyproject.toml as the go-to config file for specifying distribution/project metadata/settings. I therefore am left a bit confused as to what the use case is for thesetup.cfg
file and I did not feel like the documentation properly explained this. There is a separate page forConfiguring setuptools with setup.cfg files
but it doesn't address the overlap/difference between the two. I was therefore hoping that the experts in this community could clarify this and potentially have a separate page in the documentation (e.g.setup.cfg vs pyproject.toml
) describing:I had a quick scan and search of the GitHub issues to see if this had been brought up before but got no hits on my search so apologies if this is a dupe.
Note: I could have made this a discussion but specifically chose to opt for an issue because I felt an improvement to the docs was necessary for clarity's sake.
Looking forward to hearing from the experts!
YVC
OS / Environment
N/A
Additional Information
For newbies like myself and potentially also intermediate/advanced developers, this clarity would hopefully ensure we are all going in the same direction in terms of the future of python packaging. :)
Code of Conduct
The text was updated successfully, but these errors were encountered: