Skip to content

Commit

Permalink
Use importlib.resources.files and support python 3.11 (#199)
Browse files Browse the repository at this point in the history
* Use `importlib.resources.files` and py3.11

* Still support py3.8/3.9

* Simplify
  • Loading branch information
dachengx authored Feb 3, 2025
1 parent d54e74d commit 4dbe69f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup python
uses: actions/[email protected]
with:
python-version: '3.9'
python-version: '3.10'

- name: Checkout repo
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ 3.8, 3.9 ]
python-version: [ '3.10', '3.11' ]
test: [ 'coveralls', 'pytest' ]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
args: [--safe, --line-length=100]
- id: black-jupyter
args: [--safe, --line-length=100]
language_version: python3.9
language_version: python3.11

- repo: https://github.com/pycqa/docformatter
rev: master
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sphinx:
build:
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.10"

python:
install:
Expand Down
4 changes: 2 additions & 2 deletions appletree/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import json
from warnings import warn
import hashlib
import importlib_resources
from time import time
from importlib.resources import files as _files

from jax.lib import xla_bridge
import numpy as np
Expand Down Expand Up @@ -140,7 +140,7 @@ def _get_abspath(file_name):

def _package_path(sub_directory):
"""Get the abs path of the requested sub folder."""
return importlib_resources.files("appletree") / sub_directory
return _files("appletree") / sub_directory


@export
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ classifiers = [
"Natural Language :: English",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Physics",
Expand Down

0 comments on commit 4dbe69f

Please sign in to comment.