Skip to content

Commit

Permalink
Drop Python 3.8, 3.9 and add Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ajjackson committed Jul 17, 2024
1 parent e85ded5 commit 984a023
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 48 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/build_upload_pypi_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, macos-13, ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.10', '3.11']
include:
- os: windows-latest
wheelname: win
Expand All @@ -19,12 +19,6 @@ jobs:
- os: ubuntu-latest
wheelname: manylinux
# Build wheels against the lowest compatible Numpy version
- python-version: 3.8
manylinux-version-tag: cp38
numpy-version: 1.19.5
- python-version: 3.9
manylinux-version-tag: cp39
numpy-version: 1.19.5
- python-version: 3.10
manylinux-version-tag: cp310
numpy-version: 1.21.3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.8
python-version: "3.10"
channels: conda-forge,defaults
channel-priority: true
- name: Install llvm on Macos
Expand All @@ -36,10 +36,10 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -r tests_and_analysis/ci_requirements.txt
- name: Run tests, skip Python 3.9, 3.10 unless workflow dispatch
- name: Run tests, skip Python 3.11 unless workflow dispatch
if: github.event_name != 'workflow_dispatch'
env:
TOX_SKIP_ENV: '.*?(py39|py310).*?'
TOX_SKIP_ENV: '.*?(py311).*?'
shell: bash -l {0}
run: python -m tox
- name: Run tests, workflow dispatch so test all Python versions
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.8
python-version: 3.10
channels: conda-forge,defaults
channel-priority: true
- name: Update pip and install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
python-version: 3.10
channels: conda-forge,defaults
channel-priority: true
- name: Install llvm on Macos
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=1.14.5
numpy>=1.19.5
sphinx==5.3.0
sphinx-argparse==0.3.2
sphinx-autodoc-typehints==1.19.5
Expand Down
2 changes: 1 addition & 1 deletion doc/source/cite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ or it can be read programatically as follows:

import yaml
import euphonic
from importlib_resources import files
from importlib.resources import files

with open(files(euphonic) / 'CITATION.cff') as fp:
citation_data = yaml.safe_load(fp)
Expand Down
4 changes: 2 additions & 2 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installation

.. contents:: :local:

Euphonic has been tested on Python 3.8 - 3.10.
Euphonic has been tested on Python 3.10 - 3.12.

Pip
===
Expand Down Expand Up @@ -47,7 +47,7 @@ To create a "complete" installation in a new environment:

.. code-block:: bash
conda create -n euphonic-forge -c conda-forge python=3.8 euphonic matplotlib-base pyyaml tqdm h5py
conda create -n euphonic-forge -c conda-forge python=3.10 euphonic matplotlib-base pyyaml tqdm h5py
This creates an environment named "euphonic-forge", which can be
entered with ``activate euphonic-forge`` and exited with
Expand Down
3 changes: 2 additions & 1 deletion euphonic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from importlib.resources import files

Check notice on line 1 in euphonic/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

euphonic/__init__.py#L1

Missing module docstring

from . import _version
__version__ = _version.get_versions()['version']

import pint
from pint import UnitRegistry
from importlib_resources import files

