Skip to content

Commit

Permalink
fix: make requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Danyal-Faheem committed Jan 15, 2024
1 parent 17d0d6c commit 019b8f6
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 57 deletions.
10 changes: 7 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements/base.in
Expand All @@ -20,6 +20,10 @@ google-auth==2.23.3
# via kubernetes
idna==3.4
# via requests
importlib-metadata==7.0.1
# via -r requirements/base.in
importlib-resources==6.1.1
# via -r requirements/base.in
jinja2==3.1.2
# via -r requirements/base.in
kubernetes==28.1.0
Expand Down Expand Up @@ -60,8 +64,6 @@ six==1.16.0
# via
# kubernetes
# python-dateutil
tomli==2.0.1
# via mypy
typing-extensions==4.8.0
# via
# -r requirements/base.in
Expand All @@ -72,3 +74,5 @@ urllib3==1.26.18
# requests
websocket-client==1.6.4
# via kubernetes
zipp==3.17.0
# via importlib-metadata
43 changes: 10 additions & 33 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements/dev.in
#
altgraph==0.17.4
# via pyinstaller
# via
# macholib
# pyinstaller
appdirs==1.4.4
# via -r requirements/base.txt
astroid==3.0.1
Expand All @@ -25,8 +27,6 @@ certifi==2023.7.22
# -r requirements/base.txt
# kubernetes
# requests
cffi==1.16.0
# via cryptography
charset-normalizer==3.3.1
# via
# -r requirements/base.txt
Expand All @@ -42,8 +42,6 @@ click-log==0.4.0
# via scriv
coverage==7.3.2
# via -r requirements/dev.in
cryptography==41.0.7
# via secretstorage
dill==0.3.7
# via pylint
docutils==0.18.1
Expand All @@ -58,22 +56,16 @@ idna==3.4
# via
# -r requirements/base.txt
# requests
importlib-metadata==6.8.0
importlib-metadata==7.0.1
# via
# build
# keyring
# pyinstaller
# -r requirements/base.txt
# twine
importlib-resources==6.1.1
# via keyring
# via -r requirements/base.txt
isort==5.12.0
# via pylint
jaraco-classes==3.3.0
# via keyring
jeepney==0.8.0
# via
# keyring
# secretstorage
jinja2==3.1.2
# via
# -r requirements/base.txt
Expand All @@ -82,6 +74,8 @@ keyring==24.2.0
# via twine
kubernetes==28.1.0
# via -r requirements/base.txt
macholib==1.16.3
# via pyinstaller
markdown-it-py==3.0.0
# via
# rich
Expand Down Expand Up @@ -134,8 +128,6 @@ pyasn1-modules==0.3.0
# via
# -r requirements/base.txt
# google-auth
pycparser==2.21
# via cffi
pycryptodome==3.19.0
# via -r requirements/base.txt
pygments==2.16.1
Expand Down Expand Up @@ -184,22 +176,11 @@ rsa==4.9
# google-auth
scriv==1.5.0
# via -r requirements/dev.in
secretstorage==3.3.3
# via keyring
six==1.16.0
# via
# -r requirements/base.txt
# kubernetes
# python-dateutil
tomli==2.0.1
# via
# -r requirements/base.txt
# black
# build
# mypy
# pip-tools
# pylint
# pyproject-hooks
tomlkit==0.12.1
# via pylint
twine==4.0.2
Expand All @@ -213,11 +194,7 @@ types-setuptools==68.2.0.0
typing-extensions==4.8.0
# via
# -r requirements/base.txt
# astroid
# black
# mypy
# pylint
# rich
urllib3==1.26.18
# via
# -r requirements/base.txt
Expand All @@ -232,8 +209,8 @@ wheel==0.41.2
# via pip-tools
zipp==3.17.0
# via
# -r requirements/base.txt
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
21 changes: 11 additions & 10 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements/docs.in
Expand Down Expand Up @@ -42,8 +42,10 @@ idna==3.4
# requests
imagesize==1.4.1
# via sphinx
importlib-metadata==6.8.0
# via sphinx
importlib-metadata==7.0.1
# via -r requirements/base.txt
importlib-resources==6.1.1
# via -r requirements/base.txt
jinja2==3.1.2
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -84,8 +86,6 @@ python-dateutil==2.8.2
# via
# -r requirements/base.txt
# kubernetes
pytz==2023.3.post1
# via babel
pyyaml==6.0.1
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -135,10 +135,6 @@ sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
tomli==2.0.1
# via
# -r requirements/base.txt
# mypy
typing-extensions==4.8.0
# via
# -r requirements/base.txt
Expand All @@ -153,4 +149,9 @@ websocket-client==1.6.4
# -r requirements/base.txt
# kubernetes
zipp==3.17.0
# via importlib-metadata
# via
# -r requirements/base.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
6 changes: 2 additions & 4 deletions tutor/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
from copy import deepcopy

