Skip to content

Commit

Permalink
replace pkg_resources with importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
shravanasati committed Jul 15, 2024
1 parent c2529a0 commit ec22214
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "stellapy"
version = "0.3.0"
version = "0.3.1"
description = "Streamline your web dev experience with stella - reload for the terminal as well as browser."

authors = ["Shravan Asati <[email protected]>"]
Expand Down
13 changes: 5 additions & 8 deletions stellapy/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
from dataclasses import asdict, dataclass
from io import StringIO
from logging import exception
from pathlib import Path
from typing import Any

import pkg_resources
import importlib.resources
from jsonschema import Draft6Validator, ValidationError, validate
from ruamel.yaml import YAML

Expand All @@ -17,12 +16,10 @@


def get_json_schema() -> dict[str, Any]:
jsonschema_path = (
Path(pkg_resources.resource_filename("stellapy", "schema.json")).parent.parent
/ "schema.json"
)
with open(jsonschema_path) as f:
return json.load(f)
ref = importlib.resources.files("stellapy").parent / "schema.json"
with importlib.resources.as_file(ref) as jsonschema_path:
with open(str(jsonschema_path)) as f:
return json.load(f)


class ConfigFileNotFound(Exception):
Expand Down
2 changes: 1 addition & 1 deletion stellapy/stella.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from stellapy.reloader import Reloader

NAME = "stella"
VERSION = "0.3.0"
VERSION = "0.3.1"

# , help = "The url to listen to on the browser. Example: localhost:5000", prompt = "Enter the URL to listen to on the browser"
# , help = "The command to execute on a file change. Example: python3 app.py", prompt = "Enter the command to execute on a file change"
Expand Down

0 comments on commit ec22214

Please sign in to comment.