Skip to content
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

Add Python 3.12 to build matrix, Remove usage of deprecated distutils #2458

Closed
wants to merge 2 commits into from
Closed
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
28 changes: 24 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ jobs:
- 3.9
- "3.10"
- 3.11
- 3.12
container:
- none # Not manylinux, we will use this space to build the WASM assets
- 2014
Expand Down Expand Up @@ -881,7 +882,7 @@ jobs:
- is-full-run: false
os: macos-11

# Exclude Python 3.7, 3.8, 3.10, 3.11 builds
# Exclude Python 3.7, 3.8, 3.10, 3.11, 3.12 builds
- is-full-run: false
python-version: 3.7

Expand All @@ -894,6 +895,9 @@ jobs:
- is-full-run: false
python-version: 3.11

- is-full-run: false
python-version: 3.12

# NOTE: don't fail fast as sometimes npm blocks the burst of fetches from GHA
fail-fast: false
##################################
Expand Down Expand Up @@ -1388,6 +1392,7 @@ jobs:
- 3.9
- "3.10"
- 3.11
- 3.12
node-version: [18.x]
is-full-run:
- ${{ needs.initialize.outputs.FULL_RUN == 'true' }}
Expand All @@ -1410,7 +1415,7 @@ jobs:
- python-version: 3.7
os: macos-11

# Exclude Python 3.7, 3.8, 3.10, 3.11 builds
# Exclude Python 3.7, 3.8, 3.10, 3.11, 3.12 builds
- is-full-run: false
python-version: 3.7

Expand All @@ -1422,6 +1427,9 @@ jobs:

- is-full-run: false
python-version: 3.11

- is-full-run: false
python-version: 3.12
# NOTE: don't fail fast as sometimes npm blocks the burst of fetches from GHA
fail-fast: false

Expand Down Expand Up @@ -1523,11 +1531,11 @@ jobs:
# would need an arm machine to test
- name: Install wheel (OSX)
run: python -m pip install -U --no-dependencies *x86*.whl --target python/perspective
if: ${{ runner.os == 'macOS' && matrix.python-version != '3.11' }}
if: ${{ runner.os == 'macOS' && matrix.python-version != '3.11' && matrix.python-version != '3.12' }}

- name: Install wheel (OSX 3.11+)
run: python -m pip install -U --no-dependencies *universal*.whl --target python/perspective
if: ${{ runner.os == 'macOS' && matrix.python-version == '3.11' }}
if: ${{ runner.os == 'macOS' && (matrix.python-version == '3.11' || matrix.python-version == '3.12') }}

- name: Install wheel (windows)
run: python -m pip install -U --no-dependencies (Get-ChildItem .\*.whl | Select-Object -Expand FullName) --target python/perspective
Expand Down Expand Up @@ -1909,6 +1917,10 @@ jobs:
with:
name: perspective-python-dist-ubuntu-20.04-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.12

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.7
Expand All @@ -1929,6 +1941,10 @@ jobs:
with:
name: perspective-python-dist-macos-11-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.12

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-windows-2022-3.7
Expand All @@ -1949,6 +1965,10 @@ jobs:
with:
name: perspective-python-dist-windows-2022-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-windows-2022-3.12

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-pyodide
Expand Down
17 changes: 16 additions & 1 deletion python/perspective/perspective/table/_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

from distutils.util import strtobool
from math import isnan

import numpy
Expand All @@ -23,6 +22,22 @@
from .libpsppy import t_dtype


def strtobool(val):
"""Convert a string representation of truth to true (1) or false (0).

True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
'val' is anything else.
"""
val = val.lower()
if val in ("y", "yes", "t", "true", "on", "1"):
return 1
elif val in ("n", "no", "f", "false", "off", "0"):
return 0
else:
raise ValueError("invalid truth value {!r}".format(val))


def _flatten_structure(array):
"""Flatten numpy.recarray or structured arrays into a dict."""
# recarrays/structured arrays do not have guaranteed bit offsets - make a
Expand Down
6 changes: 3 additions & 3 deletions python/perspective/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

