Skip to content

Commit 83a51d1

Browse files
committed
Move from setuptools to flit
Closes pypa#340
1 parent c2c9aef commit 83a51d1

File tree

10 files changed

+94
-211
lines changed

10 files changed

+94
-211
lines changed

.github/workflows/lint.yml

+27-27
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ name: Linting
33
on:
44
pull_request:
55
paths:
6-
- '**.py'
6+
- "**.py"
77
push:
88
paths:
9-
- '**.py'
9+
- "**.py"
1010

1111
jobs:
1212
lint:
1313
name: nox -s lint
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v1
1818

19-
- uses: actions/setup-python@v2
20-
name: Install Python
21-
with:
22-
python-version: '3.9'
19+
- uses: actions/setup-python@v2
20+
name: Install Python
21+
with:
22+
python-version: "3.9"
2323

24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
python -m pip install --upgrade nox
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install --upgrade nox
2828
29-
- name: Run `nox -s lint`
30-
run: python -m nox -s lint
29+
- name: Run `nox -s lint`
30+
run: python -m nox -s lint
3131

3232
build:
3333
name: Build sdist and wheel
@@ -39,21 +39,21 @@ jobs:
3939
needs: lint
4040

4141
steps:
42-
- uses: actions/checkout@v1
42+
- uses: actions/checkout@v1
4343

44-
- uses: actions/setup-python@v2
45-
name: Install Python
46-
with:
47-
python-version: '3.9'
44+
- uses: actions/setup-python@v2
45+
name: Install Python
46+
with:
47+
python-version: "3.9"
4848

49-
- name: Install dependencies
50-
run: python -m pip install --upgrade setuptools wheel
49+
- name: Install dependencies
50+
run: python -m pip install --upgrade build
5151

52-
- name: Build
53-
run: python setup.py sdist bdist_wheel
52+
- name: Build
53+
run: python -m build
5454

55-
- name: Archive files
56-
uses: actions/upload-artifact@v1
57-
with:
58-
name: dist
59-
path: dist
55+
- name: Archive files
56+
uses: actions/upload-artifact@v1
57+
with:
58+
name: dist
59+
path: dist

.pre-commit-config.yaml

+28-33
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
4-
hooks:
5-
- id: check-toml
6-
- id: check-yaml
7-
- id: end-of-file-fixer
8-
- id: trailing-whitespace
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
99

10-
- repo: https://github.com/pre-commit/mirrors-mypy
11-
rev: v0.790
12-
hooks:
13-
- id: mypy
14-
exclude: '^(docs|tasks|tests)|setup\.py'
15-
args: []
16-
- id: mypy
17-
name: mypy for Python 2
18-
exclude: '^(docs|tasks|tests)|setup\.py|noxfile\.py'
19-
args: ['--py2']
10+
- repo: https://github.com/pre-commit/mirrors-mypy
11+
rev: v0.790
12+
hooks:
13+
- id: mypy
14+
exclude: '^(docs|tasks|tests)|setup\.py'
15+
args: []
16+
- id: mypy
17+
name: mypy for Python 2
18+
exclude: '^(docs|tasks|tests)|setup\.py|noxfile\.py'
19+
args: ["--py2"]
2020

21-
- repo: https://github.com/psf/black
22-
rev: 19.3b0
23-
hooks:
24-
- id: black
21+
- repo: https://github.com/psf/black
22+
rev: 19.3b0
23+
hooks:
24+
- id: black
2525

26-
- repo: https://gitlab.com/PyCQA/flake8
27-
rev: '3.7.8'
28-
hooks:
29-
- id: flake8
30-
additional_dependencies: ['pep8-naming']
31-
# Ignore all format-related checks as Black takes care of those.
32-
args: ['--ignore', 'E2,W5', '--select', 'E,W,F,N']
33-
34-
- repo: https://github.com/mgedmin/check-manifest
35-
rev: '0.39'
36-
hooks:
37-
- id: check-manifest
26+
- repo: https://gitlab.com/PyCQA/flake8
27+
rev: "3.7.8"
28+
hooks:
29+
- id: flake8
30+
additional_dependencies: ["pep8-naming"]
31+
# Ignore all format-related checks as Black takes care of those.
32+
args: ["--ignore", "E2,W5", "--select", "E,W,F,N"]

