-
Notifications
You must be signed in to change notification settings - Fork 61
Migrate from setup.py + setuptools to pyproject.toml + hatchling #156
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
Conversation
The new metadata isn't supported for 3.6 and 3.7: https://github.com/hugovk/wcwidth/actions/runs/19575036750/job/56057960860 Let's drop them, they've been EOL since 2021-12-23 and 2023-06-27: |
|
By thw way, since setuptools >= 61 supports PEP 621, I think we can use pyproject.toml + setuptools. |
|
|
||
| def read_sequences_from_file(filename): | ||
| fp = open(os.path.join(os.path.dirname(__file__), filename), 'r', encoding='utf-8') | ||
| fp = open(os.path.join(os.path.dirname(__file__), filename), encoding='utf-8') |
Check warning
Code scanning / CodeQL
File is not always closed Warning test
this operation
|
Any particular reason to stick with setuptools instead of something more modern? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #156 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 100 100
Branches 20 20
=========================================
Hits 100 100 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
One reason is that we can keep the setup.py in this version, which generates a warning for those who are still calling |
|
I generally support this and have moved to pyproject.toml in other libraries, but the large distribution footprint, including downstream rpm/deb/etc re-packaging, of this library makes me very nervous to make these changes.. see for example #17 So, thank you, I'll consider it for next release, but I'm on the fence. What causes the least amount of "yak shaving" for downstream uses? Currently I'm persuaded to leave it with setup.py for that reason. |
|
Feel free to close this (and #151) if you like :) But #17 was reported 10 years ago, which is a long time. wcwidth is downloaded some 139,000 times per month. I checked the top 10 most downloaded projects, which get between 880k and 1.4 billion downloads/month, and they all use No-one should need to invoke https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html is the long version, by a maintainer of setuptools. |
|
You’re right that that issue is a long time ago, I will carefully review and merge hope for the best for next release, thanks again for the effort
|
- Fix codecov "Token required because branch is protected" error I think codecov stopped working with #156 maybe earlier though - Add linting steps to CI (previously missing) - Add missing tox.ini targets referenced in envlist I expect this build to be marked failed, I will merge it anyway and address linting issues as I go ..
- Fix codecov "Token required because branch is protected" error I think codecov stopped working with #156 maybe earlier though - Add linting steps to CI (previously missing) - Add missing tox.ini targets referenced in envlist - includes all linting and formatting necessary to pass CI
|
@hugovk I see you do a lot of these so I want to follow up to tell you that the MANIFEST.in file was not migrated, and this would have distributed an sdist file missing our tests, docs, etc. Luckily I was on the lookout for it because I just happened to have the exact same issue jquast/blessed#341 due to pyproject.toml migration. #178 |
|
Thanks for letting me know, I'll keep an eye out for Actually, most of the entries aren't needed because by default Hatchling includes everything from source control. Here's a diff of running
So before did include the tests and docs, and everything that's in the new version. In fact, it has more stuff, it included the It might be worth including those? And it might be easier not having to maintain an And for some reason, the |
|
I can only tell you I had different results, I did not use an --sdist argument, maybe something different happened when I use twine somewhere, I really can't say, the folders were missing in the sdist file for me. |
|
I will be investigating re-supporting python 3.6 and 3.7 that were removed by this PR to support improvements to python-prompt-toolkit prompt-toolkit/python-prompt-toolkit#2045 which still uses setup.py and supports 3.6.1 and newer. |
|
I don't follow, https://github.com/prompt-toolkit/python-prompt-toolkit has pyproject.toml but no setup.py, and supports 3.8+: |
|
Ah, I think your fork is just out of date: https://github.com/jquast/python-prompt-toolkit/tree/jq/grapheme-clustering-support They switched setup.py to pyproject.toml in prompt-toolkit/python-prompt-toolkit#1984. |
|
Oh! What a relief, thank you for finding that for me, I'm so bad at the internet sometimes! |

Fixes #151.
Replaces the deprecated license classifiers with PEP 639 metadata: https://hugovk.dev/blog/2025/improving-licence-metadata/