Skip to content

Commit e5b3d77

Browse files
authored
Merge pull request #393 from pbs-data-solutions/drop-python-3.8-support
Drop support for python 3.8
2 parents 65d596e + 2ed9a37 commit e5b3d77

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

.github/workflows/testing.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
CARGO_TERM_COLOR: always
99
RUST_BACKTRACE: 1
1010
RUSTFLAGS: "-D warnings"
11+
PYTHON_VERSION: "3.10" # Because of pandas types
1112
jobs:
1213
clippy:
1314
name: Clippy
@@ -33,11 +34,31 @@ jobs:
3334
uses: Swatinem/[email protected]
3435
- name: Run cargo fmt
3536
run: cargo fmt --all -- --check
37+
python-linting:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: install Just
42+
uses: taiki-e/install-action@just
43+
- name: Set up Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: ${{ env.PYTHON_VERSION }}
47+
cache: "pip"
48+
- name: Install dependencies
49+
run: |
50+
pip install -U pip
51+
pip install -r requirements-dev.txt
52+
pip install -e .[all]
53+
maturin build --out dist
54+
pip install --no-index --find-links=dist/ prelude-parser
55+
- name: mypy check
56+
run: just mypy
3657
test:
3758
strategy:
3859
fail-fast: false
3960
matrix:
40-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
61+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
4162
os: [ubuntu-latest, windows-latest, macos-latest]
4263
runs-on: ${{ matrix.os }}
4364
steps:

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ pip install prelude-parser
1616

1717
Optionally the `pandas` extra can be installed to parse to a Pandas `DataFrame`
1818

19-
Note: Pandas only supports Python 3.9+ so this is not available in Python 3.8.
20-
2119
```sh
2220
pip install prelude-parser[pandas]
2321
```

prelude_parser/pandas.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import sys
43
from pathlib import Path
54

65
from prelude_parser._prelude_parser import _parse_flat_file_to_pandas_dict
@@ -13,9 +12,6 @@ class UnsupportedPythonVersionError(Exception):
1312
try:
1413
import pandas as pd
1514
except ImportError as e: # pragma: no cover
16-
if sys.version_info < (3, 9): # pargma: no cover
17-
raise UnsupportedPythonVersionError("Pandas only supports Python 3.9+") from e
18-
1915
raise ImportError(
2016
"prelude-parser must be installed with the pandas or all extra to use pandas"
2117
) from e

prelude_parser/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# UP035 and UP006 ignored because Python 3.9 doesn't support the upgrade
2+
13
from datetime import date, datetime
2-
from typing import Dict, List, Union
4+
from typing import Dict, List, Union # noqa: UP035
35

46
FieldInfo = Union[str, int, float, date, datetime, None]
5-
FlatFormInfo = List[Dict[str, FieldInfo]]
7+
FlatFormInfo = List[Dict[str, FieldInfo]] # noqa: UP006

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ build-backend = "maturin"
44

55
[project]
66
name = "prelude-parser"
7-
requires-python = ">=3.8"
7+
requires-python = ">=3.9"
88
description = "Parses XML files exported from Prelude EDC into formats usable by Python."
99
authors = [{name = "Paul Sanders", email = "[email protected]"}]
1010
keywords = ["parser", "prelude-edc", "xml", "pandas", "polars"]
1111
classifiers = [
1212
"Programming Language :: Rust",
1313
"Programming Language :: Python :: Implementation :: CPython",
14-
"Programming Language :: Python :: 3.8",
1514
"Programming Language :: Python :: 3.9",
1615
"Programming Language :: Python :: 3.10",
1716
"Programming Language :: Python :: 3.11",
@@ -29,9 +28,9 @@ documentation = "https://github.com/pbs-data-solutions/prelude-parser"
2928
dependencies = ["camel-converter>=3.0.0"]
3029

3130
[project.optional-dependencies]
32-
pandas = ['pandas>=2.1.0; python_version>"3.8"']
31+
pandas = ["pandas>=2.1.0"]
3332
polars = ["polars>=0.17.14"]
34-
all = ['pandas>=2.1.0; python_version>"3.8"', "polars>=0.17.14"]
33+
all = ["pandas>=2.1.0", "polars>=0.17.14"]
3534

3635
[tool.maturin]
3736
module-name = "prelude_parser._prelude_parser"
@@ -52,7 +51,7 @@ disallow_untyped_defs = false
5251

5352
[tool.ruff]
5453
line-length = 100
55-
target-version = "py38"
54+
target-version = "py39"
5655
fix = true
5756

5857
[tool.ruff.lint]

tests/test_pandas.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
import sys
1+
import pandas as pd
22

3-
import pytest
3+
from prelude_parser.pandas import to_dataframe
44

5-
if sys.version_info >= (3, 9):
6-
import pandas as pd
75

8-
from prelude_parser.pandas import to_dataframe
9-
10-
11-
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Pandas only supports 3.9+")
126
def test_pandas_to_dataframe(test_file_1):
137
result = to_dataframe(test_file_1)
148
data = {
@@ -32,7 +26,6 @@ def test_pandas_to_dataframe(test_file_1):
3226
assert expected.equals(result)
3327

3428

35-
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Pandas only supports 3.9+")
3629
def test_pandas_to_dataframe_short_names(test_file_4):
3730
result = to_dataframe(test_file_4, short_names=True)
3831
data = {

0 commit comments

Comments
 (0)