diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt deleted file mode 100644 index 1499061..0000000 --- a/.constraints/py3.8.txt +++ /dev/null @@ -1,223 +0,0 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml -o .constraints/py3.8.txt --all-extras --no-annotate --python-version=3.8 --no-emit-package setuptools -accessible-pygments==0.0.4 -alabaster==0.7.13 -annotated-types==0.7.0 -anyio==4.4.0 -argon2-cffi==23.1.0 -argon2-cffi-bindings==21.2.0 -arrow==1.3.0 -asttokens==2.4.1 -async-lru==2.0.4 -attrs==24.2.0 -babel==2.16.0 -backcall==0.2.0 -beautifulsoup4==4.12.3 -bleach==6.1.0 -cachetools==5.5.0 -cattrs==24.1.0 -certifi==2024.8.30 -cffi==1.17.1 -cfgv==3.4.0 -chardet==5.2.0 -charset-normalizer==3.3.2 -click==8.1.7 -colorama==0.4.6 -comm==0.2.2 -contourpy==1.1.1 -coverage==7.6.1 -cryptography==43.0.1 -cycler==0.12.1 -dataproperty==1.0.1 -debugpy==1.8.5 -decorator==5.1.1 -defusedxml==0.7.1 -deprecated==1.2.14 -distlib==0.3.8 -docstring-to-markdown==0.15 -docutils==0.17.1 -dominate==2.9.1 -exceptiongroup==1.2.2 -execnet==2.1.1 -executing==2.1.0 -fastjsonschema==2.20.0 -feynman==2.1.0 -filelock==3.16.0 -fonttools==4.53.1 -fqdn==1.5.1 -gitdb==4.0.11 -gitpython==3.1.43 -greenlet==3.1.0 -h11==0.14.0 -httpcore==1.0.5 -httpx==0.27.2 -identify==2.6.0 -idna==3.8 -imagesize==1.4.1 -importlib-metadata==8.4.0 -importlib-resources==6.4.5 -iniconfig==2.0.0 -ipykernel==6.29.5 -ipython==8.12.3 -ipywidgets==8.1.5 -isoduration==20.11.0 -jedi==0.19.1 -jinja2==3.1.4 -json5==0.9.25 -jsonpointer==3.0.0 -jsonschema==4.23.0 -jsonschema-specifications==2023.12.1 -jupyter==1.1.1 -jupyter-cache==0.6.1 -jupyter-client==8.6.2 -jupyter-console==6.6.3 -jupyter-core==5.7.2 -jupyter-events==0.10.0 -jupyter-lsp==2.2.5 -jupyter-server==2.14.2 -jupyter-server-mathjax==0.2.6 -jupyter-server-terminals==0.5.3 -jupyterlab==4.2.5 -jupyterlab-code-formatter==3.0.2 -jupyterlab-git==0.50.1 -jupyterlab-lsp==5.1.0 -jupyterlab-myst==2.4.2 -jupyterlab-pygments==0.3.0 -jupyterlab-server==2.27.3 -jupyterlab-widgets==3.0.13 -kiwisolver==1.4.7 -latexcodec==3.0.0 -livereload==2.7.0 -lsprotocol==2023.0.1 -markdown-it-py==2.2.0 -markupsafe==2.1.5 -matplotlib==3.7.5 -matplotlib-inline==0.1.7 -mbstrdecoder==1.1.3 -mdit-py-plugins==0.3.5 -mdurl==0.1.2 -mistune==3.0.2 -mpmath==1.3.0 -mypy==1.11.2 -mypy-extensions==1.0.0 -myst-nb==0.17.2 -myst-parser==0.18.1 -nbclient==0.6.8 -nbconvert==7.16.4 -nbdime==4.0.2 -nbformat==5.10.4 -nbmake==1.5.4 -nest-asyncio==1.6.0 -nodeenv==1.9.1 -notebook==7.2.2 -notebook-shim==0.2.4 -numpy==1.24.4 -overrides==7.7.0 -packaging==24.1 -pandocfilters==1.5.1 -parso==0.8.4 -pathvalidate==3.2.1 -pexpect==4.9.0 -pickleshare==0.7.5 -pillow==10.4.0 -pkgutil-resolve-name==1.3.10 -platformdirs==4.3.2 -pluggy==1.5.0 -pre-commit==3.5.0 -prometheus-client==0.20.0 -prompt-toolkit==3.0.47 -psutil==6.0.0 -ptyprocess==0.7.0 -pure-eval==0.2.3 -pybtex==0.24.0 -pybtex-docutils==1.0.3 -pycparser==2.22 -pydantic==2.9.1 -pydantic-core==2.23.3 -pydata-sphinx-theme==0.14.4 -pygithub==2.4.0 -pygments==2.18.0 -pyjwt==2.9.0 -pynacl==1.5.0 -pyparsing==3.1.4 -pyproject-api==1.7.1 -pytablewriter==1.2.0 -pytest==8.3.3 -pytest-cov==5.0.0 -pytest-xdist==3.6.1 -python-dateutil==2.9.0.post0 -python-gitlab==4.10.0 -python-json-logger==2.0.7 -python-lsp-jsonrpc==1.1.2 -python-lsp-ruff==2.2.2 -python-lsp-server==1.12.0 -pytoolconfig==1.3.1 -pytz==2024.1 -pyyaml==6.0.2 -pyzmq==26.2.0 -referencing==0.35.1 -requests==2.32.3 -requests-toolbelt==1.0.0 -rfc3339-validator==0.1.4 -rfc3986-validator==0.1.1 -rope==1.13.0 -rpds-py==0.20.0 -ruff==0.6.4 -send2trash==1.8.3 -six==1.16.0 -smmap==5.0.1 -sniffio==1.3.1 -snowballstemmer==2.2.0 -soupsieve==2.6 -sphinx==5.3.0 -sphinx-api-relink==0.0.9 -sphinx-autobuild==2021.3.14 -sphinx-book-theme==1.0.1 -sphinx-codeautolink==0.15.2 -sphinx-comments==0.0.3 -sphinx-copybutton==0.5.2 -sphinx-design==0.5.0 -sphinx-hep-pdgref==0.2.0 -sphinx-pybtex-etal-style==0.0.2 -sphinx-thebe==0.3.1 -sphinx-togglebutton==0.3.2 -sphinxcontrib-applehelp==1.0.4 -sphinxcontrib-bibtex==2.6.2 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.1 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.34 -stack-data==0.6.3 -sympy==1.13.2 -tabledata==1.3.3 -tabulate==0.9.0 -tcolorpy==0.1.6 -terminado==0.18.1 -tinycss2==1.3.0 -tomli==2.0.1 -tornado==6.4.1 -tox==4.18.1 -traitlets==5.14.3 -typepy==1.3.2 -types-docutils==0.21.0.20240907 -types-python-dateutil==2.9.0.20240906 -types-pyyaml==6.0.12.20240808 -types-setuptools==74.1.0.20240907 -typing-extensions==4.12.2 -ujson==5.10.0 -uri-template==1.3.0 -urllib3==2.2.2 -virtualenv==20.26.4 -wcwidth==0.2.13 -webcolors==24.8.0 -webencodings==0.5.1 -websocket-client==1.8.0 -wheel==0.44.0 -widgetsnbextension==4.0.13 -wrapt==1.16.0 -zipp==3.20.1 - -# The following packages were excluded from the output: -# setuptools diff --git a/docs/conf.py b/docs/conf.py index ed21893..525b665 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -32,6 +32,7 @@ api_github_repo = f"{ORGANIZATION}/{REPO_NAME}" api_target_substitutions: dict[str, str | tuple[str, str]] = { "datetime": "datetime.datetime", + "Path": "pathlib.Path", } author = "Common Partial Wave Analysis" autodoc_default_options = { @@ -126,10 +127,10 @@ } linkcheck_anchors = False linkcheck_ignore = [ - "http://127.0.0.1:8000", "http://cgl.soic.indiana.edu/jpac/References.html", "https://doi.org/10.1002/andp.19955070504", # 403 for onlinelibrary.wiley.com "https://doi.org/10.1093/ptep/ptaa104", + "https://doi.org/10.1103", "https://doi.org/10.1155/2020/6674595", # 403 hidawi.com "https://home.fnal.gov/~kutschke/Angdist/angdist.ps", "https://physique.cuso.ch", diff --git a/pyproject.toml b/pyproject.toml index 9ccb218..3c3d5f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python", "Topic :: Scientific/Engineering :: Physics", @@ -48,7 +47,7 @@ keywords = [ license = {file = "LICENSE"} maintainers = [{email = "compwa-admin@ep1.rub.de"}] name = "PWA-pages" -requires-python = ">=3.8" +requires-python = ">=3.9" [project.optional-dependencies] dev = [ diff --git a/src/pwa_pages/project_inventory.py b/src/pwa_pages/project_inventory.py index dc4cbce..bdd4b89 100644 --- a/src/pwa_pages/project_inventory.py +++ b/src/pwa_pages/project_inventory.py @@ -1,13 +1,13 @@ """Helper tools for writing tables.""" +from __future__ import annotations + import argparse import json import re import sys -from datetime import datetime from functools import partial -from pathlib import Path -from typing import Callable, Dict, Iterable, List, Optional, Sequence, Union +from typing import TYPE_CHECKING, Callable, Optional, Union import yaml from pydantic import BaseModel, model_validator @@ -15,26 +15,31 @@ from .repo import Repo, get_repo +if TYPE_CHECKING: + from collections.abc import Iterable, Sequence + from datetime import datetime + from pathlib import Path + if sys.version_info < (3, 11): from typing_extensions import Self else: from typing import Self -def load_yaml(path: Union[Path, str]) -> dict: +def load_yaml(path: Path | str) -> dict: with open(path) as stream: return yaml.load(stream, Loader=yaml.SafeLoader) def to_html_table( - inventory: "ProjectInventory", - selected_languages: List[str], + inventory: ProjectInventory, + selected_languages: list[str], *, fetch: bool = False, min_percentage: float = 2.5, - hide_columns: Optional[Iterable[str]] = None, + hide_columns: Iterable[str] | None = None, ) -> str: - header_to_formatters: Dict[str, Callable[[Project], str]] = { + header_to_formatters: dict[str, Callable[[Project], str]] = { "Project": _create_project_entry, "Collaboration": partial(_format_collaboration, inventory=inventory), "Since": _fetch_first_commit_year if fetch else lambda _: "", @@ -85,15 +90,15 @@ class SubProject(BaseModel): class Project(BaseModel): name: str url: str - collaboration: Optional[Union[List[str], str]] = None - languages: List[str] = [] - sub_projects: Optional[List[SubProject]] = None + collaboration: Optional[Union[list[str], str]] = None + languages: list[str] = [] + sub_projects: Optional[list[SubProject]] = None since: int = 0 class ProjectInventory(BaseModel): - projects: List[Project] - collaborations: Dict[str, str] = {} + projects: list[Project] + collaborations: dict[str, str] = {} @model_validator(mode="after") def _check_collaboration_exists(self) -> Self: @@ -154,9 +159,7 @@ def __replace_language(language: str) -> str: return language -def _fetch_languages( - project: Union[Project, SubProject], min_percentage: float -) -> List[str]: +def _fetch_languages(project: Project | SubProject, min_percentage: float) -> list[str]: repo = get_repo(project.url) if repo is None: return [] @@ -203,7 +206,7 @@ def _get_date( def _get_subproject_timestamps( project: Project, date_getter: Callable[[Repo], datetime] -) -> List[datetime]: +) -> list[datetime]: if project.sub_projects is None: return [] timestamps = [] @@ -216,7 +219,7 @@ def _get_subproject_timestamps( return timestamps -def _format_collaboration(project: Project, inventory: "ProjectInventory") -> str: +def _format_collaboration(project: Project, inventory: ProjectInventory) -> str: collaborations = project.collaboration if collaborations is None: return "" @@ -249,7 +252,7 @@ def _enumerate_html_links(list_of_entries: Sequence[str]) -> str: return "
  • " + html -def export_json_schema(argv: Optional[Sequence[str]] = None) -> int: +def export_json_schema(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser( "Create a JSON validation schema for a software project inventory file\n" )