diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9d0cd46..41a263a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -8,6 +8,7 @@ env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 RUSTFLAGS: "-D warnings" + PYTHON_VERSION: "3.10" # Because of pandas types jobs: clippy: name: Clippy @@ -33,11 +34,31 @@ jobs: uses: Swatinem/rust-cache@v2.7.3 - name: Run cargo fmt run: cargo fmt --all -- --check + python-linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: install Just + uses: taiki-e/install-action@just + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: "pip" + - name: Install dependencies + run: | + pip install -U pip + pip install -r requirements-dev.txt + pip install -e .[all] + maturin build --out dist + pip install --no-index --find-links=dist/ prelude-parser + - name: mypy check + run: just mypy test: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: diff --git a/README.md b/README.md index f1e80c3..227da6b 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ pip install prelude-parser Optionally the `pandas` extra can be installed to parse to a Pandas `DataFrame` -Note: Pandas only supports Python 3.9+ so this is not available in Python 3.8. - ```sh pip install prelude-parser[pandas] ``` diff --git a/prelude_parser/pandas.py b/prelude_parser/pandas.py index 6ed3c82..59375d9 100644 --- a/prelude_parser/pandas.py +++ b/prelude_parser/pandas.py @@ -1,6 +1,5 @@ from __future__ import annotations -import sys from pathlib import Path from prelude_parser._prelude_parser import _parse_flat_file_to_pandas_dict @@ -13,9 +12,6 @@ class UnsupportedPythonVersionError(Exception): try: import pandas as pd except ImportError as e: # pragma: no cover - if sys.version_info < (3, 9): # pargma: no cover - raise UnsupportedPythonVersionError("Pandas only supports Python 3.9+") from e - raise ImportError( "prelude-parser must be installed with the pandas or all extra to use pandas" ) from e diff --git a/prelude_parser/types.py b/prelude_parser/types.py index 43d8c28..1c2c13c 100644 --- a/prelude_parser/types.py +++ b/prelude_parser/types.py @@ -1,5 +1,7 @@ +# UP035 and UP006 ignored because Python 3.9 doesn't support the upgrade + from datetime import date, datetime -from typing import Dict, List, Union +from typing import Dict, List, Union # noqa: UP035 FieldInfo = Union[str, int, float, date, datetime, None] -FlatFormInfo = List[Dict[str, FieldInfo]] +FlatFormInfo = List[Dict[str, FieldInfo]] # noqa: UP006 diff --git a/pyproject.toml b/pyproject.toml index 41aa8bf..48db8d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,14 +4,13 @@ build-backend = "maturin" [project] name = "prelude-parser" -requires-python = ">=3.8" +requires-python = ">=3.9" description = "Parses XML files exported from Prelude EDC into formats usable by Python." authors = [{name = "Paul Sanders", email = "paul@pbsdatasolutions.com"}] keywords = ["parser", "prelude-edc", "xml", "pandas", "polars"] classifiers = [ "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -29,9 +28,9 @@ documentation = "https://github.com/pbs-data-solutions/prelude-parser" dependencies = ["camel-converter>=3.0.0"] [project.optional-dependencies] -pandas = ['pandas>=2.1.0; python_version>"3.8"'] +pandas = ["pandas>=2.1.0"] polars = ["polars>=0.17.14"] -all = ['pandas>=2.1.0; python_version>"3.8"', "polars>=0.17.14"] +all = ["pandas>=2.1.0", "polars>=0.17.14"] [tool.maturin] module-name = "prelude_parser._prelude_parser" @@ -52,7 +51,7 @@ disallow_untyped_defs = false [tool.ruff] line-length = 100 -target-version = "py38" +target-version = "py39" fix = true [tool.ruff.lint] diff --git a/tests/test_pandas.py b/tests/test_pandas.py index 66112bb..bead39d 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -1,14 +1,8 @@ -import sys +import pandas as pd -import pytest +from prelude_parser.pandas import to_dataframe -if sys.version_info >= (3, 9): - import pandas as pd - from prelude_parser.pandas import to_dataframe - - -@pytest.mark.skipif(sys.version_info < (3, 9), reason="Pandas only supports 3.9+") def test_pandas_to_dataframe(test_file_1): result = to_dataframe(test_file_1) data = { @@ -32,7 +26,6 @@ def test_pandas_to_dataframe(test_file_1): assert expected.equals(result) -@pytest.mark.skipif(sys.version_info < (3, 9), reason="Pandas only supports 3.9+") def test_pandas_to_dataframe_short_names(test_file_4): result = to_dataframe(test_file_4, short_names=True) data = {