# Create ureg here so it is only created once
ureg = UnitRegistry()
Expand Down
2 changes: 1 addition & 1 deletion euphonic/styles/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Matplotlib stylesheets for plot styling"""
from importlib_resources import files
from importlib.resources import files

base_style = files(__package__) / "base.mplstyle"
intensity_widget_style = files(__package__) / "intensity_widget.mplstyle"
2 changes: 1 addition & 1 deletion euphonic/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import OrderedDict
from functools import reduce
from importlib.resources import files
import itertools
import json
import math
Expand All @@ -11,7 +12,6 @@
import numpy as np
import seekpath
from seekpath.hpkot import SymmetryDetectionError
from importlib_resources import files
from pint import UndefinedUnitError

from euphonic import ureg, Quantity
Expand Down
16 changes: 8 additions & 8 deletions release_tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Use conda to set up the python environments to run in
requires = tox-conda
# The python environments to run the tests in
envlist = pypi-py38-min,conda-py38-old-np,{pypi,conda}-{py38,py39,py310,py311},pypisource-{py38,py311}
envlist = pypi-py310-min,conda-py310-old-np,{pypi,conda}-{py310,py311,py312},pypisource-{py310,py312}
# Skip the execution of setup.py as we do it with the correct version in commands_pre below
skipsdist = True

Expand All @@ -11,7 +11,7 @@ changedir = tests_and_analysis/test
test_command = python run_tests.py --report

# Test PyPI source distribution
[testenv:pypisource-{py38,py311}]
[testenv:pypisource-{py310,py312}]
install_command = python -m pip install {opts} {packages}
deps =
numpy
Expand All @@ -24,7 +24,7 @@ commands_pre =
commands = {[testenv]test_command}


[testenv:pypi-{py38,py39,py310,py311}]
[testenv:pypi-{py310,py311,py312}]
install_command = python -m pip install {opts} {packages}
deps =
numpy
Expand All @@ -36,10 +36,10 @@ commands_pre =
--only-binary 'euphonic'
commands = {[testenv]test_command}

[testenv:pypi-py38-min]
[testenv:pypi-py310-min]
install_command = python -m pip install --force-reinstall {opts} {packages}
deps =
numpy==1.19.5
numpy==1.21.3
commands_pre =
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt
Expand All @@ -50,7 +50,7 @@ commands_pre =
--only-binary 'euphonic'
commands = {[testenv]test_command}

[testenv:conda-{py38,py39,py310,py311}]
[testenv:conda-{py310,py311,py312}]
whitelist_externals = conda
install_command = conda install {packages}
conda_channels =
Expand All @@ -65,7 +65,7 @@ commands = {[testenv]test_command} -m "not brille"

# Test against a version of Numpy less than the latest for Conda
# See https://github.com/conda-forge/euphonic-feedstock/pull/20
[testenv:conda-py38-old-np]
[testenv:conda-py310-old-np]
whitelist_externals = conda
install_command = conda install {packages}
conda_channels =
Expand All @@ -74,7 +74,7 @@ conda_channels =
conda_deps =
--file={toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
conda install numpy=1.20
conda install numpy=1.22
conda install -c conda-forge euphonic={env:EUPHONIC_VERSION} matplotlib-base pyyaml h5py
# Brille not available on conda
commands = {[testenv]test_command} -m "not brille"
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,15 @@ def run_setup():
include_package_data=True,
install_requires=[
'packaging',
'scipy>=1.10', # requires numpy >= 1.19.5
'scipy>=1.10', # requires numpy >= 1.19.5; py3.10 requires 1.21.3
'seekpath>=1.1.0',
'spglib>=1.9.4',
'pint>=0.19',
'importlib_resources>=1.3.0', # equivalent to Python 3.9
'pint>=0.22',
'threadpoolctl>=1.0.0'
],
extras_require={
'matplotlib': ['matplotlib>=3.2.0'],
'phonopy_reader': ['h5py>=2.10.0', 'PyYAML>=3.13'],
'matplotlib': ['matplotlib>=3.8.0'],
'phonopy_reader': ['h5py>=3.6.0', 'PyYAML>=3.13'],
'brille': ['brille>=0.7.0']
},
entry_points={'console_scripts': [
Expand Down
9 changes: 4 additions & 5 deletions tests_and_analysis/minimum_euphonic_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
numpy==1.19.5
numpy==1.21.3
scipy==1.10.0
spglib==1.9.4.2
seekpath==1.1.0
pint==0.19.0
importlib_resources==1.3.0
matplotlib==3.2.0
h5py==2.10.0
pint==0.22
matplotlib==3.8
h5py==3.6
PyYAML==3.13
threadpoolctl==1.0.0
2 changes: 1 addition & 1 deletion tests_and_analysis/test/euphonic_test/test_install.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from importlib_resources import files
from importlib.resources import files

import pytest

Expand Down
18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[tox]
requires = tox-conda
# The python environments to run the tests in
envlist = py38,py39,py310,py311,py38-{base,matplotlib,phonopy_reader,brille,all},py38-minrequirements-linux
envlist = py310,py311,py312,py310-{base,matplotlib,phonopy_reader,brille,all},py310-minrequirements-linux
# Skip the execution of setup.py as we do it with the correct arg in commands_pre below
skipsdist = True

[testenv]
changedir = tests_and_analysis/test
test_command = python run_tests.py --report

[testenv:{py38,py39,py310,py311}]
[testenv:{py310,py311,py312}]
install_command =
python -m pip install \
--force-reinstall \
Expand All @@ -29,7 +29,7 @@ commands =
{[testenv]test_command} --cov

# Test with no extras
[testenv:py38-base]
[testenv:py310-base]
install_command = {[testenv:py310]install_command}
deps = {[testenv:py310]deps}
commands_pre =
Expand All @@ -40,7 +40,7 @@ commands_pre =
commands = {[testenv]test_command} --cov -m "not (phonopy_reader or matplotlib or brille)"

# Test with matplotlib extra only
[testenv:py38-matplotlib]
[testenv:py310-matplotlib]
install_command = {[testenv:py310]install_command}
deps = {[testenv:py310]deps}
commands_pre =
Expand All @@ -51,7 +51,7 @@ commands_pre =
commands = {[testenv]test_command} --cov -m "matplotlib and not multiple_extras"

# Test with phonopy_reader extra only
[testenv:py38-phonopy_reader]
[testenv:py310-phonopy_reader]
install_command = {[testenv:py310]install_command}
deps = {[testenv:py310]deps}
commands_pre =
Expand All @@ -62,7 +62,7 @@ commands_pre =
commands = {[testenv]test_command} --cov -m "phonopy_reader and not multiple_extras"

# Test with brille extra only
[testenv:py38-brille]
[testenv:py310-brille]
install_command = {[testenv:py310]install_command}
deps = {[testenv:py310]deps}
commands_pre =
Expand All @@ -73,7 +73,7 @@ commands_pre =
commands = {[testenv]test_command} --cov -m "brille and not multiple_extras"

# Run remaining tests that require multiple extras
[testenv:py38-all]
[testenv:py310-all]
install_command = {[testenv:py310]install_command}
deps = {[testenv:py310]deps}
commands_pre =
Expand All @@ -84,14 +84,14 @@ commands_pre =
commands =
{[testenv]test_command} --cov -m multiple_extras

[testenv:py38-minrequirements-linux]
[testenv:py310-minrequirements-linux]
whitelist_externals = rm
install_command =
python -m pip install --force-reinstall {opts} {packages}
platform =
linux: linux
deps =
numpy==1.19.5
numpy==1.21.3
commands_pre =
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt
Expand Down

0 comments on commit 984a023

Please sign in to comment.