Skip to content

update LocalDataPath and testing for python 3.13 support #1188

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/remote_package_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10","3.12"]
python-version: ["3.10","3.12","3.13"]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10","3.12"]
python-version: ["3.10","3.12","3.13"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.10","3.12"]
python-version: ["3.10","3.12","3.13"]
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.10","3.12"]
python-version: ["3.10","3.12","3.13"]
steps:
- uses: actions/checkout@v3
with:
Expand Down
14 changes: 14 additions & 0 deletions garak/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def _eval_paths(self, segment, next_call, relative):
if projected.exists():
return LocalDataPath(projected)

if projected in self.ORDERED_SEARCH_PATHS:
return LocalDataPath(projected)

raise GarakException(f"The resource requested does not exist {segment}")

def _glob(self, pattern, recursive=False):
Expand Down Expand Up @@ -96,5 +99,16 @@ def joinpath(self, *pathsegments):
projected = self._eval_paths(segment, "joinpath", "..")
return projected

import sys

if sys.version_info >= (3, 13, 0):
# disabled override on older versions
def with_segments(self, *args):
if isinstance(args[0], LocalDataPath):
for segment in args:
projected = self._eval_paths(segment, "joinpath", "..")
return projected
return super().with_segments(*args)


path = LocalDataPath(_config.transient.data_dir / "data")
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
]
Expand Down
Loading