Skip to content

Commit

Permalink
Merge pull request #1224 from openradx/drop-python-3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim authored Oct 19, 2024
2 parents 9259a02 + 772b41a commit df98e61
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 99 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ repos:
- croniter==3.0.3
- django-stubs==5.1.0
- django==5.1.1
- importlib-resources==6.4.5
- psycopg2-binary==2.9.9
- psycopg[pool]==3.2.2
- python-dateutil==2.9.0.post0
Expand Down
59 changes: 2 additions & 57 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions procrastinate/contrib/django/migrations_utils.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
from __future__ import annotations

import functools
import sys
from typing import TYPE_CHECKING
from importlib import resources

from django.db import migrations

if TYPE_CHECKING:
import importlib_resources
else:
# https://github.com/pypa/twine/pull/551
if sys.version_info[:2] < (3, 9): # coverage: exclude
import importlib_resources
else: # coverage: exclude
import importlib.resources as importlib_resources


@functools.lru_cache(maxsize=None)
def list_migration_files() -> dict[str, str]:
Expand All @@ -23,7 +13,7 @@ def list_migration_files() -> dict[str, str]:
"""
return {
p.name: p.read_text(encoding="utf-8")
for p in importlib_resources.files("procrastinate.sql.migrations").iterdir()
for p in resources.files("procrastinate.sql.migrations").iterdir()
if p.name.endswith(".sql")
}

Expand Down
19 changes: 5 additions & 14 deletions procrastinate/schema.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
from __future__ import annotations

import pathlib
import sys
from typing import TYPE_CHECKING, cast
from importlib import resources
from typing import cast

from typing_extensions import LiteralString

if TYPE_CHECKING:
import importlib_resources
else:
# https://github.com/pypa/twine/pull/551
if sys.version_info[:2] < (3, 9): # coverage: exclude
import importlib_resources
else: # coverage: exclude
import importlib.resources as importlib_resources

from procrastinate import connector as connector_module

migrations_path = pathlib.Path(__file__).parent / "sql" / "migrations"
Expand All @@ -29,9 +20,9 @@ def get_schema() -> LiteralString:
# procrastinate takes full responsibility for the queries, we
# can safely vouch for them being as safe as if they were
# defined in the code itself.
schema_sql = (
importlib_resources.files("procrastinate.sql") / "schema.sql"
).read_text(encoding="utf-8")
schema_sql = (resources.files("procrastinate.sql") / "schema.sql").read_text(
encoding="utf-8"
)
return cast(LiteralString, schema_sql)

@staticmethod
Expand Down
15 changes: 3 additions & 12 deletions procrastinate/sql/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
from __future__ import annotations

import re
import sys
from typing import TYPE_CHECKING, cast
from importlib import resources
from typing import cast

from typing_extensions import LiteralString

if TYPE_CHECKING:
import importlib_resources
else:
# https://github.com/pypa/twine/pull/551
if sys.version_info[:2] < (3, 9): # coverage: exclude
import importlib_resources
else: # coverage: exclude
import importlib.resources as importlib_resources

QUERIES_REGEX = re.compile(r"(?:\n|^)-- ([a-z0-9_]+) --\n(?:-- .+\n)*", re.MULTILINE)


Expand All @@ -37,7 +28,7 @@ def parse_query_file(query_file: str) -> dict[str, LiteralString]:

def get_queries() -> dict[str, LiteralString]:
return parse_query_file(
(importlib_resources.files("procrastinate.sql") / "queries.sql").read_text(
(resources.files("procrastinate.sql") / "queries.sql").read_text(
encoding="utf-8"
)
)
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,19 @@ documentation = "https://procrastinate.readthedocs.io/"
procrastinate = 'procrastinate.cli:main'

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
aiopg = { version = "*", optional = true }
anyio = "*"
asgiref = "*"
attrs = "*"
contextlib2 = { version = "*", python = "<3.10" }
croniter = "*"
django = { version = ">=2.2", optional = true }
importlib-resources = { version = ">=1.4", python = "<3.9" }
psycopg = { extras = ["pool"], version = "*" }
psycopg2-binary = { version = "*", optional = true }
python-dateutil = "*"
sqlalchemy = { version = "^2.0", optional = true }
typing-extensions = { version = "*", python = "<3.8" }
typing-extensions = "*"
sphinx = { version = "*", optional = true }

[tool.poetry.extras]
Expand Down

0 comments on commit df98e61

Please sign in to comment.