Skip to content
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
24 changes: 15 additions & 9 deletions .github/workflows/pre-commit_hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v2

- name: set up python 3.8
- uses: actions/checkout@v1

- name: python setup 3.9
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: '3.9'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true

- name: install pre-commit
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
poetry install --with dev

- name: run static analysis
- name: run tests
run: |
pre-commit run --all-files
poetry run pre-commit run --all
16 changes: 11 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:

Expand All @@ -19,14 +19,20 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: install flupy
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
poetry install --with dev

- name: run tests
run: |
pytest --cov=src/flupy src/tests --cov-report=xml
poetry run pytest --cov=src/flupy src/tests --cov-report=xml

- name: upload coverage to codecov
uses: codecov/codecov-action@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__
.python-version

.benchmarks
poetry.lock

pip-wheel-metadata/

Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.6.4
rev: v5.10.1
hooks:
- id: isort
args: ['--multi-line=3', '--trailing-comma', '--force-grid-wrap=0', '--use-parentheses', '--line-width=88']


- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -21,14 +21,14 @@ repos:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports']

- repo: https://github.com/ambv/black
rev: 22.10.0
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3.8
language_version: python3.9

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.15.0
hooks:
- id: mypy
files: flupy/
Expand Down
70 changes: 69 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
[tool.poetry]
name = "flupy"
version = "1.2.2"
description = "Fluent data processing in Python - a chainable stream processing library for expressive data manipulation using method chaining"
authors = ["Oliver Rice <[email protected]>"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/olirice/flupy"
packages = [{include = "flupy", from = "src"}]
classifiers = [
"Development Status :: 4 - Beta",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[tool.poetry.dependencies]
python = ">=3.9"
typing_extensions = ">=4"

[tool.poetry.group.dev.dependencies]
pytest = "*"
pytest-cov = "*"
pytest-benchmark = "*"
pre-commit = "*"
pylint = "*"
black = "*"
mypy = "*"

[tool.poetry.scripts]
flu = "flupy.cli.cli:main"
flu_precommit = "flupy.cli.cli:precommit"

[build-system]
requires = ["poetry-core>=2.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length=120
line-length = 120
exclude = '''
/(
\.git
Expand All @@ -13,3 +56,28 @@ exclude = '''
| dist
)/
'''

[tool.mypy]
python_version = "3.9"
ignore_missing_imports = true
strict_optional = true
follow_imports = "skip"
warn_redundant_casts = true
warn_unused_ignores = false
check_untyped_defs = true
no_implicit_reexport = true
disallow_untyped_defs = true
disallow_any_generics = true

[tool.pytest.ini_options]
addopts = "--cov=src/flupy src/tests"

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise AssertionError",
"raise NotImplementedError",
"@overload",
"pass",
]
109 changes: 0 additions & 109 deletions setup.py

This file was deleted.

5 changes: 3 additions & 2 deletions src/flupy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from importlib.metadata import version

from flupy.cli.utils import walk_dirs, walk_files
from flupy.fluent import flu

__project__ = "flupy"

__version__ = "1.2.1"
__version__ = version(__project__)

__all__ = ["flu", "walk_files", "walk_dirs"]
16 changes: 5 additions & 11 deletions src/flupy/fluent.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,18 +510,15 @@ def fold_left(self, func: Callable[[S, T], S], initial: S) -> S:
return reduce(func, self, initial)

@overload
def zip(self, __iter1: Iterable[_T1]) -> "Fluent[Tuple[T, _T1]]":
...
def zip(self, __iter1: Iterable[_T1]) -> "Fluent[Tuple[T, _T1]]": ...

@overload
def zip(self, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> "Fluent[Tuple[T, _T1, _T2]]":
...
def zip(self, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> "Fluent[Tuple[T, _T1, _T2]]": ...

@overload
def zip(
self, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]
) -> "Fluent[Tuple[T, _T1, _T2, _T3]]":
...
) -> "Fluent[Tuple[T, _T1, _T2, _T3]]": ...

@overload
def zip(
Expand All @@ -531,12 +528,9 @@ def zip(
__iter3: Iterable[Any],
__iter4: Iterable[Any],
*iterable: Iterable[Any],
) -> "Fluent[Tuple[T, ...]]":
...
) -> "Fluent[Tuple[T, ...]]": ...

def zip(
self, *iterable: Iterable[Any]
) -> Union[
def zip(self, *iterable: Iterable[Any]) -> Union[
"Fluent[Tuple[T, ...]]",
"Fluent[Tuple[T, _T1]]",
"Fluent[Tuple[T, _T1, _T2]]",
Expand Down
23 changes: 23 additions & 0 deletions src/tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Tests for version information.
"""

import re

import flupy


def test_version_format():
"""Test that __version__ follows semantic versioning format (MAJOR.MINOR.PATCH)."""
# Standard semver regex pattern
semver_pattern = r"^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"

assert re.match(
semver_pattern, flupy.__version__
), f"Version '{flupy.__version__}' does not match semantic versioning format"

# Ensure version parts can be parsed as integers
major, minor, patch = flupy.__version__.split("-")[0].split("+")[0].split(".")[:3]
assert major.isdigit(), f"Major version '{major}' is not a valid integer"
assert minor.isdigit(), f"Minor version '{minor}' is not a valid integer"
assert patch.isdigit(), f"Patch version '{patch}' is not a valid integer"