Skip to content

Commit eeeb5e1

Browse files
committed
Release 2.0.1: full modernisation and test improvements
2.0.0: - Drop Python 2 and old Python 3; require Python 3.12+ - Replace setup.py with pyproject.toml (PEP 517/518) - Add full type annotations and py.typed marker (PEP 561) - Add __enter__/__exit__ context manager to DocReader - Add __repr__ to DocReader - Switch @cached to functools.cached_property following cfb 0.9.x API - Fix Python 3 bytes decoding: compressed text as cp1252, uncompressed as utf-16-le - Fix integer division bug: fc_fc /= 2 -> fc_fc //= 2 - Add pytest test suite, Black, Ruff, mypy (strict), pre-commit, GitHub Actions CI 2.0.1: - Modernise test suite: autouse suppress_warnings with catch_warnings() + yield, reader fixture with proper teardown via context manager - Add test_read_full_content and test_n_table_name tests - Close superseded PR #2 (both its fixes were already in 2.0.0)
1 parent 9a63547 commit eeeb5e1

18 files changed

Lines changed: 514 additions & 146 deletions

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
8+
- package-ecosystem: "pip"
9+
directory: "/"
10+
schedule:
11+
interval: "monthly"

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.12", "3.13"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install cfb (not yet on PyPI)
25+
run: pip install git+https://github.com/rembish/cfb.git
26+
27+
- name: Install dependencies
28+
run: pip install -e ".[dev]"
29+
30+
- name: Check formatting (black)
31+
run: black --check miette tests
32+
33+
- name: Lint (ruff)
34+
run: ruff check miette tests
35+
36+
- name: Type check (mypy)
37+
run: mypy miette
38+
39+
- name: Run tests
40+
run: pytest --cov=miette --cov-report=xml
41+
42+
- name: Upload coverage
43+
uses: codecov/codecov-action@v4
44+
with:
45+
files: coverage.xml
46+
continue-on-error: true

.gitignore

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1+
__pycache__/
12
*.pyc
2-
nbproject/*
3-
.idea
4-
*.egg-info
5-
dist
3+
*.pyo
4+
*.pyd
5+
6+
*.egg-info/
7+
*.egg
8+
dist/
9+
build/
10+
11+
.venv/
12+
venv/
13+
14+
.mypy_cache/
15+
.ruff_cache/
16+
.pytest_cache/
17+
coverage.xml
18+
.coverage
19+
20+
.idea/
21+
.vscode/
22+
*.iml

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 24.10.0
4+
hooks:
5+
- id: black
6+
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.8.6
9+
hooks:
10+
- id: ruff
11+
args: [--fix]

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Changelog
2+
3+
## 2.0.1 (2026-02-18)
4+
5+
- Modernise test suite: autouse `suppress_warnings` with `catch_warnings()` + yield, `reader` fixture with proper teardown via context manager
6+
- Add `test_read_full_content` and `test_n_table_name` tests
7+
- Close superseded PR #2 (both its fixes were already in 2.0.0)
8+
9+
## 2.0.0 (2026-02-18)
10+
11+
- Dropped Python 2 and older Python 3 support; requires Python 3.12+
12+
- Replaced `setup.py` with `pyproject.toml` (PEP 517/518)
13+
- Added full type annotations and `py.typed` marker (PEP 561)
14+
- Added `__enter__`/`__exit__` context manager support to `DocReader`
15+
- Added `__repr__` to `DocReader`
16+
- Switched `@cached` to `functools.cached_property` following cfb 0.9.x API
17+
- Fixed Python 3 bytes decoding: compressed text decoded as `cp1252`,
18+
uncompressed as `utf-16-le`
19+
- Fixed integer division bug: `fc_fc /= 2``fc_fc //= 2`
20+
- Added pytest test suite with 90%+ coverage
21+
- Added Black, Ruff, mypy (strict) tooling
22+
- Added GitHub Actions CI and Dependabot configuration
23+
24+
## 1.5 (2013)
25+
26+
- Last 1.x release

Makefile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
VENV := .venv
2+
PYTHON := $(VENV)/bin/python
3+
PIP := $(VENV)/bin/pip
4+
5+
.PHONY: help install lint format typecheck test pre-commit clean
6+
7+
help:
8+
@echo "Usage: make <target>"
9+
@echo ""
10+
@echo " install set up the virtual environment"
11+
@echo " lint run ruff"
12+
@echo " format run black"
13+
@echo " typecheck run mypy"
14+
@echo " test run pytest with coverage"
15+
@echo " pre-commit install pre-commit hooks"
16+
@echo " clean remove build artifacts and caches"
17+
18+
$(VENV)/bin/activate: pyproject.toml
19+
python3 -m venv $(VENV)
20+
$(PIP) install --upgrade pip
21+
$(PIP) install -e "../cfb"
22+
$(PIP) install -e ".[dev]"
23+
touch $(VENV)/bin/activate
24+
25+
install: $(VENV)/bin/activate
26+
@echo "Virtual environment ready at $(VENV)/"
27+
28+
lint: $(VENV)/bin/activate
29+
$(VENV)/bin/ruff check miette tests
30+
31+
format: $(VENV)/bin/activate
32+
$(VENV)/bin/black miette tests
33+
34+
typecheck: $(VENV)/bin/activate
35+
$(VENV)/bin/mypy miette
36+
37+
test: $(VENV)/bin/activate
38+
$(VENV)/bin/pytest --cov=miette --cov-report=term-missing
39+
40+
pre-commit: $(VENV)/bin/activate
41+
$(VENV)/bin/pre-commit install
42+
43+
clean:
44+
rm -rf $(VENV) build dist *.egg-info .mypy_cache .ruff_cache .pytest_cache __pycache__
45+
find . -type d -name __pycache__ -exec rm -rf {} +
46+
find . -name "*.pyc" -delete

README

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Miette
2+
3+
Miette is a "small sweet thing" in French.
4+
5+
In another way, Miette is a light-weight, low-memory-usage library for reading
6+
Microsoft Office documents — starting with Word Binary Files (`.doc`).
7+
8+
Requires Python 3.12+ and the [cfb](https://github.com/rembish/cfb) library.
9+
10+
## Usage
11+
12+
```python
13+
from miette import DocReader
14+
15+
doc = DocReader("document.doc")
16+
print(doc.read())
17+
```
18+
19+
## Development
20+
21+
```bash
22+
make install # set up virtualenv + install dev dependencies
23+
make format # run black
24+
make lint # run ruff
25+
make typecheck # run mypy
26+
make test # run pytest with coverage
27+
make pre-commit # install pre-commit hooks
28+
make clean # remove build artifacts and caches
29+
```
30+
31+
> **Note:** `cfb` is not yet on PyPI. The Makefile installs it from `../cfb`.
32+
> For CI, it is installed from GitHub.
33+
34+
## License
35+
36+
BSD 2-Clause — see [LICENSE](LICENSE).

miette/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
from miette.doc import DocReader
1+
"""Miette — light-weight Microsoft Office document reader."""
2+
3+
from .doc import DocReader
4+
5+
__all__ = ["DocReader"]

0 commit comments

Comments
 (0)