Skip to content

Commit

Permalink
refactor: Make importlib-resources a dev dependency and remove the `S…
Browse files Browse the repository at this point in the history
…CHEMA_FILE` constant from the public API (#36)

<!-- readthedocs-preview pep610 start -->
----
📚 Documentation preview 📚:
https://pep610--36.org.readthedocs.build/en/36/

<!-- readthedocs-preview pep610 end -->
  • Loading branch information
edgarrmondragon committed Feb 6, 2024
1 parent eb4f277 commit 401df76
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ dynamic = [
"version",
]
dependencies = [
'importlib-resources>=5.3; python_version < "3.9"',
]
optional-dependencies.dev = [
"coverage[toml]>=6.5",
"hypothesis",
"hypothesis-jsonschema",
'importlib-resources>=5.3; python_version < "3.9"',
"pytest",
]
optional-dependencies.docs = [
Expand Down
8 changes: 1 addition & 7 deletions src/pep610/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@

import hashlib
import json
import sys
import typing as t
from dataclasses import dataclass
from functools import singledispatch
from importlib.metadata import version

if sys.version_info < (3, 9):
import importlib_resources
else:
import importlib.resources as importlib_resources

if t.TYPE_CHECKING:
import sys
from importlib.metadata import Distribution, PathDistribution

if sys.version_info <= (3, 10):
Expand Down Expand Up @@ -46,7 +41,6 @@
"write_to_distribution",
]

SCHEMA_FILE = importlib_resources.files(__package__) / "direct_url.schema.json"
__version__ = version(__package__)


Expand Down
File renamed without changes.
9 changes: 8 additions & 1 deletion tests/test_generic.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import json
import sys
from importlib.metadata import Distribution

import pytest
from hypothesis import HealthCheck, given, settings
from hypothesis_jsonschema import from_schema

from pep610 import SCHEMA_FILE, read_from_distribution, write_to_distribution
from pep610 import read_from_distribution, write_to_distribution

if sys.version_info < (3, 9):
import importlib_resources
else:
import importlib.resources as importlib_resources

SCHEMA_FILE = importlib_resources.files(__package__) / "fixtures/direct_url.schema.json"
SCHEMA = json.loads(SCHEMA_FILE.read_text())


Expand Down

0 comments on commit 401df76

Please # to comment.