[build-system]
requires = [
"setuptools",
"wheel",
"numpy>=1.13.1,<2",
"jupyter-packaging==0.12.3",
"numpy>=1.13.1,<2",
"setuptools==68.2.2",
"wheel",
]
build-backend = "jupyter_packaging.build_api"

Expand Down
157 changes: 157 additions & 0 deletions python/perspective/requirements/requirements-312.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
Babel==2.13.1
Faker==20.0.3
Jinja2==3.1.2
MarkupSafe==2.1.3
PyYAML==6.0.1
Pygments==2.16.1
Send2Trash==1.8.2
Sphinx==7.2.6
aiofiles==22.1.0
aiohttp==3.9.1
aiosignal==1.3.1
aiosqlite==0.19.0
alabaster==0.7.13
annotated-types==0.6.0
anyio==3.7.1
appnope==0.1.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
async-timeout==4.0.3
attrs==23.1.0
beautifulsoup4==4.12.2
black==23.1.0
bleach==6.1.0
certifi==2023.7.22
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
comm==0.2.0
coverage==7.3.2
debugpy==1.8.0
decorator==5.1.1
defusedxml==0.7.1
deprecation==2.1.0
docutils==0.20.1
executing==2.0.1
fastapi==0.104.1
fastjsonschema==2.19.0
flake8==6.1.0
flake8-black==0.3.6
fqdn==1.5.1
frozenlist==1.4.0
h11==0.14.0
html5lib==1.1
httpcore==1.0.2
httpx==0.25.1
idna==3.4
imagesize==1.4.1
iniconfig==2.0.0
ipykernel==6.26.0
ipython==8.17.2
ipython-genutils==0.2.0
ipywidgets==8.1.1
isoduration==20.11.0
jedi==0.19.1
json5==0.9.14
jsonpointer==2.4
jsonschema==4.19.2
jsonschema-specifications==2023.11.1
jupyter-events==0.9.0
jupyter-ydoc==0.2.5
jupyter_client==8.6.0
jupyter_core==5.5.0
jupyter_packaging==0.12.3
jupyter_server==2.10.1
jupyter_server_fileid==0.9.0
jupyter_server_terminals==0.4.4
jupyter_server_ydoc==0.8.0
jupyterlab==3.6.6
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.9
jupyterlab_server==2.25.1
matplotlib-inline==0.1.6
mccabe==0.7.0
mistune==3.0.2
multidict==6.0.4
mypy-extensions==1.0.0
nbclassic==1.0.0
nbclient==0.9.0
nbconvert==7.11.0
nbformat==5.9.2
nest-asyncio==1.5.8
notebook==6.5.4
notebook_shim==0.2.3
numpy==1.26.2
overrides==7.4.0
packaging==23.2
pandas==2.1.3
pandocfilters==1.5.0
parso==0.8.3
pathspec==0.11.2
pexpect==4.8.0
pip==23.3.1
platformdirs==4.0.0
pluggy==1.3.0
prometheus-client==0.18.0
prompt-toolkit==3.0.41
psutil==5.9.6
ptyprocess==0.7.0
pure-eval==0.2.2
pyarrow==14.0.1
pybind11==2.11.1
pycodestyle==2.11.1
pycparser==2.21
pydantic==2.5.1
pydantic_core==2.14.3
pyflakes==3.1.0
pytest==7.4.3
pytest-aiohttp==1.0.5
pytest-asyncio==0.21.1
pytest-cov==4.1.0
pytest-tornado==0.8.1
pytest_check_links==0.9.0
python-dateutil==2.8.2
python-json-logger==2.0.7
pytz==2023.3.post1
pyzmq==25.1.1
referencing==0.31.0
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.12.0
setuptools==68.2.2
six==1.16.0
sniffio==1.3.0
snowballstemmer==2.2.0
soupsieve==2.5
sphinx-markdown-builder==0.6.5
sphinxcontrib-applehelp==1.0.7
sphinxcontrib-devhelp==1.0.5
sphinxcontrib-htmlhelp==2.0.4
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.6
sphinxcontrib-serializinghtml==1.1.9
stack-data==0.6.3
starlette==0.27.0
tabulate==0.9.0
terminado==0.18.0
tinycss2==1.2.1
tomlkit==0.12.3
tornado==6.3.3
traitlets==5.13.0
types-python-dateutil==2.8.19.14
typing_extensions==4.8.0
tzdata==2023.3
uri-template==1.3.0
urllib3==2.1.0
wcwidth==0.2.10
webcolors==1.13
webencodings==0.5.1
websocket-client==1.6.4
wheel==0.41.3
widgetsnbextension==4.0.9
y-py==0.6.2
yarl==1.9.2
ypy-websocket==0.8.4
7 changes: 4 additions & 3 deletions python/perspective/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import sys
import sysconfig
from codecs import open
from distutils.version import LooseVersion
from setuptools._distutils.version import LooseVersion
from jupyter_packaging import get_data_files, wrap_installers, get_version

