From 3dd511b91352b798a4625d6dc7a97014d0cb126b Mon Sep 17 00:00:00 2001 From: Patrick Ruckstuhl Date: Wed, 14 Aug 2024 17:17:12 +0000 Subject: [PATCH] Fix setup * force beancount < 3 * enable test on pull_requests * pre-commit updates * formatting with newer versions --- .github/workflows/ci.yml | 5 +++-- .pre-commit-config.yaml | 14 +++++++------- setup.cfg | 2 +- smart_importer/__init__.py | 1 + smart_importer/detector.py | 1 + smart_importer/hooks.py | 1 + smart_importer/pipelines.py | 1 + smart_importer/predictor.py | 1 + tests/data_test.py | 1 + tests/pipelines_test.py | 1 + tests/predictors_test.py | 1 + 11 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5273065..8508d03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,14 @@ name: ci on: push: + pull_request: jobs: test: name: Run tests and build distribution runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.12, 3.8] steps: - uses: actions/checkout@master with: @@ -34,7 +35,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v1 with: - python-version: 3.9 + python-version: 3.12 - name: Install Dependencies run: | pip install wheel setuptools diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0599f97..6b7a6ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ exclude: '^docs/conf.py' repos: -- repo: git://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 hooks: - id: trailing-whitespace - id: check-added-large-files @@ -18,18 +18,18 @@ repos: args: ['--fix=auto'] - repo: https://github.com/pycqa/isort - rev: 5.9.3 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 21.8b0 + rev: 24.8.0 hooks: - id: black language_version: python3 -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 +- repo: https://github.com/PyCQA/flake8 + rev: 7.1.1 hooks: - id: flake8 @@ -40,7 +40,7 @@ repos: files: README.rst - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910 + rev: v1.11.1 hooks: - id: mypy args: [--install-types, --non-interactive, --ignore-missing-imports] diff --git a/setup.cfg b/setup.cfg index 069ef3d..5a0d48a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ packages = find: setup_requires = setuptools_scm install_requires = - beancount>=2.0.0 + beancount>=2.0.0,<3.0.0 scikit-learn>=0.19 numpy>=1.8.2 scipy>=0.13.3 diff --git a/smart_importer/__init__.py b/smart_importer/__init__.py index 0336928..9642050 100644 --- a/smart_importer/__init__.py +++ b/smart_importer/__init__.py @@ -1,4 +1,5 @@ """Smart importer for Beancount and Fava.""" + from smart_importer.entries import update_postings from smart_importer.hooks import apply_hooks # noqa from smart_importer.predictor import EntryPredictor diff --git a/smart_importer/detector.py b/smart_importer/detector.py index b2e92a8..0fd2ea8 100644 --- a/smart_importer/detector.py +++ b/smart_importer/detector.py @@ -1,4 +1,5 @@ """Duplicate detector hook.""" + import logging from beancount.ingest import similar diff --git a/smart_importer/hooks.py b/smart_importer/hooks.py index f7815f7..b767824 100644 --- a/smart_importer/hooks.py +++ b/smart_importer/hooks.py @@ -1,4 +1,5 @@ """Importer decorators.""" + import logging from functools import wraps diff --git a/smart_importer/pipelines.py b/smart_importer/pipelines.py index a195280..dd928f6 100644 --- a/smart_importer/pipelines.py +++ b/smart_importer/pipelines.py @@ -1,4 +1,5 @@ """Machine learning pipelines for data extraction.""" + import operator from typing import List diff --git a/smart_importer/predictor.py b/smart_importer/predictor.py index c9b4c05..e456a02 100644 --- a/smart_importer/predictor.py +++ b/smart_importer/predictor.py @@ -1,4 +1,5 @@ """Machine learning importer decorators.""" + # pylint: disable=unsubscriptable-object import logging diff --git a/tests/data_test.py b/tests/data_test.py index 8a463ff..5ac26a5 100644 --- a/tests/data_test.py +++ b/tests/data_test.py @@ -1,4 +1,5 @@ """Tests for the `PredictPostings` decorator""" + # pylint: disable=missing-docstring import os import pprint diff --git a/tests/pipelines_test.py b/tests/pipelines_test.py index 43536d9..4d3bc54 100644 --- a/tests/pipelines_test.py +++ b/tests/pipelines_test.py @@ -1,4 +1,5 @@ """Tests for the Machine Learning Helpers.""" + # pylint: disable=missing-docstring from beancount.parser import parser diff --git a/tests/predictors_test.py b/tests/predictors_test.py index c825017..14c82e3 100644 --- a/tests/predictors_test.py +++ b/tests/predictors_test.py @@ -1,4 +1,5 @@ """Tests for the `PredictPayees` and the `PredictPostings` decorator""" + # pylint: disable=missing-docstring from beancount.ingest.importer import ImporterProtocol from beancount.parser import parser