Compare commits

..

No commits in common. "master" and "v0.2.0" have entirely different histories.

10 changed files with 696 additions and 1686 deletions

View File

@ -1,22 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: 💚 ci
include: "scope"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: ⬆️ dep-bump
include: "scope"

View File

@ -2,9 +2,9 @@ name: Lint and test
on: on:
push: push:
branches: ["**"] branches: [ "**" ]
pull_request: pull_request:
branches: [master] branches: [ master ]
jobs: jobs:
test: test:
@ -12,36 +12,34 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"] python_version: ["3.8", "3.9", "3.10"]
fail-fast: false fail-fast: false
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python_version }} - name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python_version }} python-version: ${{ matrix.python_version }}
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root
- name: Install poetry - name: Install poetry
uses: abatilo/actions-poetry@v4 if: steps.cache.outputs.cache-hit != 'true'
with:
poetry-version: "2.1.2"
- name: Configure poetry
run: | run: |
poetry config virtualenvs.create true --local python -m pip install --upgrade pip
poetry config virtualenvs.in-project true --local python -m pip install poetry
- uses: actions/cache@v4 - name: Configure poetry
name: Define a cache for the virtual environment based on the dependencies lock file run: python -m poetry config virtualenvs.create false
with:
path: ./.venv
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }}-venv
- name: Install build dependencies
run: sudo apt install -y libxml2-dev libxslt-dev
- name: Install Dependencies - name: Install Dependencies
run: poetry install if: steps.cache.outputs.cache-hit != 'true'
run: python -m poetry install
- name: Lint with black - name: Lint with black
run: | run: |
# stop the build if there are Python syntax errors or undefined names # stop the build if there are Python syntax errors or undefined names
poetry run black --check --diff pandas_ods_reader/ tests/ black --check --diff pandas_ods_reader/ tests/
- name: Test with pytest - name: Test with pytest
run: | run: |
poetry run pytest tests/ python -m pytest tests/

6
.gitignore vendored
View File

@ -33,9 +33,3 @@ venv/
# mypy # mypy
.mypy_cache/ .mypy_cache/
# pyenv
.python-version
# mise
mise.local.toml

View File

@ -1,5 +1,4 @@
"""Imports an ods or fods file into a DataFrame object""" """Imports an ods or fods file into a DataFrame object"""
from pathlib import Path from pathlib import Path
from typing import Optional, List, Union from typing import Optional, List, Union
@ -37,11 +36,11 @@ def read_ods(
""" """
path = file_or_path if isinstance(file_or_path, Path) else Path(file_or_path) path = file_or_path if isinstance(file_or_path, Path) else Path(file_or_path)
if not path.is_file(): if not path.is_file():
raise FileNotFoundError(f"file {path} does not exist") raise FileNotFoundError(f"file {file_or_path} does not exist")
backend = EXT_MAP.get(path.suffix, ods) backend = EXT_MAP.get(Path(file_or_path).suffix, ods)
return algo.read_data( return algo.read_data(
backend, backend,
path, Path(file_or_path),
sheet, sheet,
headers=headers, headers=headers,
columns=columns or [], columns=columns or [],

View File

@ -64,7 +64,7 @@ def get_value(
text = cell.find(TABLE_CELL_TEXT_TAG, namespaces=cell.nsmap) text = cell.find(TABLE_CELL_TEXT_TAG, namespaces=cell.nsmap)
if text is None: if text is None:
return None, 0 return None, 0
value: Union[str, float] = "".join(text.itertext()) value: Union[str, float] = text.text or ""
if parsed and is_float(cell): if parsed and is_float(cell):
value = float(value) value = float(value)
_n_repeated = cell.attrib.get( _n_repeated = cell.attrib.get(

View File

@ -1,5 +1,4 @@
"""Provides utility functions for the parser""" """Provides utility functions for the parser"""
import pandas as pd import pandas as pd

2242
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +1,39 @@
[tool.poetry] [tool.poetry]
name = "pandas-ods-reader" name = "pandas-ods-reader"
version = "1.0.2" version = "0.2.0"
description = "Read in .ods and .fods files and return a pandas.DataFrame." description = "Read in .ods and .fods files and return a pandas.DataFrame."
authors = ["iuvbio <iuvbio@users.noreply.github.com>"] authors = ["iuvbio <iuvbio@users.noreply.github.com>"]
license = "MIT" license = "MIT"
readme = "README.md" readme = "README.md"
repository = "https://github.com/iuvbio/pandas_ods_reader" repository = "https://github.com/iuvbio/pandas_ods_reader"
keywords = ["data", "io", "pandas", "ods"] keywords = [ "data", "io", "pandas", "ods" ]
classifiers = [ classifiers = [
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Topic :: Utilities", "Topic :: Utilities"
] ]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">=3.9,<4" python = ">=3.8.1,<3.12"
ezodf = ">=0.3.2" ezodf = "^0.3.2"
lxml = ">=4.9.2" lxml = "^4.9.2"
pandas = ">=2.2.3" pandas = "^1.5.2"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = ">=22.10.0" black = "^22.10.0"
pytest = ">=7.1.3" pytest = "^7.1.3"
pytest-cov = ">=4.0.0" pytest-cov = "^4.0.0"
mypy = ">=0.991" mypy = "^0.991"
flake8 = ">=6.0.0" flake8 = "^6.0.0"
pandas-stubs = ">=1.5.2.221213" pandas-stubs = "^1.5.2.221213"
types-lxml = ">=2022.11.8" types-lxml = "^2022.11.8"
commitizen = ">=2.38.0" commitizen = "^2.38.0"
pre-commit = ">=3.7.1"
[tool.commitizen] [tool.commitizen]
name = "cz_conventional_commits" name = "cz_conventional_commits"
version = "0.2.0"
tag_format = "v$version" tag_format = "v$version"
version_provider = "poetry"
version_files = ["pyproject.toml:version"] version_files = ["pyproject.toml:version"]
[build-system] [build-system]

View File

@ -1,5 +1,4 @@
"""Tests for core read_ods function with different files""" """Tests for core read_ods function with different files"""
from pathlib import Path from pathlib import Path
import pandas as pd import pandas as pd