Skip to content

Commit

Permalink
Add Python 3.12 and limit MacOS/Window's tests. (#957)
Browse files Browse the repository at this point in the history
* ci: Add Python 3.12 and limit MacOS/Window's tests.

* doc: Update changelog

* misc: Add Python 3.12 to pyproject tags

* ci: Apply fixes

Co-authored-by: Joshua A. Anderson <[email protected]>

* ci: Further fixes.

* fix: Remove Deprecation errors in Python 3.12

* fix: Correctly check minor not bugfix version

* ci: Add manual naming for run-pytest

* test: Update pandas newest test requirements.

* Add missing os key.

* refactor: Check both major and minor version.

Co-authored-by: Bradley Dice <[email protected]>

* ci: Specify which warnings to ignore.

---------

Co-authored-by: Joshua A. Anderson <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bradley Dice <[email protected]>
  • Loading branch information
4 people authored Dec 5, 2023
1 parent a62f06d commit ce3ea8b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 13 deletions.
54 changes: 43 additions & 11 deletions .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,71 @@ concurrency:
cancel-in-progress: true
jobs:
test:
name: test (${{ matrix.os }}, ${{ matrix.python }}, ${{ matrix.dependencies }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
config: [ {python: '3.9', dependencies: 'newest'},
{python: '3.10', dependencies: 'newest'},
{python: '3.11', dependencies: 'newest'},
{python: '3.11', dependencies: 'minimal'},
{python: '3.8', dependencies: 'oldest'} ]
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
# Unused key to force creation of new entries in the matrix
default: ['true']
include:
# Defaults to newest dependencies
- dependencies: 'newest'
# Oldest dependency tests
- python: '3.8'
dependencies: 'oldest'
- os: 'macos-latest'
python: '3.8'
dependencies: 'oldest'
- os: 'windows-latest'
python: '3.8'
dependencies: 'oldest'
# Newest version tests for non-Linux OS
- os: 'ubuntu-latest'
python: '3.12'
dependencies: 'newest'
- os: 'macos-latest'
python: '3.12'
dependencies: 'newest'
- os: 'windows-latest'
python: '3.12'
dependencies: 'newest'
# Minimal dependencies tests
- default: 'false'
os: 'ubuntu-latest'
python: '3.12'
dependencies: 'minimal'
- os: 'macos-latest'
python: '3.12'
dependencies: 'minimal'
- os: 'windows-latest'
python: '3.12'
dependencies: 'minimal'
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.config.python }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.python }}
python-version: ${{ matrix.python }}
- name: Install newest dependencies
run: |
pip install -r requirements/requirements-test.txt
pip install -r requirements/requirements-test-optional.txt
if: ${{ matrix.config.dependencies == 'newest' }}
if: ${{ matrix.dependencies == 'newest' }}
- name: Install minimal dependencies
run: |
pip install -r requirements/requirements-test.txt
if: ${{ matrix.config.dependencies == 'minimal' }}
if: ${{ matrix.dependencies == 'minimal' }}
- name: Install oldest supported dependencies
# To prevent Dependabot from updating the pinnings in this "oldest"
# dependency list, we have to avoid the word "requirements" in the
# filename. That's why it is in the .github/ directory and named "reqs"
# instead of "requirements."
run: |
pip install -r .github/workflows/ci-oldest-reqs.txt
if: ${{ matrix.config.dependencies == 'oldest' }}
if: ${{ matrix.dependencies == 'oldest' }}
- name: Install the package
run: |
pip install -e .
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ Version 2
[2.2.0] -- 2023-xx-xx
---------------------

Added
+++++

- Official support for Python 3.12 (#957).

Changed
+++++++

- Restrict allowable tar file features in Python 3.12 (#957).
- linked views now can contain spaces and other characters except directory separators (#926).
- linked views now can be created on Windows, if 'Developer mode' is enabled (#430).

Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
Expand Down Expand Up @@ -100,7 +101,10 @@ follow_imports = 'skip'

[tool.pytest.ini_options]
xfail_strict = true
filterwarnings = "error"
filterwarnings = [
"error",
"ignore::DeprecationWarning:dateutil.*",
]

[tool.coverage.run]
branch = true
Expand Down
8 changes: 7 additions & 1 deletion signac/import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import re
import shutil
import sys
import tarfile
import zipfile
from collections import Counter
Expand Down Expand Up @@ -1144,7 +1145,12 @@ def read_statepoint_file(path):
"The jobs identified with the given schema function are not unique!"
)

tarfile.extractall(path=tmpdir)
if sys.version_info[:2] >= (3, 12):
# the data filter should support all needed operations for users using signac's import
# feature. Other filters assume Unix specific features.
tarfile.extractall(path=tmpdir, filter="data")
else:
tarfile.extractall(path=tmpdir)
for path, job in mappings.items():
if not os.path.isdir(tmpdir):
raise RuntimeError(f"The provided tmpdir {tmpdir} is not a directory.")
Expand Down

0 comments on commit ce3ea8b

Please sign in to comment.