Skip to content

chore: drop Python 2, require Python 3.6+ #91

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 2 commits into from
Oct 26, 2021
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
1 change: 0 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ environment:
PYTHONWARNINGS: ignore:DEPRECATION
MSSdk: 1
matrix:
- PYTHON: 27
- PYTHON: 36
install:
- cmd: '"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge

- name: Prepare
run: conda install conda-build conda-verify

Expand Down
18 changes: 1 addition & 17 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["2.7", "3.5", "3.8", "3.9"]
python-version: ["3.6", "3.10"]

runs-on: ${{ matrix.platform }}

Expand All @@ -27,22 +27,6 @@ jobs:
- name: Add requirements
run: python -m pip install --upgrade wheel setuptools

# Eventually Microsoft might have an action for setting up
# MSVC, but for now, this action works:
- name: Prepare compiler environment for Windows 🐍 2.7
if: matrix.python-version == 2.7 && runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

# This makes two environment variables available in the following step(s)
- name: Set Windows 🐍 2.7 environment variables
if: matrix.python-version == 2.7 && runner.os == 'Windows'
shell: bash
run: |
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
echo "MSSdk=1" >> $GITHUB_ENV

- name: Build and install
run: pip install --verbose .

Expand Down
53 changes: 3 additions & 50 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ on:
types:
- published

env:
CIBW_TEST_COMMAND: python {project}/tests/test.py
CIBW_ARCHS_MACOS: auto universal2
CIBW_TEST_SKIP: "*universal2:arm64"


jobs:
build_sdist:
name: Build SDist
Expand Down Expand Up @@ -45,11 +39,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: pypa/cibuildwheel@v1.12.0
- uses: pypa/cibuildwheel@v2.2.0
env:
# Python 2.7 on Windows requires a workaround for C++11 support,
# built separately below
CIBW_SKIP: cp27-win*
CIBW_ARCHS_MACOS: auto universal2

- name: Verify clean directory
run: git diff --exit-code
Expand All @@ -61,48 +53,9 @@ jobs:
path: wheelhouse/*.whl


# Windows 2.7 (requires workaround for MSVC 2008 replacement)
build_win27_wheels:
name: Py 2.7 wheels on Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: ilammy/msvc-dev-cmd@v1

- name: Build 64-bit wheel
uses: pypa/[email protected]
env:
CIBW_BUILD: cp27-win_amd64
DISTUTILS_USE_SDK: 1
MSSdk: 1

- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86

- name: Build 32-bit wheel
uses: pypa/[email protected]
env:
CIBW_BUILD: cp27-win32
DISTUTILS_USE_SDK: 1
MSSdk: 1

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl


upload_all:
name: Upload if release
needs: [build_wheels, build_win27_wheels, build_sdist]
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

Expand Down
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
exclude: ^conda\.recipe/meta\.yaml$
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace

# Black, the code formatter, natively supports pre-commit
- repo: https://github.com/psf/black
rev: 21.9b0
hooks:
- id: black
files: ^(docs)

# Sort your imports in a standard form
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
hooks:
- id: isort

# Upgrade older Python syntax
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
hooks:
- id: pyupgrade
args: ["--py36-plus"]

# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.10
hooks:
- id: remove-tabs

# Suggested hook if you add a .clang-format file
# - repo: https://github.com/pre-commit/mirrors-clang-format
# rev: v13.0.0
# hooks:
# - id: clang-format
35 changes: 3 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,21 @@ python_example
[actions-wheels-link]: https://github.com/pybind/python_example/actions?query=workflow%3AWheels
[actions-wheels-badge]: https://github.com/pybind/python_example/workflows/Wheels/badge.svg
[travis-link]: https://travis-ci.org/pybind/python_example
[travis-badge]: https://travis-ci.org/pybind/python_example.svg?branch=master&status=passed
[travis-badge]: https://travis-ci.org/pybind/python_example.svg?branch=master&status=passed
[appveyor-link]: https://ci.appveyor.com/project/wjakob/python-example
<!-- TODO: get a real badge link for appveyor -->
[appveyor-badge]: https://travis-ci.org/pybind/python_example.svg?branch=master&status=passed

An example project built with [pybind11](https://github.com/pybind/pybind11).
This requires Python 3.6+; for older versions of Python, check the commit
history.

Installation
------------

**On Unix (Linux, OS X)**

- clone this repository
- `pip install ./python_example`

**On Windows (Requires Visual Studio 2015)**

- For Python 3.5+:
- clone this repository
- `pip install ./python_example`
- For Python 2.7:

Pybind11 requires a C++11 compliant compiler (i.e. Visual Studio 2015 on
Windows). Running a regular `pip install` command will detect the version
of the compiler used to build Python and attempt to build the extension
with it. We must force the use of Visual Studio 2015.

- clone this repository
- `"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64`
- `set DISTUTILS_USE_SDK=1`
- `set MSSdk=1`
- `pip install ./python_example`

Note that this requires the user building `python_example` to have registry edition
rights on the machine, to be able to run the `vcvarsall.bat` script.

CI Examples
-----------

Expand All @@ -65,14 +44,6 @@ binary "wheels" for all platforms is illustrated in the "wheels.yml" file,
using [`cibuildwheel`][]. You can also see a basic recipe for building and
testing in `pip.yml`, and `conda.yml` has an example of a conda recipe build.

Windows Python 2.7 runtime requirements
----------------------------

On Windows, the Visual C++ 2015 redistributable packages are a runtime
requirement for this project if you build for Python 2.7 (newer versions of
Python include this redistributable). It can be found
[here](https://www.microsoft.com/en-us/download/details.aspx?id=48145).


Building the documentation
--------------------------
Expand Down
Loading