From 55a796c9d8fe962c44d3912487017d3973af9052 Mon Sep 17 00:00:00 2001 From: "Michael E. Rose" Date: Sun, 18 Aug 2024 14:36:52 +0200 Subject: [PATCH] Combine workflow and pyproject.toml --- .github/workflows/test-and-build-docs.yml | 25 ++++++++++++----------- docs/conf.py | 4 +++- docs/doc_requirements.txt | 3 --- pyproject.toml | 11 ++++++++++ 4 files changed, 27 insertions(+), 16 deletions(-) delete mode 100644 docs/doc_requirements.txt diff --git a/.github/workflows/test-and-build-docs.yml b/.github/workflows/test-and-build-docs.yml index 26ca4c7..120c6d5 100644 --- a/.github/workflows/test-and-build-docs.yml +++ b/.github/workflows/test-and-build-docs.yml @@ -7,6 +7,7 @@ on: branches: [ master ] jobs: + test: runs-on: ubuntu-latest steps: @@ -18,14 +19,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.8 - - name: Install dependencies + python-version: 3.11 + - name: Install package and dependencies run: | - python --version pip install -U pip - pip install -r requirements.txt # Install project dependencies - pip install pytest pytest-cov # Install pytest and coverage plugin - python setup.py install + pip install .[tests] + - name: Verify pubmed_parser installation + run: | + python -c "import pubmed_parser; print(f'pubmed_parser version: {pubmed_parser.__version__}')" - name: Run tests run: pytest --cov=pubmed_parser tests/ --verbose - name: Upload coverage to Codecov @@ -42,14 +43,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.8 - - name: Install dependencies + python-version: 3.11 + - name: Install package and dependencies run: | - pip install -r docs/doc_requirements.txt - - name: Install project dependencies + pip install -U pip + pip install -e .[docs] + - name: Verify pubmed_parser installation run: | - pip install -r requirements.txt # Install project dependencies - python setup.py install + python -c "import pubmed_parser; print(f'pubmed_parser version: {pubmed_parser.__version__}')" - name: Build documentation run: | cd docs diff --git a/docs/conf.py b/docs/conf.py index 8d12755..23c11bd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,9 +15,11 @@ # sys.path.insert(0, os.path.abspath('.')) import sys import os +sys.path.insert(0, os.path.abspath('..')) + +import pubmed_parser import sphinx import sphinx_gallery -import pubmed_parser # -- Project information ----------------------------------------------------- diff --git a/docs/doc_requirements.txt b/docs/doc_requirements.txt deleted file mode 100644 index 74d8a78..0000000 --- a/docs/doc_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -sphinx_rtd_theme -sphinx -sphinx-gallery \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 1ff4d63..1255e37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,17 @@ dependencies = [ ] dynamic = ["version"] +[project.optional-dependencies] +tests = [ + "pytest", + "pytest-cov" +] +docs = [ + "sphinx", + "sphinx_rtd_theme", + "sphinx-gallery" +] + [project.urls] homepage = "https://github.com/titipata/pubmed_parser" download = "https://github.com/titipata/pubmed_parser.git"