diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index f0030c897..690ce2060 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -7,25 +7,44 @@ 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: - cache: 'pip' + 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]' + # This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37 + pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL + 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..ab965c3fa 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 || '*' }} @@ -77,7 +82,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install '.[dev]' + # This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37 + pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL + pip install '.[docs]' - name: Set up Git run: | git config user.name ${{ github.actor }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b605cf632..a4324c6d5 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 @@ -46,9 +51,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 @@ -63,29 +68,32 @@ jobs: - name: Install dependencies run: | - uv venv pip install poetry - source .venv/bin/activate - uv pip install -e '.[dev,setup]' pytest-xdist pip + # This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37 + pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL + 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 # put above 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 # put above if: matrix.python-version == '3.9' - name: Upload coverage data @@ -121,19 +129,23 @@ jobs: - 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]' + # This is fragile, but not critical. Move to uv and index-strategy asap when we drop py37 + pip install pytorch --extra-index-url $PIP_EXTRA_INDEX_URL + pip install '.[docs]' +# uv venv +# uv pip install '.[docs]' + - name: Build documentation run: | - source .venv/bin/activate mkdocs build --clean +# source .venv/bin/activate # put above simple-installation: name: Simple installation @@ -152,11 +164,12 @@ jobs: - 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'",