Skip to content
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

build: Modernize, use setuptools 69 #428

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

acolomb
Copy link
Collaborator

@acolomb acolomb commented May 14, 2024

Migrate setup.cfg to pyproject.toml for newer setuptools compat and create py.typed marker for automatic type checker discovery.

The py.typed marker 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.

This might need a requirement bump to Python >= 3.8 as well, since that's what the new setuptools version requires.

acolomb added 2 commits May 14, 2024 11:41
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.
@acolomb acolomb marked this pull request as ready for review May 14, 2024 10:19
Copy link
Collaborator

@sveinse sveinse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically I'm not a collaborator for this project, but this change looks good.

@acolomb
Copy link
Collaborator Author

acolomb commented May 16, 2024

@christiansandberg I would like your opinion on this, do you see any risk for larger breakage?

@acolomb
Copy link
Collaborator Author

acolomb commented Jun 10, 2024

This would be nice to get into an upcoming release, which we should make pretty soon to avoid more trouble like #455. OK @christiansandberg?

@acolomb acolomb added this to the v2.3.0 milestone Jun 10, 2024
Copy link
Owner

@christiansandberg christiansandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the absence. Go ahead and merge!

[project]
name = "canopen"
authors = [
{name = "Christian Sandberg", email = "[email protected]"},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to add more people here. 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I added myself and @af-silva, completing the top-three list of contributors according to GitHub.

Email address taken from one of your commits, @af-silva, hope that's alright?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acolomb It is ok :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ([email protected]) in any release notes.

"test",
]
filterwarnings = [
"ignore::DeprecationWarning",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be useful to see anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

pyproject.toml Show resolved Hide resolved
Based on stats from GitHub, master branch as of today.
@acolomb acolomb merged commit 599f4ac into christiansandberg:master Jun 11, 2024
1 check passed
@acolomb acolomb deleted the build-update-setuptools-69 branch June 11, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants