Skip to content
Merged

deps #11

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
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
python-version: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- uses: actions/setup-python@v5
persist-credentials: false
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v6
- uses: astral-sh/setup-uv@ed21f2f24f8dd64503750218de024bcf64c7250a # v7.1.5
- run: make lint
- run: make test
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.11
rev: v0.14.9
hooks:
- id: ruff-check
args: ["--fix"]
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ lint:
dist:
rm -f dist/*.tar.gz
rm -f dist/*.whl
python -m build
uv build
twine check dist/*

# Update the lock file.
.PHONY: update
update:
uv lock --upgrade
uvx gha-update
uv run pre-commit autoupdate

# Upload the distribution
Expand Down
16 changes: 10 additions & 6 deletions fava_plugins/split_income.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import re
from decimal import Decimal
from typing import Any
from typing import NamedTuple
from typing import TYPE_CHECKING

from beancount.core import convert
Expand All @@ -67,13 +68,18 @@

if TYPE_CHECKING:
from beancount.core.data import Directive
from beancount.core.data import Meta

__plugins__ = ("split_income",)

SplitIncomeError = collections.namedtuple(
"SplitIncomeError",
"source message entry",
)

class SplitIncomeError(NamedTuple):
"""Error from the split_income plugin."""

source: Meta
message: str
entry: Directive | None = None


ZERO = Decimal()

Expand All @@ -82,7 +88,6 @@ def split_income(
entries: list[Directive], options_map: Any, config_str: str
) -> tuple[list[Directive], list[SplitIncomeError]]:
"""Split income transactions."""

errors = []
new_entries: list[Directive] = []
new_accounts = set()
Expand All @@ -102,7 +107,6 @@ def split_income(
SplitIncomeError(
data.new_metadata(options_map["filename"], 0),
f"Syntax error in config: {config_str}",
None,
),
)
return entries, errors
Expand Down
21 changes: 14 additions & 7 deletions fava_plugins/todo_as_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,38 @@

from __future__ import annotations

import collections
from typing import Any
from typing import NamedTuple
from typing import TYPE_CHECKING

from beancount.core.data import Transaction

if TYPE_CHECKING:
from beancount.core.data import Directive
from beancount.core.data import Meta

__plugins__ = [
"todo_as_error",
]

TodoError = collections.namedtuple("TodoError", "source message entry")

class TodoError(NamedTuple):
"""Error from the split_income plugin."""

source: Meta
message: str
entry: Directive


def todo_as_error(
entries: list[Directive],
_: Any,
) -> tuple[list[Directive], list[TodoError]]:
"""Create errors for entries 'todo' metadata."""
errors = []

for entry in entries:
if isinstance(entry, Transaction) and "todo" in entry.meta:
errors.append(TodoError(entry.meta, entry.meta["todo"], entry))
errors = [
TodoError(entry.meta, entry.meta["todo"], entry)
for entry in entries
if isinstance(entry, Transaction) and "todo" in entry.meta
]

return entries, errors
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Office/Business :: Financial :: Accounting",
"Topic :: Office/Business :: Financial :: Investment",
]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_todo_as_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ def test_todo_as_error(load_doc: LoaderResult) -> None:
assert len(errors) == 1
error = errors[0]
assert isinstance(error, TodoError)
assert error.message == "This will become an error" # type: ignore[attr-defined]
assert error.message == "This will become an error"
656 changes: 413 additions & 243 deletions uv.lock

Large diffs are not rendered by default.

Loading