MANIFEST.in

-19
This file was deleted.

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848

4949
base_dir = os.path.join(os.path.dirname(__file__), os.pardir)
5050
about = {}
51-
with open(os.path.join(base_dir, "packaging", "__about__.py")) as f:
51+
with open(os.path.join(base_dir, "packaging", "__init__.py")) as f:
5252
exec(f.read(), about)
5353

5454
version = release = about["__version__"]
55-
copyright = about["__copyright__"]
55+
copyright = "Copyright 2014-2019 Donald Stufft and individual contributors"
5656

5757
# List of patterns, relative to source directory, that match files and
5858
# directories to ignore when looking for source files.

setup.cfg mypy.ini

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[bdist_wheel]
2-
universal=1
3-
41
[mypy]
52
ignore_missing_imports = True
63

noxfile.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def tests(session):
2525
def coverage(*args):
2626
session.run("python", "-m", "coverage", *args)
2727

28+
# Once coverage 5 is used then `.coverage` can move into `pyproject.toml`.
2829
session.install("coverage<5.0.0", "pretend", "pytest", "pip>=9.0.2")
2930

3031
if "pypy" not in session.python:
@@ -52,8 +53,8 @@ def lint(session):
5253
session.run("pre-commit", "run", "--all-files")
5354

5455
# Check the distribution
55-
session.install("setuptools", "twine", "wheel")
56-
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
56+
session.install("build", "twine")
57+
session.run("python", "-m", "build")
5758
session.run("twine", "check", *glob.glob("dist/*"))
5859

5960

@@ -123,10 +124,10 @@ def release(session):
123124
# Checkout the git tag.
124125
session.run("git", "checkout", "-q", release_version, external=True)
125126

126-
session.install("twine", "setuptools", "wheel")
127+
session.install("build", "twine")
127128

128129
# Build the distribution.
129-
session.run("python", "setup.py", "sdist", "bdist_wheel")
130+
session.run("python", "-m", "build")
130131

131132
# Check what files are in dist/ for upload.
132133
files = sorted(glob.glob("dist/*"))

packaging/__about__.py

-27
This file was deleted.

packaging/__init__.py

+2-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
# This file is dual licensed under the terms of the Apache License, Version
22
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
33
# for complete details.
4-
from __future__ import absolute_import, division, print_function
5-
6-
from .__about__ import (
7-
__author__,
8-
__copyright__,
9-
__email__,
10-
__license__,
11-
__summary__,
12-
__title__,
13-
__uri__,
14-
__version__,
15-
)
16-
17-
__all__ = [
18-
"__title__",
19-
"__summary__",
20-
"__uri__",
21-
"__version__",
22-
"__author__",
23-
"__email__",
24-
"__license__",
25-
"__copyright__",
26-
]
4+
"""Core utilities for Python packages"""
5+
__version__ = "20.5.dev0"

pyproject.toml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[build-system]
2+
requires = ["flit_core >=2,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[tool.flit.metadata]
6+
module = "packaging"
7+
author = "Donald Stufft and individual contributors"
8+
author-email = "donald@stufft.io"
9+
home-page = "https://github.com/pypa/packaging"
10+
description-file = "README.rst"
11+
requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
12+
requires = ["pyparsing>=2.0.2"]
13+
classifiers = [
14+
"Development Status :: 5 - Production/Stable",
15+
"Intended Audience :: Developers",
16+
"License :: OSI Approved :: Apache Software License",
17+
"License :: OSI Approved :: BSD License",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 2",
20+
"Programming Language :: Python :: 2.7",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.4",
23+
"Programming Language :: Python :: 3.5",
24+
"Programming Language :: Python :: 3.6",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: Implementation :: CPython",
29+
"Programming Language :: Python :: Implementation :: PyPy",
30+
]

setup.py

-73
This file was deleted.

0 commit comments

Comments
 (0)