diff --git a/.github/workflows/submodule_sync.yml b/.github/workflows/submodule_sync.yml new file mode 100755 index 0000000..f14dcb8 --- /dev/null +++ b/.github/workflows/submodule_sync.yml @@ -0,0 +1,54 @@ +name: submodules-sync + +on: + push: + branches: ['**'] + tags: ['v*.*.*'] + pull_request: + branches: ['**'] + release: + types: [published] + workflow_dispatch: + +jobs: + sync: + name: 'Submodules Sync' + runs-on: ubuntu-22.04 + if: github.actor != 'github-actions[bot]' + + defaults: + run: + shell: bash + + steps: + - name: Checkout repository with submodules + uses: actions/checkout@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + submodules: recursive + persist-credentials: false + + - name: Sync submodule URLs + run: | + git submodule sync --recursive + + - name: Update submodules + run: | + git -c protocol.version=2 submodule update --init --remote --recursive --jobs 8 + + - name: Commit and push submodule updates + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }} + # Stage only submodule pointer updates and .gitmodules + git add .gitmodules $(git config -f .gitmodules --get-regexp path | awk '{print $2}') || true + if git diff --cached --quiet; then + echo "No submodule pointer changes to commit" + exit 0 + fi + git commit -m "chore(submodules): auto-update pointers [skip ci]" + git push diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..85a4d34 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ + +[submodule "notebooks/demo_working_with_cogstack"] + path = notebooks/demo_working_with_cogstack + url = https://github.com/CogStack/working_with_cogstack.git + branch = main + ignore = all diff --git a/Dockerfile_singleuser b/Dockerfile_singleuser index 84474fd..7908ff5 100644 --- a/Dockerfile_singleuser +++ b/Dockerfile_singleuser @@ -7,9 +7,6 @@ ARG http_proxy ARG https_proxy ARG no_proxy -# NOTE: set to ES8 or Elasticsearch 8 or OS for Opensearch -ARG COGSTACK_BACKEND=ES9 - # set to "true" for the GPU build ARG GPU_BUILD=false @@ -215,20 +212,16 @@ RUN uv pip install --upgrade --system pip setuptools wheel # install the rest of the packages including medcat COPY ./requirements.txt /srv/jupyterhub/ +# install requirements for working with cogstack scripts +COPY notebooks/demo_working_with_cogstack/requirements.txt /srv/jupyterhub/working_with_cogstack_requirements.txt RUN if [ "$GPU_BUILD" = "true" ] && [ "$CPU_ARCHITECTURE" = "amd64" ]; then \ uv pip install --system --no-cache-dir -r /srv/jupyterhub/requirements.txt && \ - # NOTE: it'll create the medcat-scripts folder within - uv run python -m medcat download-scripts /srv/jupyterhub/ && \ - uv pip install --system --no-cache-dir -r /srv/jupyterhub/medcat-scripts/requirements.txt ; \ + uv pip install --system --no-cache-dir -r /srv/jupyterhub/working_with_cogstack_requirements.txt ; \ else \ uv pip install --system --no-cache-dir -r /srv/jupyterhub/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu/ && \ - uv run python -m medcat download-scripts /srv/jupyterhub/ && \ - uv pip install --system --no-cache-dir -r /srv/jupyterhub/medcat-scripts/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu/ ; \ - fi && \ - # install cogstack-es (Cogstack class) - uv pip install "cogstack-es[$COGSTACK_BACKEND]" && \ - mv /srv/jupyterhub/medcat-scripts/notebooks/* /home/jovyan/work/. # move notebooks + uv pip install --system --no-cache-dir -r /srv/jupyterhub/working_with_cogstack_requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu/ ; \ + fi ####################################################################################################### diff --git a/requirements.txt b/requirements.txt index 1f146fd..9a9f5bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ wheel==0.45.1 -medcat==2.2.0 -# TODO: cogstack-es virtualenv==20.31.2 ipywidgets==8.1.7 requests>=2.32.2