mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-07-03 23:49:57 +02:00
commit
fed021090d
18 changed files with 82 additions and 97 deletions
2
.coveragerc
Normal file
2
.coveragerc
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[run]
|
||||||
|
omit = qurator/dinglehopper/tests/*
|
|
@ -7,7 +7,7 @@ indent_size = 4
|
||||||
indent_style = space
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
max_line_length = 90
|
max_line_length = 88
|
||||||
tab_width = 4
|
tab_width = 4
|
||||||
|
|
||||||
[{*.cfg, *.ini, *.html, *.yaml, *.yml}]
|
[{*.cfg, *.ini, *.html, *.yaml, *.yml}]
|
||||||
|
@ -20,3 +20,10 @@ insert_final_newline = false
|
||||||
# trailing spaces in markdown indicate word wrap
|
# trailing spaces in markdown indicate word wrap
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.py]
|
||||||
|
multi_line_output = 3
|
||||||
|
include_trailing_comma = True
|
||||||
|
force_grid_wrap = 0
|
||||||
|
use_parentheses = True
|
||||||
|
ensure_newline_before_comments = True
|
||||||
|
|
35
.gitignore
vendored
35
.gitignore
vendored
|
@ -1,25 +1,26 @@
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
# User-specific stuff
|
# User-specific stuff
|
||||||
.idea/**/workspace.xml
|
.idea
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/**/usage.statistics.xml
|
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/shelf
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
.idea/**/contentModel.xml
|
|
||||||
|
|
||||||
# Sensitive or high-churn files
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
|
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
5
.idea/codeStyles/codeStyleConfig.xml
generated
|
@ -1,5 +0,0 @@
|
||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<state>
|
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
|
||||||
</state>
|
|
||||||
</component>
|
|
11
.idea/dinglehopper.iml
generated
11
.idea/dinglehopper.iml
generated
|
@ -1,11 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="jdk" jdkName="Python 3.7 (dinglehopper-github)" jdkType="Python SDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
<component name="TestRunnerService">
|
|
||||||
<option name="PROJECT_TEST_RUNNER" value="pytest" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
6
.idea/inspectionProfiles/profiles_settings.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (dinglehopper-github)" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/dinglehopper.iml" filepath="$PROJECT_DIR$/.idea/dinglehopper.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,10 +1,37 @@
|
||||||
Testing
|
# Testing
|
||||||
-------
|
|
||||||
Use `pytest` to run the tests in [the tests directory](qurator/dinglehopper/tests):
|
Use `pytest` to run the tests in [the tests directory](qurator/dinglehopper/tests):
|
||||||
~~~
|
```bash
|
||||||
virtualenv -p /usr/bin/python3 venv
|
virtualenv -p /usr/bin/python3 venv
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
pip install pytest
|
pip install -r requirements-dev.txt
|
||||||
pytest
|
pytest
|
||||||
~~~
|
```
|
||||||
|
|
||||||
|
### Test running examples
|
||||||
|
### Only unit tests
|
||||||
|
```bash
|
||||||
|
pytest -m "not integration"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Only integration tests
|
||||||
|
```bash
|
||||||
|
pytest -m integration
|
||||||
|
```
|
||||||
|
|
||||||
|
### All tests
|
||||||
|
```bash
|
||||||
|
pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
### All tests with code coverage
|
||||||
|
```bash
|
||||||
|
pytest --cov=qurator --cov-report=html
|
||||||
|
```
|
||||||
|
|
||||||
|
### Static code analysis
|
||||||
|
```bash
|
||||||
|
pytest -k "not test" --flake8
|
||||||
|
pytest -k "not test" --mypy
|
||||||
|
```
|
||||||
|
|
6
qurator/dinglehopper/.gitignore
vendored
6
qurator/dinglehopper/.gitignore
vendored
|
@ -1,6 +0,0 @@
|
||||||
# User-specific stuff
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/**/usage.statistics.xml
|
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/shelf
|
|
12
qurator/dinglehopper/.idea/dinglehopper.iml
generated
12
qurator/dinglehopper/.idea/dinglehopper.iml
generated
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="jdk" jdkName="Python 3.7 (dinglehopper)" jdkType="Python SDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
<component name="TestRunnerService">
|
|
||||||
<option name="projectConfiguration" value="pytest" />
|
|
||||||
<option name="PROJECT_TEST_RUNNER" value="pytest" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
7
qurator/dinglehopper/.idea/misc.xml
generated
7
qurator/dinglehopper/.idea/misc.xml
generated
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (dinglehopper)" project-jdk-type="Python SDK" />
|
|
||||||
<component name="PyCharmProfessionalAdvertiser">
|
|
||||||
<option name="shown" value="true" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
8
qurator/dinglehopper/.idea/modules.xml
generated
8
qurator/dinglehopper/.idea/modules.xml
generated
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/dinglehopper.iml" filepath="$PROJECT_DIR$/.idea/dinglehopper.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -4,6 +4,7 @@ import json
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
from .util import working_directory
|
from .util import working_directory
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ from ..ocrd_cli import ocrd_dinglehopper
|
||||||
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
|
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.platform == 'win32', reason="only on unix")
|
||||||
def test_ocrd_cli(tmp_path):
|
def test_ocrd_cli(tmp_path):
|
||||||
"""Test OCR-D interface"""
|
"""Test OCR-D interface"""
|
||||||
|
|
||||||
|
|
5
requirements-dev.txt
Normal file
5
requirements-dev.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
pytest
|
||||||
|
pytest-flake8
|
||||||
|
pytest-cov
|
||||||
|
pytest-mypy
|
||||||
|
black
|
12
setup.cfg
12
setup.cfg
|
@ -1,2 +1,12 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 90
|
max-line-length = 88
|
||||||
|
extend-ignore = E203, W503
|
||||||
|
|
||||||
|
[pylint]
|
||||||
|
max-line-length = 88
|
||||||
|
|
||||||
|
[pylint.messages_control]
|
||||||
|
disable = C0330, C0326
|
||||||
|
|
||||||
|
[mypy]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -4,6 +4,9 @@ from setuptools import find_packages, setup
|
||||||
with open("requirements.txt") as fp:
|
with open("requirements.txt") as fp:
|
||||||
install_requires = fp.read()
|
install_requires = fp.read()
|
||||||
|
|
||||||
|
with open('requirements-dev.txt') as fp:
|
||||||
|
tests_require = fp.read()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="dinglehopper",
|
name="dinglehopper",
|
||||||
author="Mike Gerber, The QURATOR SPK Team",
|
author="Mike Gerber, The QURATOR SPK Team",
|
||||||
|
@ -16,6 +19,7 @@ setup(
|
||||||
namespace_packages=["qurator"],
|
namespace_packages=["qurator"],
|
||||||
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
|
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
|
||||||
install_requires=install_requires,
|
install_requires=install_requires,
|
||||||
|
tests_require=tests_require,
|
||||||
package_data={
|
package_data={
|
||||||
"": ["*.json", "templates/*"],
|
"": ["*.json", "templates/*"],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue