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 }}
- name: Install poetry - uses: actions/cache@v2
uses: abatilo/actions-poetry@v4 id: cache
with: with:
poetry-version: "2.1.2" path: ${{ env.pythonLocation }}
- name: Configure poetry key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root
run: | - name: Install poetry
poetry config virtualenvs.create true --local if: steps.cache.outputs.cache-hit != 'true'
poetry config virtualenvs.in-project true --local run: |
- uses: actions/cache@v4 python -m pip install --upgrade pip
name: Define a cache for the virtual environment based on the dependencies lock file python -m pip install poetry
with: - name: Configure poetry
path: ./.venv run: python -m poetry config virtualenvs.create false
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }}-venv - name: Install Dependencies
- name: Install build dependencies if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt install -y libxml2-dev libxslt-dev run: python -m poetry install
- name: Install Dependencies - name: Lint with black
run: poetry install run: |
- name: Lint with black # stop the build if there are Python syntax errors or undefined names
run: | black --check --diff pandas_ods_reader/ tests/
# stop the build if there are Python syntax errors or undefined names - name: Test with pytest
poetry run black --check --diff pandas_ods_reader/ tests/ run: |
- name: Test with pytest python -m pytest tests/
run: |
poetry run 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