Skip to content
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

fix: remove pkg_resources for compatibility with python 3.12 #52

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.12']

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: requirements/dev.txt
- name: Install dependencies
run: |
make requirements
Expand Down
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
127 changes: 66 additions & 61 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,134 +1,139 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
astroid==2.12.12
astroid==3.1.0
# via pylint
attrs==22.1.0
# via pytest
bleach==5.0.1
# via readme-renderer
certifi==2022.9.24
backports-tarfile==1.1.1
# via jaraco-context
certifi==2024.2.2
# via requests
cffi==1.15.1
cffi==1.16.0
# via cryptography
charset-normalizer==2.1.1
charset-normalizer==3.3.2
# via requests
commonmark==0.9.1
# via rich
coverage==6.5.0
coverage==7.5.0
# via -r requirements/dev.in
cryptography==38.0.1
cryptography==42.0.5
# via secretstorage
dill==0.3.6
dill==0.3.8
# via pylint
docutils==0.19
docutils==0.20.1
# via readme-renderer
idna==3.4
exceptiongroup==1.2.1
# via pytest
idna==3.7
# via requests
importlib-metadata==5.0.0
importlib-metadata==7.1.0
# via
# keyring
# twine
iniconfig==1.1.1
importlib-resources==6.4.0
# via keyring
iniconfig==2.0.0
# via pytest
isort==5.10.1
isort==5.13.2
# via pylint
jaraco-classes==3.2.3
jaraco-classes==3.4.0
# via keyring
jaraco-context==5.3.0
# via keyring
jedi==0.18.1
jaraco-functools==4.0.1
# via keyring
jedi==0.19.1
# via pudb
jeepney==0.8.0
# via
# keyring
# secretstorage
keyring==23.9.3
keyring==25.2.0
# via twine
lazy-object-proxy==1.7.1
# via astroid
markdown-it-py==3.0.0
# via rich
mccabe==0.7.0
# via pylint
more-itertools==9.0.0
# via jaraco-classes
packaging==21.3
mdurl==0.1.2
# via markdown-it-py
more-itertools==10.2.0
# via
# jaraco-classes
# jaraco-functools
nh3==0.2.17
# via readme-renderer
packaging==24.0
# via
# pudb
# pytest
parso==0.8.3
parso==0.8.4
# via jedi
pkginfo==1.8.3
pkginfo==1.10.0
# via twine
platformdirs==2.5.2
platformdirs==4.2.1
# via pylint
pluggy==1.0.0
pluggy==1.5.0
# via pytest
pudb==2022.1.2
pudb==2024.1
# via -r requirements/dev.in
py==1.11.0
# via pytest
pycodestyle==2.9.1
pycodestyle==2.11.1
# via -r requirements/dev.in
pycparser==2.21
pycparser==2.22
# via cffi
pydocstyle==6.1.1
pydocstyle==6.3.0
# via -r requirements/dev.in
pygments==2.13.0
pygments==2.17.2
# via
# pudb
# readme-renderer
# rich
pylint==2.15.5
pylint==3.1.0
# via -r requirements/dev.in
pyparsing==3.0.9
# via packaging
pytest==7.1.3
pytest==8.2.0
# via -r requirements/dev.in
readme-renderer==37.2
readme-renderer==43.0
# via twine
requests==2.28.1
requests==2.31.0
# via
# requests-toolbelt
# twine
requests-toolbelt==0.10.0
requests-toolbelt==1.0.0
# via twine
rfc3986==2.0.0
# via twine
rich==12.6.0
rich==13.7.1
# via twine
secretstorage==3.3.3
# via keyring
six==1.16.0
# via bleach
snowballstemmer==2.2.0
# via pydocstyle
tomli==2.0.1
# via
# pylint
# pytest
tomlkit==0.11.5
tomlkit==0.12.4
# via pylint
twine==4.0.1
twine==5.0.0
# via -r requirements/dev.in
typing-extensions==4.4.0
typing-extensions==4.11.0
# via
# astroid
# pylint
# rich
urllib3==1.26.12
# urwid
urllib3==2.2.1
# via
# requests
# twine
urwid==2.1.2
urwid==2.6.11
# via
# pudb
# urwid-readline
urwid-readline==0.13
urwid-readline==0.14
# via pudb
webencodings==0.5.1
# via bleach
wrapt==1.14.1
# via astroid
zipp==3.10.0
# via importlib-metadata
wcwidth==0.2.13
# via urwid
zipp==3.18.1
# via
# importlib-metadata
# importlib-resources
26 changes: 15 additions & 11 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
build==0.8.0
build==1.2.1
# via pip-tools
click==8.1.3
click==8.1.7
# via pip-tools
packaging==21.3
importlib-metadata==7.1.0
# via build
pep517==0.13.0
packaging==24.0
# via build
pip-tools==6.9.0
pip-tools==7.4.1
# via -r requirements/pip-tools.in
pyparsing==3.0.9
# via packaging
pyproject-hooks==1.1.0
# via
# build
# pip-tools
tomli==2.0.1
# via
# build
# pep517
wheel==0.37.1
# pip-tools
wheel==0.43.0
# via pip-tools
zipp==3.18.1
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
10 changes: 5 additions & 5 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
wheel==0.37.1
wheel==0.43.0
# via -r requirements/pip.in

# The following packages are considered to be unsafe in a requirements file:
pip==22.3
pip==24.0
# via -r requirements/pip.in
setuptools==65.5.0
setuptools==69.5.1
# via -r requirements/pip.in
15 changes: 5 additions & 10 deletions tutorcodejail/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from glob import glob

import pkg_resources
import importlib_resources
from tutor import hooks

from .__about__ import __version__
Expand Down Expand Up @@ -48,8 +48,8 @@
# and add it to the CLI_DO_INIT_TASKS filter, which tells Tutor to
# run it as part of the `init` job.
for service, template_path, priority in MY_INIT_TASKS:
full_path: str = pkg_resources.resource_filename(
"tutorcodejail", os.path.join("templates", *template_path)
full_path: str = str(
importlib_resources.files("tutorcodejail") / os.path.join("templates", *template_path)
)
with open(full_path, encoding="utf-8") as init_task_file:
init_task: str = init_task_file.read()
Expand Down Expand Up @@ -99,7 +99,7 @@
# Boilerplate code
# Add the "templates" folder as a template root
hooks.Filters.ENV_TEMPLATE_ROOTS.add_item(
pkg_resources.resource_filename("tutorcodejail", "templates")
str(importlib_resources.files("tutorcodejail") / "templates")
)
# Render the "build" and "apps" folders
hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
Expand All @@ -110,12 +110,7 @@
],
)
# Load patches from files
for path in glob(
os.path.join(
pkg_resources.resource_filename("tutorcodejail", "patches"),
"*",
)
):
for path in glob(str(importlib_resources.files("tutorcodejail") / "patches" / "*")):
with open(path, encoding="utf-8") as patch_file:
hooks.Filters.ENV_PATCHES.add_item((os.path.basename(path), patch_file.read()))
# Add configuration entries
Expand Down
Loading