Skip to content

Commit

Permalink
DX: drop support for Python 3.7 (#225)
Browse files Browse the repository at this point in the history
* FIX: remove `types-pkg-resources`
* MAINT: upgrade syntax to Python 3.8
  • Loading branch information
redeboer authored Aug 7, 2024
1 parent bac8a53 commit 31f804c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 245 deletions.
1 change: 0 additions & 1 deletion .constraints/py3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ tox==4.15.1
traitlets==5.14.3
typepy==1.3.2
types-docutils==0.21.0.20240423
types-pkg-resources==0.1.3
types-python-dateutil==2.9.0.20240316
types-pyyaml==6.0.12.20240311
types-setuptools==70.0.0.20240524
Expand Down
1 change: 0 additions & 1 deletion .constraints/py3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ tox==4.15.1
traitlets==5.14.3
typepy==1.3.2
types-docutils==0.21.0.20240423
types-pkg-resources==0.1.3
types-python-dateutil==2.9.0.20240316
types-pyyaml==6.0.12.20240311
types-setuptools==70.0.0.20240524
Expand Down
1 change: 0 additions & 1 deletion .constraints/py3.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ tox==4.15.1
traitlets==5.14.3
typepy==1.3.2
types-docutils==0.21.0.20240423
types-pkg-resources==0.1.3
types-python-dateutil==2.9.0.20240316
types-pyyaml==6.0.12.20240311
types-setuptools==70.0.0.20240524
Expand Down
226 changes: 0 additions & 226 deletions .constraints/py3.7.txt

This file was deleted.

1 change: 0 additions & 1 deletion .constraints/py3.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ tox==4.15.1
traitlets==5.14.3
typepy==1.3.2
types-docutils==0.21.0.20240423
types-pkg-resources==0.1.3
types-python-dateutil==2.9.0.20240316
types-pyyaml==6.0.12.20240311
types-setuptools==70.0.0.20240524
Expand Down
1 change: 0 additions & 1 deletion .constraints/py3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ tox==4.15.1
traitlets==5.14.3
typepy==1.3.2
types-docutils==0.21.0.20240423
types-pkg-resources==0.1.3
types-python-dateutil==2.9.0.20240316
types-pyyaml==6.0.12.20240311
types-setuptools==70.0.0.20240524
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python",
Expand Down Expand Up @@ -49,7 +48,7 @@ keywords = [
license = {file = "LICENSE"}
maintainers = [{email = "[email protected]"}]
name = "PWA-pages"
requires-python = ">=3.7"
requires-python = ">=3.8"

[project.optional-dependencies]
dev = [
Expand Down Expand Up @@ -109,7 +108,6 @@ types = [
"sphinx-api-relink >=0.0.8",
"types-PyYAML",
"types-docutils",
"types-pkg-resources",
"types-python-dateutil",
"types-setuptools",
]
Expand Down Expand Up @@ -234,7 +232,7 @@ src = [
"src",
"tests",
]
target-version = "py37"
target-version = "py38"

[tool.ruff.format]
docstring-code-format = true
Expand Down
12 changes: 6 additions & 6 deletions src/pwa_pages/repo/_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from github.Commit import Commit


@lru_cache()
@lru_cache
def get_github_repo(url: str) -> GithubRepository:
github = __get_github()
repo_name = extract_github_repo_name(url)
Expand All @@ -25,7 +25,7 @@ def get_github_repo(url: str) -> GithubRepository:
return github.get_repo(repo_name)


@lru_cache()
@lru_cache
def extract_github_repo_name(url: str) -> str:
github_url = "https://github.com"
match = re.match(rf"^{github_url}/([^/]+)/([^/]+).*$", url)
Expand All @@ -34,7 +34,7 @@ def extract_github_repo_name(url: str) -> str:
return f"{match[1]}/{match[2]}"


@lru_cache()
@lru_cache
def get_first_commit_date(repo: GithubRepository) -> datetime:
commits = repo.get_commits().reversed
first_commit: Commit = commits[0]
Expand All @@ -45,7 +45,7 @@ def get_first_commit_date(repo: GithubRepository) -> datetime:
return parse_date(timestamp)


@lru_cache()
@lru_cache
def get_latest_commit_date(repo: GithubRepository) -> datetime:
default_branch = repo.default_branch
latest_commit = repo.get_commit(default_branch)
Expand All @@ -66,7 +66,7 @@ def get_last_modified(repo: GithubRepository) -> datetime:
return parse_date(repo.last_modified)


@lru_cache()
@lru_cache
def get_languages(repo: GithubRepository) -> dict[str, float]:
languages = repo.get_languages()
total_lines = sum(languages.values())
Expand All @@ -75,7 +75,7 @@ def get_languages(repo: GithubRepository) -> dict[str, float]:
}


@lru_cache()
@lru_cache
def __get_github(token: str | None = None) -> Github:
if token is None:
token = os.environ.get("GITHUB_TOKEN")
Expand Down
8 changes: 4 additions & 4 deletions src/pwa_pages/repo/_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from gitlab.v4.objects import ProjectCommitManager


@lru_cache()
@lru_cache
def get_gitlab_repo(server_url: str, project_path: str) -> GitlabProject:
gitlab = __get_gitlab(server_url)
return gitlab.projects.get(project_path)
Expand All @@ -29,7 +29,7 @@ def split_gitlab_repo_url(url: str) -> tuple[str, str] | None:
return server_url, project_path


@lru_cache()
@lru_cache
def get_first_commit_date(repo: GitlabProject) -> datetime:
commits: ProjectCommitManager = repo.commits
all_commits = commits.list(all=True)
Expand All @@ -39,7 +39,7 @@ def get_first_commit_date(repo: GitlabProject) -> datetime:
return parse_date(commit_info["created_at"])


@lru_cache()
@lru_cache
def get_latest_commit_date(repo: GitlabProject) -> datetime:
default_branch = repo.attributes["default_branch"]
commits: ProjectCommitManager = repo.commits
Expand All @@ -53,6 +53,6 @@ def get_last_modified(repo: GitlabProject) -> datetime:
return parse_date(date_str)


@lru_cache()
@lru_cache
def __get_gitlab(url: str) -> Gitlab:
return Gitlab(url)

0 comments on commit 31f804c

Please sign in to comment.