Skip to content

Commit f00108b

Browse files
authored
chore: drop Python 2 and 3.5 (#512)
* chore: drop Python 2 and 3.5, mostly using pyupgrade * chore: continue to drop Python 2 workarounds * chore: drop workarounds for Python 2 * refactor: a few more small places with Python 2 * refactor: a few more type: converted to real annotations * ci: check all files not just changed ones * ci: support pre-commit.ci
1 parent 353730e commit f00108b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+403
-827
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/setup-python@v2
2020
- uses: pre-commit/[email protected]
2121
with:
22-
extra_args: --hook-stage manual
22+
extra_args: -a --hook-stage manual
2323

2424
clang-tidy:
2525
name: Clang-Tidy
@@ -49,7 +49,7 @@ jobs:
4949
strategy:
5050
fail-fast: false
5151
matrix:
52-
python-version: ["2.7", "3.5", "3.9", "pypy3"]
52+
python-version: ["3.6", "3.9", "pypy3"]
5353
include:
5454
- python-version: "3.8"
5555
cmake-extras: "-DCMAKE_CXX_STANDARD=17"
@@ -92,7 +92,7 @@ jobs:
9292

9393
- uses: joerick/[email protected]
9494
env:
95-
CIBW_BUILD: cp38-win_amd64 cp27-manylinux_i686 cp37-macosx_x86_64
95+
CIBW_BUILD: cp38-win_amd64 cp36-manylinux_i686 cp37-macosx_x86_64
9696
CIBW_TEST_EXTRAS: test
9797
CIBW_TEST_COMMAND: pytest {project}/tests
9898
CIBW_BUILD_VERBOSITY: 1

.github/workflows/wheels.yml

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ jobs:
8989
include:
9090
- os: ubuntu-latest
9191
arch: auto
92-
build: "cp3* pp*"
92+
build: "pp*"
9393
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
9494
CIBW_MANYLINUX_I686_IMAGE: manylinux2010
9595

9696
- os: ubuntu-latest
9797
type: ManyLinux1
9898
arch: auto
99-
build: "cp{27,35,36,37,38}-*"
99+
build: "cp{36,37,38}-*"
100100
CIBW_MANYLINUX_X86_64_IMAGE: skhep/manylinuxgcc-x86_64
101101
CIBW_MANYLINUX_I686_IMAGE: skhep/manylinuxgcc-i686
102102

@@ -116,7 +116,6 @@ jobs:
116116
- uses: joerick/[email protected]
117117
env:
118118
CIBW_BUILD: ${{ matrix.build }}
119-
CIBW_SKIP: cp27-win* pp27-win*
120119
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.CIBW_MANYLINUX_I686_IMAGE }}
121120
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.CIBW_MANYLINUX_X86_64_IMAGE }}
122121
CIBW_ARCHS: ${{ matrix.arch }}
@@ -131,48 +130,9 @@ jobs:
131130
path: wheelhouse/*.whl
132131

133132

134-
# Windows 2.7 (requires pybind11 workaround)
135-
build_win27_wheels:
136-
name: Py 2.7 wheels on Windows
137-
runs-on: windows-latest
138-
139-
steps:
140-
- uses: actions/checkout@v1
141-
with:
142-
submodules: true
143-
144-
- uses: ilammy/msvc-dev-cmd@v1
145-
146-
- name: Build 64-bit wheel
147-
uses: joerick/[email protected]
148-
env:
149-
CIBW_BUILD: cp27-win_amd64
150-
DISTUTILS_USE_SDK: 1
151-
MSSdk: 1
152-
153-
- uses: ilammy/msvc-dev-cmd@v1
154-
with:
155-
arch: x86
156-
157-
- name: Build 32-bit wheel
158-
uses: joerick/[email protected]
159-
env:
160-
CIBW_BUILD: cp27-win32
161-
DISTUTILS_USE_SDK: 1
162-
MSSdk: 1
163-
164-
- name: Verify clean directory
165-
run: git diff --exit-code
166-
shell: bash
167-
168-
- uses: actions/upload-artifact@v2
169-
with:
170-
path: wheelhouse/*.whl
171-
172-
173133
upload_all:
174134
name: Upload if release
175-
needs: [build_wheels, build_win27_wheels, build_arch_wheels, build_sdist]
135+
needs: [build_wheels, build_arch_wheels, build_sdist]
176136
runs-on: ubuntu-latest
177137
if: github.event_name == 'release' && github.event.action == 'published'
178138

.pre-commit-config.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ci:
2+
skip: [docker-clang-format]
3+
14
repos:
25
- repo: https://github.com/psf/black
36
rev: 20.8b1
@@ -22,7 +25,6 @@ repos:
2225
- id: check-yaml
2326
- id: debug-statements
2427
- id: end-of-file-fixer
25-
- id: fix-encoding-pragma
2628
- id: mixed-line-ending
2729
- id: requirements-txt-fixer
2830
- id: trailing-whitespace
@@ -37,6 +39,7 @@ repos:
3739
rev: v2.10.0
3840
hooks:
3941
- id: pyupgrade
42+
args: [--py36-plus]
4043

4144
- repo: https://github.com/PyCQA/isort
4245
rev: 5.7.0
@@ -47,7 +50,6 @@ repos:
4750
rev: v1.16.0
4851
hooks:
4952
- id: setup-cfg-fmt
50-
args: [--min-py3-version, "3.5"]
5153

5254
- repo: https://github.com/pycqa/flake8
5355
rev: 3.8.4
@@ -61,6 +63,7 @@ repos:
6163
hooks:
6264
- id: mypy
6365
files: src
66+
additional_dependencies: [numpy==1.20.1]
6467

6568
- repo: https://github.com/mgedmin/check-manifest
6669
rev: "0.46"

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10...3.18)
1+
cmake_minimum_required(VERSION 3.10...3.19)
22

33
project(BOOST_HISTOGRAM LANGUAGES CXX)
44
# Version is added later
@@ -120,10 +120,6 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" MATC
120120
target_compile_options(_core PRIVATE -Werror)
121121
endif()
122122

123-
# Python 2 will not be compatible with C++17, but let's not be reminded of that over and over again here.
124-
if("${PYTHON_VERSION_MAJOR}" LESS 3 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
125-
target_compile_options(_core PRIVATE -Wno-deprecated-register)
126-
endif()
127123
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
128124
target_compile_options(_core PRIVATE /W4)
129125
if(BOOST_HISTOGRAM_ERRORS)

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ git submodule update --init --depth 10
2727

2828
While developers often work in CMake, the "correct" way to develop a python
2929
package is in a virtual environment. This is how you would set one up with
30-
Python 3:
30+
Python's built-in venv:
3131

3232
```bash
3333
python3 -m venv .env
3434
source ./.env/bin/activate
35+
pip install -U pip
3536
pip install -ve .[all]
3637
```
3738

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,18 @@ Wheels are produced using [cibuildwheel](https://cibuildwheel.readthedocs.io/en/
165165

166166
| System | Arch | Python versions | PyPy versions |
167167
|---------|-----|------------------|--------------|
168-
| ManyLinux1 (custom GCC 9.2) | 32 & 64-bit | 2.7, 3.5, 3.6, 3.7, 3.8 | |
169-
| ManyLinux2010 | 32 & 64-bit | 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 | 7.3: 2.7, 3.6, 3.7 |
168+
| ManyLinux1 (custom GCC 9.2) | 32 & 64-bit | 3.6, 3.7, 3.8 | |
169+
| ManyLinux2010 | 32 & 64-bit | 3.6, 3.7, 3.8, 3.9 | 7.3: 3.6, 3.7 |
170170
| ManyLinux2014 | ARM64 | 3.6, 3.7, 3.8, 3.9 | |
171-
| macOS 10.9+ | 64-bit | 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 | 7.3: 2.7, 3.6, 3.7 |
171+
| macOS 10.9+ | 64-bit | 3.6, 3.7, 3.8, 3.9 | 7.3: 3.6, 3.7 |
172172
| macOS Universal2 | Arm64 | 3.9 | |
173-
| Windows | 32 & 64-bit | 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 | (32 bit) 7.3: 2.7, 3.6, 3.7 |
173+
| Windows | 32 & 64-bit | 3.6, 3.7, 3.8, 3.9 | (32 bit) 7.3: 3.6, 3.7 |
174174

175175

176176
* manylinux1: Using a custom docker container with GCC 9; should work but can't be called directly other compiled extensions unless they do the same thing (think that's the main caveat). Supporting 32 bits because it's there. Anything running Python 3.9 should be compatible with manylinux2010, so manylinux1 not provided for Python 3.9 (like NumPy).
177177
* manylinux2010: Requires pip 10+ and a version of Linux newer than 2010.
178-
* Windows: pybind11 requires compilation with a newer copy of Visual Studio than Python 2.7's Visual Studio 2008; you need to have the [Visual Studio 2015 distributable][msvc2015] installed (the dll is included in 2017 and 2019, as well).
179-
* PyPy: Supported on all platforms that `cibuildwheel` supports, in pypy2, pypy3.6, and pypy3.7 variants.
180-
* ARM on Linux is supported for newer Python versions via manylinux2014. PowerPC or IBM-Z available on request.
178+
* PyPy: Supported for both pypy3.6 and pypy3.7 variants.
179+
* ARM on Linux is supported for newer Python versions via `manylinux2014`. PowerPC or IBM-Z available on request, or `manylinux_2_24`.
181180
* macOS Universal2 wheels for Apple Silicon and Intel provided for Python 3.9 (requires Pip 21.0.1).
182181

183182
[msvc2015]: https://www.microsoft.com/en-us/download/details.aspx?id=48145
@@ -187,7 +186,7 @@ If you are on a Linux system that is not part of the "many" in manylinux, such a
187186

188187
#### Conda-Forge
189188

190-
The boost-histogram package is available on Conda-Forge, as well. All supported versions are available with the exception of Python 2.7, which is no longer supported by conda-forge directly.
189+
The boost-histogram package is available on Conda-Forge, as well. All supported variants are available.
191190

192191
```bash
193192
conda install -c conda-forge boost-histogram
@@ -197,8 +196,6 @@ conda install -c conda-forge boost-histogram
197196

198197
For a source build, for example from an "sdist" package, the only requirements are a C++14 compatible compiler. The compiler requirements are dictated by Boost.Histogram's C++ requirements: gcc >= 5.5, clang >= 3.8, msvc >= 14.1. You should have a version of pip less than 2-3 years old (10+).
199198

200-
If you are using Python 2.7 on Windows, you will need to use a recent version of Visual studio and force distutils to use it, or just upgrade to Python 3.6 or newer. Check the pybind11 documentation for [more help](https://pybind11.readthedocs.io/en/stable/faq.html#working-with-ancient-visual-studio-2009-builds-on-windows). On some Linux systems, you may need to use a newer compiler than the one your distribution ships with.
201-
202199
Boost is not required or needed (this only depends on included header-only dependencies). This library is under active development; you can install directly from GitHub if you would like.
203200

204201
```bash

dev-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
dataclasses; python_version<'3.7'
12
numpy
23
pytest !=6.1.0
34
pytest-benchmark
45
setuptools >=42
56
setuptools_scm[toml] >=3.4,!=4.0.0
6-
typing; python_version < '3.5'
7-
typing_extensions
7+
typing_extensions; python_version<'3.8'

docs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Version 1.0
44

5+
Dropped support for Python 2 and 3.5; removed large numbers of workarounds.
6+
57
* Removed deprecated `.options` from axes. Use `.traits` instead. [#503][]
68

79
[#503]: https://github.com/scikit-hep/boost-histogram/pull/503

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# To regenerate API docs:
32
# sphinx-apidoc -o api ../src/boost_histogram -M -f -t template/
43

docs/usage/axes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Category axis
111111

112112
You should put integers in a category axis; but unlike an integer axis, the integers do not need to be adjacent.
113113

114-
One use for an IntCategory axis is for an IntEnum (Python 3):
114+
One use for an IntCategory axis is for an IntEnum:
115115

116116
.. code:: python3
117117

0 commit comments

Comments
 (0)