From eb6bd3609430c58036e01f0a093f9e198ffce2b9 Mon Sep 17 00:00:00 2001 From: Charlotte Kostelic Date: Thu, 4 Apr 2024 11:07:45 -0400 Subject: [PATCH] cleaned up dependencies, typing, changed actions --- .github/workflows/unit-tests.yaml | 30 ++++++------- acc_lcsh_check/checker.py | 4 +- acc_lcsh_check/lcsh.py | 2 +- poetry.lock | 70 +------------------------------ pyproject.toml | 1 - tests/test_checker.py | 2 + 6 files changed, 18 insertions(+), 91 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 0f822a4..5c6a9d8 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -9,31 +9,25 @@ on: jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] steps: - uses: actions/checkout@v4 - - name: Set up Python + + - name: Set up poetry + run: pipx install poetry + + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version}} + python-version: "3.12" + - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r dev-requirements.txt + run: + poetry install + - name: Run tests run: python -m pytest --cov=acc_lcsh_check/ + - name: Send report to Coveralls uses: AndreMiras/coveralls-python-action@develop with: - parallel: true - github-token: ${{ secrets.GITHUB_TOKEN}} - finish: - needs: test - runs-on: ubuntu-latest - steps: - - name: Coveralls Finished - uses: AndreMiras/coveralls-python-action@develop - with: - parallel-finished: true \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/acc_lcsh_check/checker.py b/acc_lcsh_check/checker.py index 38c91e6..9e59279 100644 --- a/acc_lcsh_check/checker.py +++ b/acc_lcsh_check/checker.py @@ -1,11 +1,11 @@ import datetime import csv import os -from rich import print +from typing import Generator from acc_lcsh_check.lcsh import LCTerm -def read_data(file: str): +def read_data(file: str) -> Generator: with open(file, "r") as csvfile: reader = csv.reader(csvfile) for item in reader: diff --git a/acc_lcsh_check/lcsh.py b/acc_lcsh_check/lcsh.py index e709a69..492d17b 100644 --- a/acc_lcsh_check/lcsh.py +++ b/acc_lcsh_check/lcsh.py @@ -3,7 +3,7 @@ class LCTerm: - def __init__(self, id: str, old_heading: str, id_type: str): + def __init__(self, id: str, old_heading: str, id_type: str) -> None: self.id = id self.old_heading = old_heading self.id_type = id_type diff --git a/poetry.lock b/poetry.lock index 39c2931..e5ca63d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -207,41 +207,6 @@ files = [ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] -[[package]] -name = "markdown-it-py" -version = "3.0.0" -description = "Python port of markdown-it. Markdown parsing, done right!" -optional = false -python-versions = ">=3.8" -files = [ - {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, - {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, -] - -[package.dependencies] -mdurl = ">=0.1,<1.0" - -[package.extras] -benchmarking = ["psutil", "pytest", "pytest-benchmark"] -code-style = ["pre-commit (>=3.0,<4.0)"] -compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] -linkify = ["linkify-it-py (>=1,<3)"] -plugins = ["mdit-py-plugins"] -profiling = ["gprof2dot"] -rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] -testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] - -[[package]] -name = "mdurl" -version = "0.1.2" -description = "Markdown URL utilities" -optional = false -python-versions = ">=3.7" -files = [ - {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, - {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, -] - [[package]] name = "packaging" version = "24.0" @@ -268,21 +233,6 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] -[[package]] -name = "pygments" -version = "2.17.2" -description = "Pygments is a syntax highlighting package written in Python." -optional = false -python-versions = ">=3.7" -files = [ - {file = "pygments-2.17.2-py3-none-any.whl", hash = "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c"}, - {file = "pygments-2.17.2.tar.gz", hash = "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"}, -] - -[package.extras] -plugins = ["importlib-metadata"] -windows-terminal = ["colorama (>=0.4.6)"] - [[package]] name = "pytest" version = "8.1.1" @@ -359,24 +309,6 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] -[[package]] -name = "rich" -version = "13.7.1" -description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -optional = false -python-versions = ">=3.7.0" -files = [ - {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"}, - {file = "rich-13.7.1.tar.gz", hash = "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"}, -] - -[package.dependencies] -markdown-it-py = ">=2.2.0" -pygments = ">=2.13.0,<3.0.0" - -[package.extras] -jupyter = ["ipywidgets (>=7.5.1,<9)"] - [[package]] name = "types-requests" version = "2.31.0.20240403" @@ -411,4 +343,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "eebfbc4c0b77b0cc5a9694d76fb6b07d5e0633fdc759e973cc818172d299b6e1" +content-hash = "4c4e6597113a4b6712239f39df735853f57a03e4c60fc5b44dc65682a618be48" diff --git a/pyproject.toml b/pyproject.toml index c94376f..359c6c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ types-requests = "^2.31.0.20240311" pytest = "^8.1.1" pytest-cov = "^5.0.0" pytest-mock = "^3.14.0" -rich = "^13.7.1" [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/tests/test_checker.py b/tests/test_checker.py index 105464f..96f0fa8 100644 --- a/tests/test_checker.py +++ b/tests/test_checker.py @@ -1,5 +1,6 @@ import datetime import pytest +from typing import Generator from acc_lcsh_check.checker import read_data, get_data @@ -9,6 +10,7 @@ def test_read_data(): for term in data: assert term[0].strip('" ') == "Foo" assert term[1].strip('" ') == "sh00000000" + assert isinstance(data, Generator) @pytest.mark.parametrize("heading_type", ["subjects", "names", "demographicTerms"])