Skip to content

Commit

Permalink
Support Python 3.12 (#853)
Browse files Browse the repository at this point in the history
* Support Python 3.12

* Attempt to fix distutils deprecation error in Python 3.12

* Deprecate pkg_resources in favor of importlib.resources

* Use importlib_resources in Python 3.8

* fix cognitive atlas

---------

Co-authored-by: James Kent <[email protected]>
  • Loading branch information
JulioAPeraza and jdkent authored Jul 11, 2024
1 parent 078bdb1 commit 34ad68d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For a complete list, please see ``nimare/setup.cfg``.

.. note::
We only support Python versions that are part of the Python release cycle (i.e., 3.8, 3.9,
3.10, and 3.11). For more information, see `Python Supported Versions`_.
3.10, 3.11, and 3.12). For more information, see `Python Supported Versions`_.

What Next?
----------
Expand Down
12 changes: 9 additions & 3 deletions nimare/reports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@
from glob import glob
from pathlib import Path

try:
from importlib.resources import files
except ImportError:
# Python < 3.9
from importlib_resources import files

import jinja2
import pandas as pd
from pkg_resources import resource_filename as pkgrf

from nimare.meta.cbma.base import CBMAEstimator, PairwiseCBMAEstimator
from nimare.reports.figures import (
Expand Down Expand Up @@ -545,8 +550,9 @@ def __init__(
_gen_figures(self.results, img_key, diag_name, threshold, self.fig_dir)

# Default template from nimare
self.template_path = Path(pkgrf("nimare", "reports/report.tpl"))
self._load_config(Path(pkgrf("nimare", "reports/default.yml")))
nimare_path = files("nimare")
self.template_path = nimare_path / "reports" / "report.tpl"
self._load_config(nimare_path / "reports" / "default.yml")
assert self.template_path.exists()

def _load_config(self, config):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools==58.2.0", "wheel"]
requires = ["setuptools==68.2.2", "wheel"]

[tool.black]
line-length = 99
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Scientific/Engineering

[options]
python_requires = >= 3.8
install_requires =
cognitiveatlas>=0.1.11 # nimare.annotate.cogat
fuzzywuzzy # nimare.annotate
importlib-resources; python_version < '3.9' # for importlib.resources.files in Python 3.8
jinja2 # nimare.reports
joblib>=1.3.0 # parallelization
matplotlib>=3.6.0 # this is for nilearn, which doesn't include it in its reqs
Expand Down

0 comments on commit 34ad68d

Please sign in to comment.