diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index aef027af..a4588e4a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,7 +14,7 @@ jobs: - '3.9' - '3.10' - '3.11' - - '3.12-dev' + - '3.12' beancount: - '~=2.3.5' - '@git+https://github.com/beancount/beancount.git' diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml new file mode 100644 index 00000000..4be2cb1f --- /dev/null +++ b/.github/workflows/wheels.yaml @@ -0,0 +1,18 @@ +name: build +on: + push: + tags: + - 'v[0-9]*' + +jobs: + wheels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: python -m pip install build twine + - run: python -m build + - run: python -m twine upload dist/* + env: + TWINE_REPOSITORY: testpypi + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI }} diff --git a/.ruff.toml b/.ruff.toml deleted file mode 100644 index 4b253192..00000000 --- a/.ruff.toml +++ /dev/null @@ -1,20 +0,0 @@ -line-length = 128 -target-version = 'py37' - -[lint] -select = ['E', 'F', 'W', 'UP', 'B', 'C4', 'PL', 'RUF'] - -ignore = [ - 'B007', - 'B020', - 'E731', - 'PLR0911', - 'PLR0912', - 'PLR0913', - 'PLR0915', - 'PLR2004', - 'PLW2901', - 'RUF012', - 'UP015', - 'UP032', -] diff --git a/COPYING b/LICENSE similarity index 98% rename from COPYING rename to LICENSE index ac90a0c5..d159169d 100644 --- a/COPYING +++ b/LICENSE @@ -337,11 +337,3 @@ proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. - - - ------------------------------------------------------------ - -Note: -This is a GNU GPL "v2 only" license. -This is not a GNU GPL "v2 or any later version" license. - ---Martin Blais diff --git a/README.md b/README.md deleted file mode 100644 index 6d0557f9..00000000 --- a/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# beangulp: Importers Framework for Beancount - -## Overview - -This is the official repository for the importers framework for Beancount. This -library defines a workflow that helps you build importers for your various -accounts and provides utilities that work with them. It should work with the -latest version of Beancount v2 and v3. - -## Status - -As of February 2021, the project has just been forked out of Beancount. -Expect some changes to be made here. -See this document for plans: -https://docs.google.com/document/d/1O42HgYQBQEna6YpobTqszSgTGnbRX7RdjmzR2xumfjs/edit# - -## History - -This project is the continuation of the LedgerHub project, which was later on -folded within Beancount as `beancount.ingest`. It has now been separated out -again in order to allow other contributors to more easily contribute and to keep -the core of Beancount simpler and leaner. The rationale for this change can be -read here: -http://furius.ca/beancount/doc/v3 - - -## Documentation - -The previous version documentation is available here and must be updated: -http://furius.ca/beancount/doc/ingest - -Much of the rest of the Beancount documentation can be found here: -https://beancount.github.io/docs/ - - -## Copyright and License - -Copyright (C) 2007-2022 Martin Blais. All Rights Reserved. - -This code is distributed under the terms of the "GNU GPLv2 only". -See COPYING file for details. diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..7daba8e2 --- /dev/null +++ b/README.rst @@ -0,0 +1,19 @@ +beangulp: Importers Framework for Beancount +------------------------------------------- + +``beangulp`` provides a framework for importing transactions into a +Beancoount ledger from account statements and other documents and for +managing documents. + +``beangulp`` is compatible with both Beancount 2.3 and the unreleased +Beancount 3.0. ``beangup`` is the evolution of ``beancount.ingest`` in +Beancount 2.3 and replaces it in the upcoming Beancount 3.0 release. + +Documentation is available in form of code docstrings and +`examples`__. The `documentation`__ for ``beancount.ingest`` provided +a good introduction and is still partially relevant to ``beangulp``. +The rest of the Beancount deocumentation can be found `here`__. + +__ https://github.com/beancount/beangulp/tree/master/examples/ +__ https://beancount.github.io/docs/importing_external_data.html +__ https://beancount.github.io/docs/ diff --git a/beangulp/cache_test.py b/beangulp/cache_test.py index 22c864fc..1defd11a 100644 --- a/beangulp/cache_test.py +++ b/beangulp/cache_test.py @@ -3,7 +3,6 @@ import os import shutil -import sys import tempfile import time import unittest @@ -63,11 +62,6 @@ def test_cache_head_encoding(self): data = b'asciiHeader1,\xf0\x9f\x8d\x8fHeader1,asciiHeader2' # The 15th bytes is in the middle of the unicode character. num_bytes = 15 - if sys.version_info < (3, 7): # noqa: UP036 - # Reading the documentation, a partial read from longer - # mocked file data should work just fine, however, this - # does not seem the case in practice. - data = data[:num_bytes] with mock.patch('builtins.open', mock.mock_open(read_data=data)): string = cache._FileMemo('filepath').head(num_bytes, encoding='utf-8') self.assertEqual(string, 'asciiHeader1,') diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..35b83e3c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,70 @@ +[build-system] +requires = ['setuptools >= 60.0'] +build-backend = 'setuptools.build_meta' + +[project] +name = 'beangulp' +version = '0.1.1' +license = { file = 'LICENSE' } +description = 'Importers Framework for Beancount' +readme = 'README.rst' +authors = [ + { name = 'Martin Blais', email = 'blais@furius.ca' }, + { name = 'Daniele Nicolodi', email = 'daniele@grinta.net' }, +] +maintainers = [ + { name = 'Daniele Nicolodi', email = 'daniele@grinta.net' }, +] +keywords = ['accounting', 'ledger', 'beancount', 'importer', 'import', 'converter', 'conversion'] +classifiers = [ + 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Topic :: Office/Business :: Financial :: Accounting', + 'Topic :: Text Processing :: General', +] +dependencies = [ + 'beancount >=2.3.5', + 'beautifulsoup4', + 'chardet', + 'click >8.0', + 'lxml', + 'python-magic >=0.4.12; sys_platform != "win32"', +] + +[project.urls] +homepage = 'https://github.com/beancount/beangulp' +issues = 'https://github.com/beancount/beangulp/issues' + +[tool.setuptools.packages] +find = {} + +[tool.ruff] +line-length = 128 +target-version = 'py37' +lint.select = ['E', 'F', 'W', 'UP', 'B', 'C4', 'PL', 'RUF'] +lint.ignore = [ + 'B007', + 'B020', + 'E731', + 'PLR0911', + 'PLR0912', + 'PLR0913', + 'PLR0915', + 'PLR2004', + 'PLW2901', + 'RUF012', + 'UP015', + 'UP032', +] + +[tool.pytest.ini_options] +minversion = '6.0' +addopts = ['--doctest-glob=*.rst'] +doctest_optionflags = ['ELLIPSIS', 'NORMALIZE_WHITESPACE'] +testpaths = ['beangulp'] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 50af42ea..00000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -addopts = --doctest-glob=*.rst -doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index aaadc1d3..00000000 --- a/setup.cfg +++ /dev/null @@ -1,35 +0,0 @@ -[metadata] -name = beangulp -version = 0.1.dev0 -description = Importers Framework for Beancount -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/beancount/beangulp -author = Martin Blais -author_email = blais@furius.ca -keywords = accounting ledger beancount importer import converter conversion -license = GPL-2.0 -license_file = COPYING -project_urls = - Bug Tracker = https://github.com/beancount/beangulp/issues -classifiers = - License :: OSI Approved :: GNU General Public License v2 (GPLv2) - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Topic :: Office/Business :: Financial :: Accounting - Topic :: Text Processing :: General - - -[options] -include_package_data = True -packages = find: -install_requires = - beancount >=2.3.5 - beautifulsoup4 - chardet - click >7.0 - lxml - python-magic >=0.4.12; sys_platform != 'win32'