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

Update Python Versions #82

Merged
merged 6 commits into from
Mar 27, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- run: pip install pytest pytest-mock coverage
pip install .

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
name: various (ruff formatting, ruff linting, mypy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install ruff mypy blackdoc
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ jobs:
matrix:
# latest python on Win/Mac/Lin
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.11", "3.10"]
python-version: ["3.12", "3.11"]
# test older python versions on Linux only
include:
- os: ubuntu-latest
python-version: "3.9"
# - os: ubuntu-latest
# python-version: "3.8"
# - os: ubuntu-latest
# python-version: "3.7"
python-version: "3.10"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Documentation Status](https://readthedocs.org/projects/archeryutils/badge/?version=latest)](https://archeryutils.readthedocs.io/en/latest/?badge=latest)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/jatkinson1000/archeryutils/testing.yaml)
[![codecov](https://codecov.io/gh/jatkinson1000/archeryutils/branch/main/graph/badge.svg?token=AZU7G6H8T0)](https://codecov.io/gh/jatkinson1000/archeryutils)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jatkinson1000/archeryutils/main?labpath=examples.ipynb)

Expand Down
4 changes: 3 additions & 1 deletion archeryutils/classifications/agb_field_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ def calculate_agb_field_classification(
return "unclassified"

# What is the highest classification this score gets?
class_scores = dict(zip(group_data["classes"], group_data["class_scores"]))
class_scores = dict(
zip(group_data["classes"], group_data["class_scores"], strict=True)
)
for item in class_scores:
if class_scores[item] > score:
continue
Expand Down
4 changes: 2 additions & 2 deletions archeryutils/classifications/agb_indoor_classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def calculate_agb_indoor_classification(

groupname = cls_funcs.get_groupname(bowstyle, gender, age_group)
group_data = agb_indoor_classifications[groupname]
class_data = dict(zip(group_data["classes"], all_class_scores))
class_data = dict(zip(group_data["classes"], all_class_scores, strict=True))

# What is the highest classification this score gets?
# < 0 handles max scores, > score handles higher classifications
Expand Down Expand Up @@ -292,7 +292,7 @@ def agb_indoor_classification_scores(
# Handle possibility of gaps in the tables or max scores by checking 1 HC point
# above current (floored to handle 0.5) and amending accordingly
for i, (score, handicap) in enumerate(
zip(int_class_scores, group_data["class_HC"]),
zip(int_class_scores, group_data["class_HC"], strict=True),
):
next_score = hc.score_for_round(
np.floor(handicap) + 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def calculate_agb_old_indoor_classification(

groupname = cls_funcs.get_groupname(bowstyle, gender, age_group)
group_data = agb_old_indoor_classifications[groupname]
class_data = dict(zip(group_data["classes"], class_scores))
class_data = dict(zip(group_data["classes"], class_scores, strict=True))

# What is the highest classification this score gets?
# < 0 handles max scores, > score handles higher classifications
Expand Down
14 changes: 1 addition & 13 deletions archeryutils/handicaps/handicap_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@

FloatArray = TypeVar("FloatArray", float, npt.NDArray[np.float64])

# itertools.pairwise not available until python 3.10
# workaround can be removed when support for 3.9 is dropped
# ignore for coverage (runner is > 3.10, ci shows this works on 3.9)
if not hasattr(itr, "pairwise"): # pragma: no cover

def _pairwise(iterable):
a, b = itr.tee(iterable)
next(b, None)
return zip(a, b)

setattr(itr, "pairwise", _pairwise) # noqa: B010


class HandicapScheme(ABC):
r"""
Expand Down Expand Up @@ -266,7 +254,7 @@ def _s_bar(

return max_score - sum(
score_drop * np.exp(-(((arw_rad + (ring_diam / 2)) / sig_r) ** 2))
for ring_diam, score_drop in zip(ring_sizes, score_drops)
for ring_diam, score_drop in zip(ring_sizes, score_drops, strict=True)
)

def score_for_passes(
Expand Down
10 changes: 5 additions & 5 deletions archeryutils/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from collections.abc import Mapping
from functools import partial
from types import MappingProxyType
from typing import Literal, NamedTuple, Union, get_args
from typing import Literal, NamedTuple, TypeAlias, Union, get_args

from archeryutils import length

# TypeAlias (annotate explicitly in py3.10+)
# TypeAlias deprecated. Move to `type` in py3.12+
#: All scoring systems that archeryutils knows how to handle by default.
ScoringSystem = Literal[
ScoringSystem: TypeAlias = Literal[
"5_zone",
"10_zone",
"10_zone_compound",
Expand All @@ -25,9 +25,9 @@
"Custom",
]

# TypeAlias (annotate explicitly in py3.10+)
# TypeAlias deprecated. Move to `type` in py3.12+
#: A mapping of a target ring diameter to the score for that ring.
FaceSpec = Mapping[float, int]
FaceSpec: TypeAlias = Mapping[float, int]

_rnd6 = partial(round, ndigits=6)

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Installation
Required dependencies
---------------------

- Python (3.9 or later)
- Python (3.10 or later)
- `numpy <https://www.numpy.org/>`__ (1.20 or later)

.. _optional-dependencies:
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ authors = [
]
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.9"
requires-python = ">=3.10"
classifiers = [
"License :: OSI Approved :: MIT License",
"Development Status :: 3 - Alpha",
"Natural Language :: English",
"Programming Language :: Python :: 3",
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
Expand Down
Loading