-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Update package metadata #338
Conversation
476f164
to
1918721
Compare
Just FYI Hatch was adopted by the Python Packaging Authority: |
Hi. Thanks for the contribution! We're talking about making a release, and this seems like a laudable change. I'd like to get it in if I can. @ofek Presumably your opinion is that it is currently good to merge as-is? I'll check it out... |
I see there are failures on 2.7 on Windows. I'll try to run a build on master as a sanity check. |
Fixed, this looks good to me now! |
When you drop py2 just remove the pin |
We're scrambling to find a little time to make a release before going on vacation. In order to keep things simple, I'm going to postpone merging this right now, but will merge it and make another release after my vacation, around July 5th. Thanks heaps for the contribution, and all your work leading up to this point! :-) |
Happy to help! Have fun 🙂 |
Hi @ofek . Can you explain the benefits of using hatchling vs. using |
@wiggin15 Hey! See https://peps.python.org/pep-0517/
Some benefits:
|
Thanks. I think I got it. |
Makefile
Outdated
@@ -51,15 +50,14 @@ test: ## Run tests | |||
# build packages | |||
|
|||
build: ## Build a release (sdist and wheel) | |||
$(python) -m pip install --upgrade setuptools wheel | |||
$(python) setup.py sdist bdist_wheel | |||
$(python) -m pip install --upgrade build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think maybe "build" should be in requirements-dev.txt
(which is installed during make bootstrap
- see the release process in README-hacking.md
) instead of being installed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not since it's unrelated to testing; I think twine
should also not be in there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requirements-dev.txt
is not just for testing - we install these packages when running make bootstrap
before running make build
/make release
as part of the build/release process.
OTOH now I see that we ran pip install
for setuptools
and wheel
before this change...
Anyway, this is not blocking a merge.
I'm ok with merging this now that we released v0.4.5. @ofek can you please rebase the PR to resolve the latest conflicts? Thanks. |
Done! |
Makefile
Outdated
.PHONY: build | ||
|
||
test-release: build ## Test a built release | ||
./test-release | ||
.PHONY: test-release | ||
|
||
release: ## Upload a built release | ||
$(twine) upload dist/colorama-$(version)* | ||
$(twine) upload dist/colorama-*{.whl,.tar.gz} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We encountered an issue in our last release where the globs using {}
didn't work in the Makefile. We had to remove them.
@@ -1,5 +1,6 @@ | |||
[tox] | |||
envlist = py27, py35, py36, py37, py38, py39, py310, pypy, pypy3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are removing py35 and py36 from the testing matrix we should reflect that in the README (we list tested versions under Installation
)
Sorry for piling on more comments each time, and thanks for working with us :) |
Addressed! |
Thank you very much @ofek . This brings colorama to the modern age of Python packaging 🥳 |
We have a release candidate on PyPI containing this PR. Thank you for your contributions! https://pypi.org/project/colorama/0.4.6rc1/ If nobody spots any problems with it, I'll push the final 0.4.6 tomorrow. |
Awesome! |
or more like four: ``` $ pipdeptree hatchling==1.11.1 - editables [required: >=0.3, installed: 0.3] - packaging [required: >=21.3, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pathspec [required: >=0.10.1, installed: 0.10.1] - pluggy [required: >=1.0.0, installed: 1.0.0] - tomli [required: >=1.2.2, installed: 2.0.1] ``` Let's monitor how the situation evolves, and whether other packages start requiring hatchling, but for now I am not going to add four new packages into the trusted base set... Pinning colorama to an older version for now. related: tartley/colorama#338 tartley/colorama#349
or more like four: ``` $ pipdeptree hatchling==1.11.1 - editables [required: >=0.3, installed: 0.3] - packaging [required: >=21.3, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pathspec [required: >=0.10.1, installed: 0.10.1] - pluggy [required: >=1.0.0, installed: 1.0.0] - tomli [required: >=1.2.2, installed: 2.0.1] ``` Let's monitor how the situation evolves, and whether other packages start requiring hatchling, but for now I am not going to add four new packages into the trusted base set... Pinning colorama to an older version for now. related: tartley/colorama#338 tartley/colorama#349
or more like four: ``` $ pipdeptree hatchling==1.11.1 - editables [required: >=0.3, installed: 0.3] - packaging [required: >=21.3, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pathspec [required: >=0.10.1, installed: 0.10.1] - pluggy [required: >=1.0.0, installed: 1.0.0] - tomli [required: >=1.2.2, installed: 2.0.1] ``` Let's monitor how the situation evolves, and whether other packages start requiring hatchling, but for now I am not going to add four new packages into the trusted base set... Pinning colorama to an older version for now. related: tartley/colorama#338 tartley/colorama#349
or more like four: ``` $ pipdeptree hatchling==1.11.1 - editables [required: >=0.3, installed: 0.3] - packaging [required: >=21.3, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pathspec [required: >=0.10.1, installed: 0.10.1] - pluggy [required: >=1.0.0, installed: 1.0.0] - tomli [required: >=1.2.2, installed: 2.0.1] ``` Let's monitor how the situation evolves, and whether other packages start requiring hatchling, but for now I am not going to add four new packages into the trusted base set... Pinning colorama to an older version for now. related: tartley/colorama#338 tartley/colorama#349
or more like four: ``` $ pipdeptree hatchling==1.11.1 - editables [required: >=0.3, installed: 0.3] - packaging [required: >=21.3, installed: 21.3] - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.9] - pathspec [required: >=0.10.1, installed: 0.10.1] - pluggy [required: >=1.0.0, installed: 1.0.0] - tomli [required: >=1.2.2, installed: 2.0.1] ``` Let's monitor how the situation evolves, and whether other packages start requiring hatchling, but for now I am not going to add four new packages into the trusted base set... Pinning colorama to an older version for now. related: tartley/colorama#338 tartley/colorama#349
0.4.6 Current release * tartley/colorama#139 Add alternative to 'init()', called 'just_fix_windows_console'. This fixes many longstanding problems with 'init', such as working incorrectly on modern Windows terminals, and wonkiness when init gets called multiple times. The intention is that it just makes all Windows terminals treat ANSI the same way as other terminals do. Many thanks the njsmith for fixing our messes. * tartley/colorama#352 Support Windows 10's ANSI/VT console. This didn't exist when Colorama was created, and avoiding us causing havok there is long overdue. Thanks to segeviner for the initial approach, and to njsmith for getting it merged. * tartley/colorama#338 Internal overhaul of package metadata declaration, which abolishes our use of the now heavily discouraged setuptools (and hence setup.py, setup.cfg and MANIFEST.in), in favor of hatchling (and hence pyproject.toml), generously contributed by ofek (author of hatchling). This includes dropping support Python3.5 and 3.6, which are EOL, and were already dropped from setuptools, so this should not affect our users. * tartley/colorama#353 Attention to detail award to LqdBcnAtWork for a spelling fix in demo06
Background
Hello there! The Python packaging ecosystem has standardized on the interface for build backends (PEP 517/PEP 660) and the format for metadata declaration (PEP 621/PEP 631). As a result, the execution of
setup.py
files is now heavily discouraged.So, I'm spending my free time updating important projects so that they are modernized and set an example for others 😄
Summary of changes
This implements PEP 621, obviating the need for
setup.py
,setup.cfg
, andMANIFEST.in
. The build backendhatchling
(of which I am a maintainer) is quite stable and actively developed, the only reason the version is 0.x is because 1.0.0 will drop support for Python 2. It's also on the major distribution channels such as Debian, Fedora, Arch Linux, conda-forge, Nixpkgs, etc.Other projects have done this such as pipx, tox, all Datadog Agent integrations, etc.
In comparison to
setuptools
, Hatchling has reproducible builds, supports the modern PEP 660 editable installation standard, has a more intuitive plugin system, and the codebase is an order of magnitude smaller thus making it more auditable and less prone to bugs (setuptools
is based on a deprecated standard library module that it now must vendor).Notes
hatchling
and other build backends likesetuptools
have already done so. This will not break anything becausepip
only looks for version candidates that satisfy therequires-python
field. Here are stats for the curious: https://pypistats.org/packages/colorama*.egg-info
frompip install -e .
; this is now fixed: