From 57d2473586cd3992274fc5ef1faaa04e82e808d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Perceval=20Wajsb=C3=BCrt?= Date: Mon, 7 Oct 2024 23:07:13 +0200 Subject: [PATCH] ci: fix docs --- .github/workflows/documentation.yml | 21 +++++++++-- .github/workflows/release.yml | 11 +++++- .github/workflows/tests.yml | 55 ++++++++++++++++++----------- Makefile | 2 +- contributing.md | 2 +- pyproject.toml | 44 +++++++++++++++++------ 6 files changed, 99 insertions(+), 36 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index f0030c897..b0aa55509 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -7,25 +7,42 @@ on: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + # UV_INDEX_STRATEGY: "unsafe-first-match" + # UV_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" + PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" jobs: Documentation: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@v4 with: + python-version: "3.9" cache: 'pip' + + - run: echo WEEK=$(date +%V) >>$GITHUB_ENV + shell: bash + +# - uses: hynek/setup-cached-uv@v1 +# with: +# cache-suffix: -docs-${{ matrix.python-version }}-${{ env.WEEK }} + - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install '.[dev]' + pip install '.[docs]' +# uv venv +# uv pip install '.[docs]' + - name: Set up Git run: | git config user.name ${{ github.actor }} git config user.email ${{ github.actor }}@users.noreply.github.com + - name: Build documentation run: | git fetch origin gh-pages + source .venv/bin/activate mike delete $BRANCH_NAME mike deploy --push $BRANCH_NAME diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bdcfafb5c..31f0028f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,11 @@ on: release: types: [published] +env: + # UV_INDEX_STRATEGY: "unsafe-first-match" + # UV_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" + PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" + jobs: build_wheels: name: Build wheels on ${{ matrix.os }}/${{ matrix.arch || '*' }} @@ -70,18 +75,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: "3.9" cache: 'pip' + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install '.[dev]' + pip install '.[docs]' + - name: Set up Git run: | git config user.name ${{ github.actor }} git config user.email ${{ github.actor }}@users.noreply.github.com + - name: Build documentation run: | git fetch origin gh-pages diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b605cf632..d0a009382 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,6 +6,11 @@ on: push: branches: [master] +env: + # UV_INDEX_STRATEGY: "unsafe-first-match" + # UV_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" + PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" + jobs: linting: name: Linting @@ -16,7 +21,11 @@ jobs: with: # requites to grab the history of the PR fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + cache: 'pip' + - uses: pre-commit/action@v3.0.0 with: extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} @@ -46,9 +55,9 @@ jobs: - run: echo WEEK=$(date +%V) >>$GITHUB_ENV shell: bash - - uses: hynek/setup-cached-uv@v1 - with: - cache-suffix: -tests-${{ matrix.python-version }}-${{ env.WEEK }} + # - uses: hynek/setup-cached-uv@v1 + # with: + # cache-suffix: -tests-${{ matrix.python-version }}-${{ env.WEEK }} - name: Set up Java uses: actions/setup-java@v2 @@ -60,32 +69,34 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install dependencies run: | - uv venv pip install poetry - source .venv/bin/activate - uv pip install -e '.[dev,setup]' pytest-xdist pip + pip install -e '.[dev,setup]' pytest-xdist pip +# uv venv +# source .venv/bin/activate +# uv pip install -e '.[dev,setup]' pytest-xdist pip - name: Test with Pytest on Python ${{ matrix.python-version }} env: UMLS_API_KEY: ${{ secrets.UMLS_API_KEY }} run: | - source .venv/bin/activate coverage run -m pytest --ignore tests/test_docs.py # -n auto # coverage combine # mv .coverage .coverage.${{ matrix.python-version }} +# source .venv/bin/activate if: matrix.python-version != '3.9' - name: Test with Pytest on Python ${{ matrix.python-version }} env: UMLS_API_KEY: ${{ secrets.UMLS_API_KEY }} run: | - source .venv/bin/activate coverage run -m pytest # -n auto # coverage combine # mv .coverage .coverage.${{ matrix.python-version }} +# source .venv/bin/activate if: matrix.python-version == '3.9' - name: Upload coverage data @@ -116,24 +127,26 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.9" - # cache: 'pip' + cache: 'pip' - run: echo WEEK=$(date +%V) >>$GITHUB_ENV shell: bash - - uses: hynek/setup-cached-uv@v1 - with: - cache-suffix: -docs-${{ matrix.python-version }}-${{ env.WEEK }} + # - uses: hynek/setup-cached-uv@v1 + # with: + # cache-suffix: -docs-${{ matrix.python-version }}-${{ env.WEEK }} - name: Install dependencies run: | - uv venv - uv pip install '.[dev]' + pip install '.[docs]' +# uv venv +# uv pip install '.[docs]' + - name: Build documentation run: | - source .venv/bin/activate mkdocs build --clean +# source .venv/bin/activate simple-installation: name: Simple installation @@ -148,15 +161,17 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - run: echo WEEK=$(date +%V) >>$GITHUB_ENV shell: bash - - uses: hynek/setup-cached-uv@v1 - with: - cache-suffix: -simple-install-${{ matrix.python-version }}-${{ env.WEEK }} + # - uses: hynek/setup-cached-uv@v1 + # with: + # cache-suffix: -simple-install-${{ matrix.python-version }}-${{ env.WEEK }} - name: Install library run: | - uv venv - uv pip install . + pip install . +# uv venv +# uv pip install . diff --git a/Makefile b/Makefile index 11944d17c..b4ceada36 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ install : .venv documentation: .venv . .venv/bin/activate - pip install -e '.[dev]' + pip install -e '.[docs]' mkdocs serve test: .venv diff --git a/contributing.md b/contributing.md index f4e8a8c23..fcb6e4665 100644 --- a/contributing.md +++ b/contributing.md @@ -113,7 +113,7 @@ We use `MkDocs` for EDS-NLP's documentation. You can checkout the changes you ma ```console # Install the requirements -$ pip install -e '.[dev]' +$ pip install -e '.[docs]' ---> 100% color:green Installation successful diff --git a/pyproject.toml b/pyproject.toml index 9574960c4..83e4e85c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ dependencies = [ "pytz", "pysimstring>=1.2.1", "regex", - "spacy>=3.1,<4.0.0,!=3.8.0", + "spacy>=3.1,<3.8", "confit>=0.5.5", "tqdm", "umls-downloader>=0.1.1", @@ -41,13 +41,39 @@ dev = [ "pre-commit>=2.21.0; python_version>='3.8'", "pytest>=7.1.0", "pytest-cov>=3.0.0", - "polars", - # Distributed inference + # Data libs "koalas>=1.8.1; python_version<'3.8'", "pyspark", + "polars", + + # Machine Learning + "rich-logger>=0.3.1", + "torch>=1.13.0", + "foldedtensor>=0.3.2", + "safetensors>=0.3.0", + "transformers>=4.0.0,<5.0.0", + "accelerate>=0.20.3,<1.0.0", + "mlconjug3<3.9.0", + "scikit-learn>=1.0.0", - # Docs + # Docs (same as docs group) + "mike~=1.1.2", + "mkdocs-charts-plugin==0.0.8", + "mkdocs-img2fig-plugin==0.9.3", + "mkdocs-material~=9.2.0", + "mkdocs-section-index==0.3.4", + "mkdocs~=1.5.2", + "mkdocstrings~=0.20", + "mkdocstrings-python~=1.1", + "mkdocs-minify-plugin", + "mkdocs-redirects>=1.2.1;python_version>='3.8'", + "pybtex~=0.24.0", + "pathspec>=0.11.1", # required by vendored mkdocs-autorefs PR + "astunparse", + "griffe<0.39", +] +docs = [ "mike~=1.1.2", "mkdocs-charts-plugin==0.0.8", "mkdocs-img2fig-plugin==0.9.3", @@ -61,17 +87,13 @@ dev = [ "pybtex~=0.24.0", "pathspec>=0.11.1", # required by vendored mkdocs-autorefs PR "astunparse", - "mlconjug3<3.9.0", "griffe<0.39", - # Machine Learning - "rich-logger>=0.3.1", "torch>=1.13.0", "foldedtensor>=0.3.2", - "safetensors>=0.3.0", "transformers>=4.0.0,<5.0.0", - "accelerate>=0.20.3,<1.0.0", - "scikit-learn>=1.0.0", + "safetensors>=0.3.0", + "rich-logger>=0.3.1", ] setup = [ "typer" @@ -274,7 +296,7 @@ where = ["."] requires = [ "setuptools", "cython>=0.25", - "spacy>=3.2,<4.0,!=3.8.0", + "spacy>=3.2,<3.8", # to update from https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg # while setting numpy >= 1.15.0 due to spacy reqs "numpy==1.15.0; python_version=='3.7' and platform_machine not in 'arm64|aarch64|loongarch64' and platform_system!='AIX' and platform_python_implementation != 'PyPy'",