Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: drop Python 3.6 support #234

Merged
merged 7 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
"docs/conf.py",
"labels/*.toml",
"pyproject.toml",
"setup.cfg",
"setup.py",
"tox.ini",
"typings"
],
Expand Down
15 changes: 14 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@
documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html
"""

from __future__ import annotations

from sphinx_api_relink.helpers import get_package_version

REPO_NAME = "repo-maintenance"
PACKAGE_NAME = "repoma"

api_target_substitutions: dict[str, str | tuple[str, str]] = {
"Array": "tomlkit.items.Array",
"ConfigParser": "configparser.ConfigParser",
"K": "typing.TypeVar",
"Path": "pathlib.Path",
"PythonVersion": "typing.TypeVar",
"T": "typing.TypeVar",
"TOMLDocument": "tomlkit.TOMLDocument",
"Table": "tomlkit.items.Table",
"V": "typing.TypeVar",
}
author = "Common Partial Wave Analysis"
autodoc_member_order = "bysource"
autodoc_typehints_format = "short"
Expand Down Expand Up @@ -62,7 +75,7 @@
"colon_fence",
]
nitpick_ignore = [
("py:class", "tomlkit.container.Container"),
("py:class", "CommentedMap"),
]
nitpick_ignore_regex = [
("py:class", r"^.*.[A-Z]$"),
Expand Down
120 changes: 117 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,124 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=36.2.1", # environment markers
"setuptools>=61.2",
"setuptools_scm",
"wheel",
]

[project]
authors = [{name = "Common Partial Wave Analysis", email = "compwa-admin@ep1.rub.de"}]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"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",
"Typing :: Typed",
]
dependencies = [
"PyYAML",
"attrs >=20.1.0", # https://www.attrs.org/en/stable/changelog.html#id82
"html2text",
"ini2toml",
"nbformat",
"pip-tools",
"pre-commit",
"ruamel.yaml", # better YAML dumping
"tomlkit",
]
description = "Pre-commit hooks that ensure that ComPWA repositories have a similar developer set-up"
dynamic = ["version"]
license = {text = "BSD 3-Clause License"}
maintainers = [{email = "compwa-admin@ep1.rub.de"}]
name = "repo-maintenance"
requires-python = ">=3.7"

[project.optional-dependencies]
dev = [
"labels",
"repo-maintenance[doc]",
"repo-maintenance[sty]",
"repo-maintenance[test]",
"sphinx-autobuild",
"tox >=1.9", # for skip_install, use_develop
]
doc = [
"Sphinx",
"myst-parser",
"sphinx-api-relink >=0.0.3",
"sphinx-api-relink",
"sphinx-argparse",
"sphinx-book-theme",
"sphinx-copybutton",
]
format = [
"black",
]
lint = [
"radon",
"repo-maintenance[mypy]",
"ruff",
]
mypy = [
"mypy",
"sphinx-api-relink >=0.0.3",
"types-PyYAML",
"types-toml",
]
sty = [
"pre-commit >=1.4.0",
"repo-maintenance[format]",
"repo-maintenance[lint]",
"repo-maintenance[test]", # for pytest type hints
]
test = [
"pytest",
"pytest-cov",
"pytest-xdist",
]

[project.readme]
content-type = "text/markdown"
file = "README.md"

[project.scripts]
check-dev-files = "repoma.check_dev_files:main"
colab-toc-visible = "repoma.colab_toc_visible:main"
fix-nbformat-version = "repoma.fix_nbformat_version:main"
format-setup-cfg = "repoma.format_setup_cfg:main"
pin-nb-requirements = "repoma.pin_nb_requirements:main"
repoma-self-check = "repoma.self_check:main"
set-nb-cells = "repoma.set_nb_cells:main"

[project.urls]
Source = "https://github.com/ComPWA/repo-maintenance"
Tracker = "https://github.com/ComPWA/repo-maintenance/issues"

[tool.setuptools]
include-package-data = false
license-files = ["LICENSE"]
package-dir = {"" = "src"}

[tool.setuptools.package-data]
repoma = [
".github/*",
".github/**/*",
".template/*",
".template/.*",
"py.typed",
]

[tool.setuptools.packages.find]
namespaces = false
where = ["src"]

[tool.setuptools_scm]
write_to = "src/repoma/version.py"

Expand All @@ -28,7 +142,6 @@ target-version = [
"py310",
"py311",
"py312",
"py36",
"py37",
"py38",
"py39",
Expand Down Expand Up @@ -130,6 +243,7 @@ extend-select = [
"D",
"EM",
"ERA",
"FA",
"I",
"ICN",
"INP",
Expand Down
106 changes: 0 additions & 106 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

8 changes: 5 additions & 3 deletions src/repoma/check_dev_files/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""A collection of scripts that check the file structure of a repository."""

from __future__ import annotations

import sys
from argparse import ArgumentParser
from typing import List, Optional, Sequence
from typing import Sequence

from repoma.check_dev_files.deprecated import remove_deprecated_tools
from repoma.utilities.executor import Executor
Expand Down Expand Up @@ -33,7 +35,7 @@
)


def main(argv: Optional[Sequence[str]] = None) -> int:
def main(argv: Sequence[str] | None = None) -> int:
parser = _create_argparse()
args = parser.parse_args(argv)
is_python_repo = not args.no_python
Expand Down Expand Up @@ -243,7 +245,7 @@ def _create_argparse() -> ArgumentParser:
return parser


def _to_list(arg: str) -> List[str]:
def _to_list(arg: str) -> list[str]:
"""Create a comma-separated list from a string argument.

>>> _to_list('a c , test,b')
Expand Down
13 changes: 7 additions & 6 deletions src/repoma/check_dev_files/citation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Check citation files."""

from __future__ import annotations

import json
import os
from textwrap import dedent
from typing import Dict, List, Optional, Set

from html2text import HTML2Text
from ruamel.yaml import YAML
Expand Down Expand Up @@ -112,8 +113,8 @@ def _write_citation_cff(citation_cff: CommentedMap) -> None:
yaml.dump(citation_cff, stream)


def _get_authors(zenodo: dict) -> Optional[List[Dict[str, str]]]:
creators: Optional[List[Dict[str, str]]] = zenodo.get("creators")
def _get_authors(zenodo: dict) -> list[dict[str, str]] | None:
creators: list[dict[str, str]] | None = zenodo.get("creators")
if creators is None:
return None
return [__convert_author(item) for item in creators]
Expand All @@ -132,10 +133,10 @@ def __convert_author(creator: dict) -> dict:
"family-names": family_name.strip(),
"given-names": given_names.strip(),
}
affiliation: Optional[str] = creator.get("affiliation")
affiliation: str | None = creator.get("affiliation")
if affiliation is not None:
author_info["affiliation"] = affiliation
orcid: Optional[str] = creator.get("orcid")
orcid: str | None = creator.get("orcid")
if orcid is not None:
author_info["orcid"] = f"https://orcid.org/{orcid}"
return author_info
Expand All @@ -160,7 +161,7 @@ def check_citation_keys() -> None:
if not citation_cff:
msg = f"{CONFIG_PATH.citation} is empty"
raise PrecommitError(msg)
existing: Set[str] = set(citation_cff)
existing: set[str] = set(citation_cff)
missing_keys = expected - existing
if missing_keys:
sorted_keys = sorted(missing_keys)
Expand Down
Loading
Loading