Skip to content

Commit

Permalink
BREAK: drop Python 3.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Dec 9, 2023
1 parent 25d6f9f commit 77443d7
Show file tree
Hide file tree
Showing 10 changed files with 177 additions and 168 deletions.
2 changes: 0 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
"docs/_templates/*",
"docs/conf.py",
"pyproject.toml",
"setup.cfg",
"setup.py",
"tox.ini"
],
"ignoreWords": [
Expand Down
20 changes: 9 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.1.9
hooks:
- id: check-dev-files
args:
- --no-prettierrc
- --pin-requirements=bimonthly
- --repo-name=PawianTools
- --repo-title=Pawian Tools
- id: format-setup-cfg

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand Down Expand Up @@ -52,6 +41,15 @@ repos:
types_or:
- jupyter

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.1.9
hooks:
- id: check-dev-files
args:
- --no-prettierrc
- --pin-requirements=bimonthly
- --repo-name=PawianTools
- --repo-title=Pawian Tools
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.1.1
hooks:
Expand Down
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html
"""

from __future__ import annotations

import os
import re
import shutil
import subprocess
import sys
from typing import Dict

if sys.version_info < (3, 8):
from importlib_metadata import PackageNotFoundError
Expand Down Expand Up @@ -142,7 +143,7 @@


# Intersphinx settings
version_remapping: Dict[str, Dict[str, str]] = {
version_remapping: dict[str, dict[str, str]] = {
"ipython": {
"8.12.2": "8.12.1",
"8.12.3": "8.12.1",
Expand Down
127 changes: 124 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,131 @@
[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 = "[email protected]"}]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"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",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
dependencies = [
"awkward >=1",
"matplotlib",
"numpy",
"pandas",
"uproot >=4",
]
description = "Python helper tools for the Pawian framework"
dynamic = ["version"]
keywords = [
"HEP",
"PWA",
"amplitude analysis",
"partial wave analysis",
"particle physics",
"particles",
"physics",
]
license = {text = "GPLv3 or later"}
name = "pawian-tools"
requires-python = ">=3.7"

[project.optional-dependencies]
dev = [
"pawian-tools[doc]",
"pawian-tools[jupyter]",
"pawian-tools[sty]",
"pawian-tools[test]",
"sphinx-autobuild",
"sphinx-autobuild",
"tox >=1.9", # for skip_install, use_develop
"virtualenv!=20.16.*,!=20.17.*", # https://github.com/redeboer/PawianTools/actions/runs/4359491077/jobs/7621340858#step:3:76
'tox <4; python_version <"3.8.0"', # https://github.com/redeboer/PawianTools/actions/runs/3861498991/jobs/6582508970#step:3:91
'virtualenv <20.22.0; python_version <"3.8.0"', # importlib-metadata conflict
]
doc = [
"Sphinx >=3",
"ipywidgets",
"myst-nb",
"pydeps",
"sphinx-book-theme",
"sphinx-codeautolink[ipython]",
"sphinx-copybutton",
"sphinx-thebe",
"sphinx-togglebutton",
'Sphinx <4.4; python_version <"3.8.0"', # https://github.com/ComPWA/qrules/runs/4833302679
'importlib-metadata; python_version <"3.8.0"',
]
format = [
"black",
]
jupyter = [
"isort",
"jupyterlab",
"jupyterlab-code-formatter",
"jupyterlab-git",
"jupyterlab-lsp",
"jupyterlab-myst",
"jupyterlab-myst",
"python-lsp-ruff",
"python-lsp-server[rope]",
]
lint = [
"mypy >=0.730",
"ruff",
]
sty = [
"pawian-tools[format]",
"pawian-tools[lint]",
"pawian-tools[test]", # for pytest type hints
"pre-commit >=2.9.2", # for black
]
test = [
"pytest",
"pytest-cov",
"pytest-profiling",
"pytest-xdist",
]

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

[project.urls]
Changelog = "https://github.com/redeboer/PawianTools/releases"
Documentation = "http://redeboer.github.io/PawianTools"
Source = "https://github.com/redeboer/PawianTools"
Tracker = "https://github.com/redeboer/PawianTools/issues"

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

[tool.setuptools.package-data]
pawian = ["samples/*"]

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

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

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

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

12 changes: 7 additions & 5 deletions src/boostcfg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@
<https://panda-wiki.gsi.de/bin/view/PWA/PawianPwaSoftware>`__.
"""

from typing import Any, Dict, Optional
from __future__ import annotations

from typing import Any

from . import lineparser


class BoostConfigParser:
"""Data structure that holds information of Boost config files."""

def __init__(self, filename: Optional[str] = None) -> None:
self.__values: Dict[str, Any] = {}
self.__config_file: Optional[str] = None
def __init__(self, filename: str | None = None) -> None:
self.__values: dict[str, Any] = {}
self.__config_file: str | None = None
if isinstance(filename, str):
self.read_config(filename=filename, reset=True)

Expand Down Expand Up @@ -58,5 +60,5 @@ def __getitem__(self, key: str) -> Any:
return self.__values[key]

@property
def config_file(self) -> Optional[str]:
def config_file(self) -> str | None:
return self.__config_file
7 changes: 4 additions & 3 deletions src/boostcfg/lineparser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""A collection of tools to parse lines in a Boost config file."""

from __future__ import annotations

__all__ = [
"get_key_value_pair",
"is_commented",
Expand All @@ -10,10 +12,9 @@


import re
from typing import Tuple, Union # regex


def get_key_value_pair(line: str) -> Tuple[str, str]:
def get_key_value_pair(line: str) -> tuple[str, str]:
"""Extract key and value from a line in a :code:`cfg` file.
Extracts everything before an equal sign as the key, and everything after as the
Expand Down Expand Up @@ -46,7 +47,7 @@ def strip_comment(line: str) -> str:
return matches[0]


def string_to_value(string: str) -> Union[bool, float, int, str]:
def string_to_value(string: str) -> bool | float | int | str:
"""Attempt to convert a string to a `float` or `int`."""
try:
return int(string)
Expand Down
Loading

0 comments on commit 77443d7

Please sign in to comment.