Skip to content

Commit

Permalink
feat: extend fastexcel support to python >= 3.8 (#152)
Browse files Browse the repository at this point in the history
* feat: extend support to python 3.8+

* update release workflow

* don't forget 3.8 for macos

* Update .github/workflows/release.yml

---------

Co-authored-by: Luka Peschke <[email protected]>
Co-authored-by: Luka Peschke <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2024
1 parent d9fa12c commit 54b882d
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python python3.10
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: build (fast)
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: build (release)
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: build (release)
Expand All @@ -51,6 +51,16 @@ jobs:
runs-on: ubuntu-latest
needs: [linux, macos]
steps:
- name: Download Linux 3.8 wheels
uses: actions/download-artifact@v4
with:
name: "wheels-linux-python-3.8"
path: wheels-linux
- name: Download Linux 3.9 wheels
uses: actions/download-artifact@v4
with:
name: "wheels-linux-python-3.9"
path: wheels-linux
- name: Download Linux 3.10 wheels
uses: actions/download-artifact@v4
with:
Expand All @@ -67,6 +77,16 @@ jobs:
name: "wheels-linux-python-3.12"
path: wheels-linux

- name: Download MacOS 3.8 wheels
uses: actions/download-artifact@v4
with:
name: "wheels-macos-python-3.8"
path: wheels-macos
- name: Download MacOS 3.9 wheels
uses: actions/download-artifact@v4
with:
name: "wheels-macos-python-3.9"
path: wheels-macos
- name: Download MacOS 3.10 wheels
uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ __pycache__
*.pyc
*.so
*.dat

.python-version
.venv
docs
.idea
.benchmarks
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Docs available [here](https://fastexcel.toucantoco.dev/).

### Prerequisites

Python>=3.10 and a recent Rust toolchain must be installed on your machine. `cargo` must be available in your `PATH`.
Python>=3.8 and a recent Rust toolchain must be installed on your machine. `cargo` must be available in your `PATH`.

### First setup

Expand All @@ -31,7 +31,7 @@ This will compile the wheel (in debug mode) and install it. It will then be avai

### Installing the project in prod mode

This is required for profiling, as dev mdoe wheels are much slower. `make prod-install` will compile the project
This is required for profiling, as dev mode wheels are much slower. `make prod-install` will compile the project
in release mode and install it in your local venv, overriding previous dev installs.

### Linting and formatting
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "fastexcel"
requires-python = ">=3.10"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
Expand All @@ -27,7 +27,7 @@ python-source = "python"
module-name = "fastexcel._fastexcel"

[tool.mypy]
python_version = "3.10"
python_version = "3.8"
follow_imports = "silent"
ignore_missing_imports = true
# A few custom options
Expand All @@ -45,4 +45,4 @@ testpaths = [
line-length = 100

# Enable Pyflakes `E` and `F` codes by default.
select = ["E", "F", "Q"]
select = ["E", "F", "I", "Q", "FA102"]
2 changes: 2 additions & 0 deletions python/fastexcel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
Expand Down
2 changes: 2 additions & 0 deletions python/fastexcel/_fastexcel.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pyarrow as pa

class _ExcelSheet:
Expand Down
18 changes: 10 additions & 8 deletions python/tests/benchmarks/memory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import Enum
import argparse
from enum import Enum

from readers import fastexcel_read, pyxl_read, xlrd_read


Expand All @@ -18,13 +19,14 @@ def get_args() -> argparse.Namespace:

def main():
args = get_args()
match args.engine:
case Engine.FASTEXCEL:
fastexcel_read(args.file)
case Engine.XLRD:
xlrd_read(args.file)
case Engine.OPENPYXL:
pyxl_read(args.file)
engine = args.engine

if engine == Engine.FASTEXCEL:
fastexcel_read(args.file)
elif engine == Engine.XLRD:
xlrd_read(args.file)
elif engine == Engine.OPENPYXL:
pyxl_read(args.file)


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion python/tests/test_durations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from datetime import date, datetime, timedelta

import fastexcel
Expand All @@ -11,7 +13,6 @@
from polars.datatypes import PolarsDataType
from polars.datatypes import Utf8 as PlUtf8
from polars.testing import assert_frame_equal as pl_assert_frame_equal

from utils import path_for_fixture


Expand Down
1 change: 0 additions & 1 deletion python/tests/test_empty.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fastexcel
import pytest

from utils import path_for_fixture


Expand Down
1 change: 0 additions & 1 deletion python/tests/test_fastexcel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest
from pandas.testing import assert_frame_equal as pd_assert_frame_equal
from polars.testing import assert_frame_equal as pl_assert_frame_equal

from utils import path_for_fixture


Expand Down

0 comments on commit 54b882d

Please sign in to comment.