import jinja2
from importlib_resources import files, as_file
import importlib_resources

from tutor import exceptions, fmt, hooks, plugins, utils
from tutor.__about__ import __app__, __version__
from tutor.types import Config, ConfigValue

ref = files("tutor") / "templates"
with as_file(ref) as path:
TEMPLATES_ROOT = str(path)
TEMPLATES_ROOT = str(importlib_resources.files("tutor") / "templates")
VERSION_FILENAME = "version"
BIN_FILE_EXTENSIONS = [".ico", ".jpg", ".patch", ".png", ".ttf", ".woff", ".woff2"]
JinjaFilter = t.Callable[..., t.Any]
Expand Down
8 changes: 4 additions & 4 deletions tutor/plugins/v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from glob import glob

import click
from importlib_metadata import EntryPoint, entry_points, Distribution
import importlib_metadata

from tutor import env, exceptions, fmt, hooks, serialize
from tutor.__about__ import __app__
Expand Down Expand Up @@ -246,8 +246,8 @@ class EntrypointPlugin(BasePlugin):

ENTRYPOINT = "tutor.plugin.v0"

def __init__(self, entrypoint: EntryPoint) -> None:
self.loader: EntryPoint = entrypoint
def __init__(self, entrypoint: importlib_metadata.EntryPoint) -> None:
self.loader: importlib_metadata.EntryPoint = entrypoint
super().__init__(entrypoint.name, entrypoint)

def _load_obj(self) -> None:
Expand All @@ -260,7 +260,7 @@ def _version(self) -> t.Optional[str]:

@classmethod
def discover_all(cls) -> None:
entrypoints = entry_points().select(group=cls.ENTRYPOINT) # type: ignore[no-untyped-call]
entrypoints = importlib_metadata.entry_points().select(group=cls.ENTRYPOINT) # type: ignore[no-untyped-call]
for entrypoint in entrypoints:
try:
error: t.Optional[str] = None
Expand Down
6 changes: 3 additions & 3 deletions tutor/plugins/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from glob import glob

from importlib_metadata import entry_points, EntryPoint
import importlib_metadata

from tutor import hooks

Expand All @@ -26,7 +26,7 @@ def _discover_entrypoint_plugins() -> None:
"""
with hooks.Contexts.PLUGINS.enter():
if "TUTOR_IGNORE_ENTRYPOINT_PLUGINS" not in os.environ:
for entrypoint in entry_points().select(group="tutor.plugin.v1"): # type: ignore[no-untyped-call]
for entrypoint in importlib_metadata.entry_points().select(group="tutor.plugin.v1"): # type: ignore[no-untyped-call]
discover_package(entrypoint)


Expand Down Expand Up @@ -56,7 +56,7 @@ def load(plugin_name: str) -> None:
spec.loader.exec_module(module)


def discover_package(entrypoint: EntryPoint) -> None:
def discover_package(entrypoint: importlib_metadata.EntryPoint) -> None:
"""
Install a plugin from a python package.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
warnings.filterwarnings("ignore", category=DeprecationWarning, module="wiki.plugins.links.wiki_plugin")
warnings.filterwarnings("ignore", category=DeprecationWarning, module="boto.plugin")
warnings.filterwarnings("ignore", category=DeprecationWarning, module="botocore.vendored.requests.packages.urllib3._collections")
warnings.filterwarnings("ignore", category=DeprecationWarning, module="pkg_resources")
warnings.filterwarnings("ignore", category=DeprecationWarning, module="fs")
warnings.filterwarnings("ignore", category=DeprecationWarning, module="fs.opener")
SILENCED_SYSTEM_CHECKS = ["2_0.W001", "fields.W903"]
Expand Down

0 comments on commit 019b8f6

Please sign in to comment.