Skip to content

feat: use pyproject.toml instead #64

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

Merged
merged 5 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ install:
- ps: |
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
python -m pip install --disable-pip-version-check --upgrade --no-warn-script-location pip setuptools
python -m pip install --disable-pip-version-check --upgrade --no-warn-script-location pip build
build_script:
- ps: |
python setup.py sdist
python -m build -s
cd dist
python -m pip install --verbose python_example-0.0.1.tar.gz
cd ..
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ on:

env:
CIBW_TEST_COMMAND: python {project}/tests/test.py
# This can be removed if pyproject.toml is used
CIBW_BEFORE_BUILD: pip install pybind11


jobs:
Expand All @@ -25,10 +23,10 @@ jobs:
- uses: actions/setup-python@v2

- name: Install deps
run: python -m pip install "setuptools>=42" "setuptools_scm[toml]>=4.1.0" twine
run: python -m pip install twine build

- name: Build SDist
run: python setup.py sdist
run: python -m build -s

- name: Check metadata
run: twine check dist/*
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ before_install:
if [ -n "$PYTHON" ]; then
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
export PATH="/Users/travis/Library/Python/2.7/bin:$PATH"
export MACOSX_DEPLOYMENT_TARGET="10.13"
if [ "${PYTHON:0:1}" = "3" ]; then
brew update; brew install python3;
fi
Expand All @@ -46,8 +47,7 @@ before_install:
install:
- |
if [ -n "$PYTHON" ]; then
python setup.py sdist
python -m pip install --verbose dist/*.tar.gz
python -m pip install .
elif [ -n "$CONDA" ]; then
conda build conda.recipe --python $CONDA
conda install --use-local python_example
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"pybind11>=2.6.0",
]

build-backend = "setuptools.build_meta"
15 changes: 3 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
from setuptools import setup

# With setup_requires, this runs twice - once without setup_requires, and once
# with. The build only happens the second time.
try:
from pybind11.setup_helpers import Pybind11Extension, build_ext
from pybind11 import get_cmake_dir
except ImportError:
from setuptools import Extension as Pybind11Extension
from setuptools.command.build_ext import build_ext
# Available at setup time due to pyproject.toml
from pybind11.setup_helpers import Pybind11Extension, build_ext
from pybind11 import get_cmake_dir

import sys

Expand Down Expand Up @@ -39,10 +34,6 @@
description="A test project using pybind11",
long_description="",
ext_modules=ext_modules,
# Note: You have to add pybind11 to both setup and install requires to make
# it available during the build. Using PEP 518's pyproject.toml is better!
setup_requires=["pybind11==2.6.0"],
install_requires=["pybind11==2.6.0"],
extras_require={"test": "pytest"},
# Currently, build_ext only provides an optional "highest supported C++
# level" feature, but in the future it may provide more features.
Expand Down