from setuptools import Extension, find_packages, setup
Expand Down Expand Up @@ -56,8 +56,8 @@
########################
# Get requirement info #
requires = [
"Jinja2>=2.0,<4",
"ipywidgets>=7.5.1,<9",
"Jinja2>=2.0,<4",
"numpy>=1.21.6,<2",
"pandas>=0.22.0,<3",
"python-dateutil>=2.8.0,<3",
Expand Down Expand Up @@ -160,7 +160,7 @@ def build_extension_cmake(self, ext):
env = os.environ.copy()

if platform.system() == "Windows":
import distutils.msvccompiler as dm
import setuptools._distutils.msvccompiler as dm

# https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.0_with_Visual_Studio_2015_.28x86.2C_x64.2C_ARM.29
msvc = {
Expand Down Expand Up @@ -311,6 +311,7 @@ def run_check(self):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: Jupyter :: JupyterLab",
"Framework :: Jupyter :: JupyterLab :: 3",
"Framework :: Jupyter :: JupyterLab :: Extensions",
Expand Down
2 changes: 1 addition & 1 deletion tools/perspective-scripts/_requires_python.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
let PYTHON = sh(python_version());

if (process.env.PSP_OLD_SHITTY_INSTALL_METHOD) {
const requires_script = `import distutils.core; setup = distutils.core.run_setup('python/perspective/setup.py'); print(' '.join(['"' + requirement + '"' for requirement in setup.extras_require['dev']]))`;
const requires_script = `import setuptools._distutils.core; setup = setuptools._distutils.core.run_setup('python/perspective/setup.py'); print(' '.join(['"' + requirement + '"' for requirement in setup.extras_require['dev']]))`;

// copy build/config files into python folder
copy_files_to_python_folder();
Expand Down
8 changes: 6 additions & 2 deletions tools/perspective-scripts/sh_perspective.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ export function python_version(manylinux) {
return `/opt/python/cp${v}-cp${v}${
v === "37" || v === "36" ? "m" : ""
}/bin/python`;
} else if (getarg("--python312")) {
return `/opt/python/cp312-cp312/bin/python`;
} else if (getarg("--python311")) {
return `/opt/python/cp311-cp311/bin/python`;
} else if (getarg("--python310")) {
Expand All @@ -292,6 +294,8 @@ export function python_version(manylinux) {
} else {
if (process.env.PYTHON_VERSION) {
return `python${process.env.PYTHON_VERSION}`;
} else if (getarg("--python312")) {
return "python3.12";
} else if (getarg("--python311")) {
return "python3.11";
} else if (getarg("--python310")) {
Expand Down Expand Up @@ -344,8 +348,8 @@ sh.docker = function docker(...args) {
${env_vars} \
-v${CWD}:/usr/src/app/perspective \
-w /usr/src/app/perspective --shm-size=2g -u root \
--cpus="${CPUS}.0"
${IMAGE}
--cpus="${CPUS}.0"
${IMAGE}
bash -c ${sh(...args).toString()}`;
};

Expand Down
1 change: 1 addition & 0 deletions tools/perspective-scripts/update_python.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const VERSIONS = [
"3.9",
"3.10",
"3.11",
"3.12",
];

for (const version of VERSIONS) {
Expand Down
Loading