diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb492843..88698867 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.7, 3.8, 3.9, 3.10.x, 3.11] + python-version: [3.8, 3.9, 3.10.x, 3.11, 3.12] os: [ubuntu-latest] steps: @@ -25,8 +25,6 @@ jobs: - name: Install testing dependencies run: | pip install -U wheel pip - pip install -U ".[test]" - - name: Lint with flake8 - run: flake8 + pip install --editable ".[test]" - name: Test with pytest run: pytest diff --git a/MANIFEST.in b/MANIFEST.in index 99bb21c1..67ada4a1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include LICENSE.txt -include README.rst -include requirements.txt -recursive-include src/invoice2data/extract/templates/ *.yml +include README.md +# include requirements.txt +recursive-include src/invoice2data/extract/templates/ *.* diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..cb08dc01 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,105 @@ +[build-system] +requires = ["setuptools >= 61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "invoice2data" +authors = [ + {name = "Manuel Riel"}, +] +description = "Python parser to extract data from pdf invoice" +version = "0.4.6" +readme = "README.md" +requires-python = ">=3.8" +keywords = ["python", "data-mining", "accounting", "invoice", "pdf", "parcing"] +license = {text = "MIT"} +classifiers = [ + "Framework :: Django", + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "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", + "Topic :: Office/Business :: Financial :: Accounting", + "Environment :: Console", + "Intended Audience :: Financial and Insurance Industry", + "Intended Audience :: Developers", + "Topic :: Office/Business :: Financial :: Accounting", + "Topic :: Office/Business :: Financial", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "poppler-utils", + "pyyaml", + "dateparser", +] +# dynamic = ["version"] + +[project.urls] +"Homepage" = "https://github.com/invoice-x/invoice2data" +"Bug Tracker" = "https://github.com/invoice-x/invoice2data/issues" + + +[project.optional-dependencies] +ocr = ["imagemagick", "ghostscript", "tesseract-ocr"] +pdfplumber = ["pdfplumber"] +pdfminer = ["pdfminer.six"] +ocrmypdf = ["ocrmypdf"] +test = ["pytest", "pytest-cov", "flake8", "pdfminer.six", "pdfplumber", "tox", "setuptools"] + +[options.extras_require] +test = ["pytest", "pytest-cov", "flake8", "pdfminer.six", "pdfplumber", "tox"] + +# pyproject.toml +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-vs --cov invoice2data" +testpaths = [ + "tests" +] + +[tool.flake8] +ignore = ["E231", "E241", "E203"] +per-file-ignores = [ + "__init__.py:F401", +] +exclude = [ + "build", "dist", ".git", ".idea", ".cache", ".tox", ".eggs" + ] +max-line-length = 120 +count = true + +[tool.tox] +legacy_tox_ini = """ +[tox] +envlist = py38,py39,py310,py312,flake8 +skip_missing_interpreters = True + +[testenv] +deps = pytest >= 3.0.0, <4 +commands = pytest +extras = test + +[testenv:flake8] +commands=flake8 src tests +extras = test +""" + +[project.entry-points."invoice2data"] +console_scripts = "invoice2data.main:main" + +[tool.setuptools.dynamic] +readme = {file = ["README.md"]} + +[tool.setuptools.packages.find] +where = ["src"] +include = ["invoice2data.extract.templates*"] +namespaces = false + +[tool.setuptools.package-data] +mypkg = ["*.json", "*.yaml", "*.yml"] + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..a48f2aaf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +flake8 +Flake8-pyproject diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b6d66f3d..00000000 --- a/setup.cfg +++ /dev/null @@ -1,72 +0,0 @@ -[metadata] -name = invoice2data -author = Manuel Riel -description = Python parser to extract data from pdf invoice -version = 0.4.5 -url = https://github.com/invoice-x/invoice2data -keywords = - pdf - invoicing -# List of classifiers: https://pypi.org/pypi?%3Aaction=list_classifiers -classifiers = - Development Status :: 5 - Production/Stable - Environment :: MacOS X - Environment :: Console - Environment :: Win32 (MS Windows) - Operating System :: MacOS - Operating System :: POSIX - Operating System :: Unix - Operating System :: Microsoft :: Windows - License :: OSI Approved :: MIT License - 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 - Topic :: Office/Business :: Financial - Topic :: Office/Business :: Financial :: Accounting -long_description = file: README.md -long_description_content_type = text/markdown -license_files = ["LICENSE.txt"] - -[options] -setup_requires = - setuptools_git -install_requires = - pillow - pyyaml - dateparser - -[options.extras_require] -test = pytest; pytest-cov; flake8; pdfminer.six; pdfplumber; tox - -[options.entry_points] -console_scripts = - invoice2data = invoice2data.main:main - -[tool:pytest] -addopts = -vs --cov invoice2data -testpaths = tests -filterwarnings = - ignore::DeprecationWarning - -[coverage:run] -source = src - -[flake8] -ignore = E203 -max-line-length = 120 -exclude = - build,dist,.git,.idea,.cache,.tox,.eggs, - -[tox:tox] -envlist = py36,py37,py38,flake8 -skip_missing_interpreters = True - -[testenv] -commands = pytest -extras = test - -[testenv:flake8] -commands=flake8 src tests -extras = test diff --git a/setup.py b/setup.py index 2603b68e..60684932 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,3 @@ -from setuptools import setup, find_packages +from setuptools import setup -setup( - include_package_data=True, - packages=find_packages('src'), - package_dir={'': 'src'}, - license='MIT License', - package_data={ - 'invoice2data.extract': [ - 'templates/com/*.yml', - 'templates/de/*.yml', - 'templates/es/*.yml', - 'templates/fr/*.yml', - 'templates/nl/*.yml', - 'templates/ch/*.yml'], - }, -) +setup()