build: Modernize, use setuptools 69#428
Conversation
This should solve the "Cannot find implementation or library stub" errors from mypy if installed properly. Since the code already has internal type hints, adding the marker is sufficient for mypy to use them.
The setuptools>=69 dependency includes a fix to automatically include the py.typed marker in the distribution, thus making type hints usage much easier. The newer version however fails to build when the basic project metadata is missing in pyproject.toml. Thus the settings from setup.cfg are migrated entirely, upgrading to setuptools_scm >= 8 in the process.
sveinse
left a comment
There was a problem hiding this comment.
Technically I'm not a collaborator for this project, but this change looks good.
|
@christiansandberg I would like your opinion on this, do you see any risk for larger breakage? |
|
This would be nice to get into an upcoming release, which we should make pretty soon to avoid more trouble like #455. OK @christiansandberg? |
christiansandberg
left a comment
There was a problem hiding this comment.
Sorry for the absence. Go ahead and merge!
| [project] | ||
| name = "canopen" | ||
| authors = [ | ||
| {name = "Christian Sandberg", email = "christiansandberg@me.com"}, |
There was a problem hiding this comment.
Feel free to add more people here. 🙂
There was a problem hiding this comment.
I counted up the PRs that go into this release, and a large fraction of them are mine. Please feel free to use my name and email (sveinse@seldal.com) in any release notes.
| "test", | ||
| ] | ||
| filterwarnings = [ | ||
| "ignore::DeprecationWarning", |
There was a problem hiding this comment.
Could this be useful to see anyway?
There was a problem hiding this comment.
Maybe so. I suggest we leave it be until after the release. The only warnings I get currently are for datetime.utcnow() and the bustype argument to can.interface.Bus.
Based on stats from GitHub, master branch as of today.
Migrate
setup.cfgtopyproject.tomlfor newer setuptools compat and create py.typed marker for automatic type checker discovery.The
py.typedmarker should solve the "Cannot find implementation or library stub" errors from mypy if installed properly. Since the code already has internal type hints, adding the marker is sufficient for mypy to use them.The
setuptools>=69dependency includes a fix to automatically include thepy.typedmarker in the distribution, thus making type hints usage much easier. The newer version however fails to build when the basic project metadata is missing inpyproject.toml. Thus the settings fromsetup.cfgare migrated entirely, upgrading tosetuptools_scm >= 8inthe process.
This might need a requirement bump to Python >= 3.8 as well, since that's what the new setuptools version requires.