diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..59bb7af --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,10 @@ +branches: feat/add-ci-pipeline + +pipeline: + pytest: + image: ghcr.io/withlogicco/poetry:1.5.1 + commands: + - poetry install + - python --version && poetry --version + - echo "------------- running pytest -------------" + - poetry run pytest diff --git a/README.md b/README.md index b403962..8aa6b5b 100644 --- a/README.md +++ b/README.md @@ -173,12 +173,22 @@ Known issues to be fixed: - [x] if both content and text are empty, do not extract an annotation - [x] Speed? - should be fine, on my machine (old i5 laptop) it takes around 90s for ~1000 documents with ~4000 annotations -- [ ] ensure all cmdline options do what they should +- [x] ensure all cmdline options do what they should +- [ ] annotations carry over color object from fitz, should just be Color object or simple tuple with rgb vals +- [ ] docstrings, docstrings! +- [ ] testing testing testing!! + - [ ] refactor into some better abstractions (e.g. Exporter Protocol -> stdout/markdown implementations; Extractor Protocol -> PDF implementation) features to be implemented: +- [ ] CICD + - [x] static analysis (lint, typecheck etc) on pushes + - [ ] test pipeline on master pushes + - [ ] release pipeline to pypi on tags - [ ] on_add hook to extract annotations as files are added + - needs upstream help, 'on_add' hook, and pass-through of affected documents - [ ] add page number if available + - exists in Annotation, just need to place in output - [ ] show overall amount of extractions at the end - [ ] custom formatting decided by user - [ ] improved default exporters @@ -186,7 +196,14 @@ features to be implemented: - pretty display on stdout (rich?) - csv/tsv to stdout - table fmt stdout? -- [ ] arbitrary color -> name settings not dependent on color name existing +- [ ] allow custom colors -> tag name settings not dependent on color name existing (e.g. {"important": (1.0,0.0,0.0)}) +- [ ] `--overwrite` mode where existing annotations are not dropped but overwritten on same line of note +- [ ] `--force` mode where we simply do not drop anything + +upstream changes: + +- [ ] need a hook for adding a document/file +- [ ] need hooks to actually pass through information on the thing they worked on (i.e. their document) ## Issues diff --git a/pyproject.toml b/pyproject.toml index 8ee3741..4ca3257 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,10 @@ python-magic = "^0.4.27" [tool.poetry.plugins."papis.command"] extract = "papis_extract:main" + +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.0" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/tests/test_annotation.py b/tests/test_annotation.py new file mode 100644 index 0000000..e0c5809 --- /dev/null +++ b/tests/test_annotation.py @@ -0,0 +1,6 @@ +from papis_extract.annotation_data import Annotation + +def test_colorname_exact(): + sut = Annotation("testfile", colors={"stroke": (1.0, 0.0, 0.0)}) + c_name = sut.colorname + assert c_name == "red"