Browse Source

feat: use pyproject.toml instead (#64)

* feat: use pyproject.toml instead

* ci: travis updates

* fix: just install on travis

* fix: include macOS version

* Update .travis.yml
master
Henry Schreiner 5 years ago committed by GitHub
parent
commit
fc12654bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .appveyor.yml
  2. 6
      .github/workflows/wheels.yml
  3. 4
      .travis.yml
  4. 8
      pyproject.toml
  5. 11
      setup.py

4
.appveyor.yml

@ -16,10 +16,10 @@ install: @@ -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 ..

6
.github/workflows/wheels.yml

@ -12,8 +12,6 @@ on: @@ -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:
@ -25,10 +23,10 @@ jobs: @@ -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/*

4
.travis.yml

@ -24,6 +24,7 @@ before_install: @@ -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
@ -46,8 +47,7 @@ before_install: @@ -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

8
pyproject.toml

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"pybind11>=2.6.0",
]
build-backend = "setuptools.build_meta"

11
setup.py

@ -1,13 +1,8 @@ @@ -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:
# Available at setup time due to pyproject.toml
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
import sys
@ -39,10 +34,6 @@ setup( @@ -39,10 +34,6 @@ setup(
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.

Loading…
Cancel
Save