Skip to content

Commit

Permalink
Replace setup.py with build
Browse files Browse the repository at this point in the history
Using setup.py is no longer recommended by setuptools. Instead, projects
should use build: https://github.com/pypa/build. Invoking build will
create a source and wheel distribution
https://pypa-build.readthedocs.io/en/latest/:

> By default, a source distribution (sdist) is built from {srcdir} and a
> binary distribution (wheel) is built from the sdist.

See the setuptools quickstart guides for more information:
https://setuptools.pypa.io/en/latest/userguide/quickstart.html

> Instead, when creating new Python packages, it is recommended to use a
> command line tool called build. This tool will automatically download
> setuptools and any other build-time dependencies that your project
> might have. You just need to specify them in a pyproject.toml file at
> the root of your package, as indicated in the following section.
  • Loading branch information
jdufresne authored Jun 27, 2022
1 parent b84e1ff commit fc50845
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Deploy to PyPI"
on:
workflow_dispatch:
inputs:
inputs:
tag:
description: "Git tag to deploy to PyPI"
required: true
Expand All @@ -21,7 +21,7 @@ jobs:
- shell: bash
run: |
python -m pip install --disable-pip-version-check -U pip
python -m pip install -U setuptools wheel twine
python setup.py sdist bdist_wheel
python -m pip install -U build twine
python -m build
python -m twine check dist/*
python -m twine upload --username=__token__ --password=${{ secrets.PYPI_TOKEN }} dist/*
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ repos:
args: ["--strict"]
additional_dependencies: [
"pytest==6.2.5",
"types-setuptools==57.4.2",
]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ clean:

.PHONY: build
build:
python setup.py sdist bdist_wheel
python -m build

.PHONY: publish
publish:
Expand All @@ -72,12 +72,12 @@ dev: instdev test
.PHONY: instdev
instdev:
pip install -r dev-requirements.txt
python setup.py develop
pip install -e .
@echo "$@ done."

.PHONY: install
install:
python setup.py install
pip install .
@echo "$@ done."

.PHONY: clobber
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
17 changes: 0 additions & 17 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[tox]
minversion = 1.9
envlist = lint, py{36,37,38,39,310,py3}
isolated_build = true
skip_missing_interpreters = true

[testenv]
Expand Down

0 comments on commit fc50845

Please sign in to comment.