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

🔧 Update package metadata, drop support for Python 3.6, move build internals from Flit to Hatch #5240

Merged
merged 9 commits into from Sep 14, 2022

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Aug 7, 2022

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).

So, I'm spending my free time updating important projects so that they are modernized and set an example for others 😄

The is a follow-up to pydantic/pydantic#4282

Summary of changes

Metadata

This implements PEP 621 and removes Flit as a development dependency, allowing pip to be used directly which simplifies the contributing workflow and CI/CD. The build backend hatchling (of which I am a maintainer in the PyPA) is now used as that is the default in the official Python packaging tutorial. Hatchling is available on all the major distribution channels such as Debian, Fedora, Arch Linux, conda-forge, Nixpkgs, Alpine Linux, FreeBSD, Gentoo Linux, MacPorts, OpenEmbedded, Spack, etc.

Python support

The earliest supported Python 3 version of Hatchling is 3.7, therefore I've also set that as the minimum here. Python 3.6 is EOL and other build backends like flit-core and setuptools also dropped support. Python 3.6 accounts for 3-4% of downloads in the last month: https://pypistats.org/packages/fastapi

If support is still desired for some reason, I can keep the existing cap and only require 3.7+ in CI/CD.

Documentation

I updated the contributing docs, which accounts for most of the diff. Luckily, they were written in such a way that going from flit to pip didn't alter semantics for any language!

Future

  • We now have the ability to ship optional wheels compiled with Mypyc, as Black recently did, to be even faster in benchmarks. Though as @tiangolo mentioned offline, it may be best to wait for the great work @samuelcolvin is doing on Pydantic v2 to be over to be sure we don't cause any disruptions in their test suite.
  • We could source the version from Git

@codecov
Copy link

codecov bot commented Aug 7, 2022

Codecov Report

Merging #5240 (90950e3) into master (b2aa359) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #5240   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          540       540           
  Lines        13951     13947    -4     
=========================================
- Hits         13951     13947    -4     
Impacted Files Coverage Δ
fastapi/encoders.py 100.00% <ø> (ø)
fastapi/concurrency.py 100.00% <100.00%> (ø)
fastapi/dependencies/utils.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2022

📝 Docs preview for commit 0c10260 at: https://62ef63a1ba5a2255983c34e7--fastapi.netlify.app

@ofek
Copy link
Contributor Author

ofek commented Aug 7, 2022

Ah looks like the 3.6 job is hard coded in this repo's GitHub settings as required.

@github-actions
Copy link
Contributor

📝 Docs preview for commit 8ed4d8a at: https://62fdccd962cae252d9a65fc8--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit ab290a9 at: https://62fdd03bc009ce60bf4787ee--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 8ee7c5e at: https://632218ad6f7e673abce043d5--fastapi.netlify.app

FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
run: bash scripts/publish.sh
uses: pypa/gh-action-pypi-publish@v1.5.1
with:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
with:
with:
user: __token__

Copy link
Owner

Choose a reason for hiding this comment

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

Is it needed? Then maybe the docs in the GitHub Action need an update too?

https://github.com/pypa/gh-action-pypi-publish#usage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, guess not!

@github-actions
Copy link
Contributor

📝 Docs preview for commit c52e2ee at: https://63221a832b16da3418038c4d--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 90950e3 at: https://63221be7afbe8635f3f1102d--fastapi.netlify.app

@tiangolo tiangolo changed the title Update package metadata 🔧 Update package metadata, adopt Hatch instead of Flit, drop support for Python 3.6 Sep 14, 2022
@tiangolo tiangolo changed the title 🔧 Update package metadata, adopt Hatch instead of Flit, drop support for Python 3.6 🔧 Update package metadata, drop support for Python 3.6, move build internals from Flit to Hatch Sep 14, 2022
@tiangolo
Copy link
Owner

Awesome job, thanks a lot @ofek! FastAPI is now built with Hatch. 🥚 🐍 😎

Also, Python 3.6 is now officially NOT supported. 🔥

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.

None yet

3 participants