From 7e921353c7cb5cd5f5ad7b429749965c618e4dd1 Mon Sep 17 00:00:00 2001 From: Patrick Kunzmann Date: Fri, 20 Dec 2024 10:39:13 +0100 Subject: [PATCH] Update CI and docs for new CCD build process --- .github/workflows/test_and_deploy.yml | 6 +++--- doc/install.rst | 9 ++++----- pyproject.toml | 3 +-- src/biotite/setup_ccd.py | 4 +--- src/biotite/structure/info/ccd.py | 4 ++-- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 85937ceb0..e532d3c70 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -72,14 +72,14 @@ jobs: id: cache-ccd with: path: ./src/biotite/structure/info/components.bcif - key: cache-${{ hashFiles('setup_ccd.py') }}-${{ hashFiles('components.cif.gz') }} + key: cache-${{ hashFiles('src/biotite/setup_ccd.py') }}-${{ hashFiles('components.cif.gz') }} - name: Remove CCD used for hashing run: rm components.cif.gz - name: Build internal CCD if: steps.cache-ccd.outputs.cache-hit != 'true' run: | - pip install . - python setup_ccd.py + pip install -e . + python -m biotite.setup_ccd - name: Install build backend run: pip install build - name: Build distribution diff --git a/doc/install.rst b/doc/install.rst index 8b468e0a5..d314ae05f 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -57,10 +57,10 @@ You can also install *Biotite* from the `project repository `_. However, in addition to building and installing the package, the internal `Chemical Component Dictionary (CCD) `_. for -:mod:`biotite.structure.info` needs to be built with the ``setup_ccd.py`` script. +:mod:`biotite.structure.info` needs to be built with the ``setup_ccd`` module. The script in turn requires *Biotite*. The solution to this chicken-and-egg problem is to first install Biotite without the -CCD, then build the CCD and finally install Biotite again. +CCD and build the CCD afterwards. After cloning the repository, navigate to its top-level directory (the one ``setup.py`` is in) and type the following: @@ -68,10 +68,9 @@ After cloning the repository, navigate to its top-level directory (the one $ pip install . $ python -m biotite.setup_ccd - $ pip install . -The `setup_ccd.py` script can also be used to update the internal CCD to the current -upstream version from the PDB. +``setup_ccd.py`` can also be used to update the internal CCD to the current upstream +version from the PDB. Having the *Biotite* installation always pointing to your repository clone is also possible. diff --git a/pyproject.toml b/pyproject.toml index 2f8f47181..2c6ae641a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # Due to `* import` of BCIF encoding -"setup_ccd.py" = ["F405", "F403"] +"src/biotite/setup_ccd.py" = ["F405", "F403"] # Due to imports after the PATH has been adjusted "doc/conf.py" = ["E402"] # Due to `from .module import *` imports in `__init__.py` modules @@ -109,7 +109,6 @@ exclude = [ "benchmarks", "doc", "environment.yml", - "setup_ccd.py", # .github, .gitignore, .gitattributes ".git*", ] diff --git a/src/biotite/setup_ccd.py b/src/biotite/setup_ccd.py index 162ed7561..0032dfcfb 100644 --- a/src/biotite/setup_ccd.py +++ b/src/biotite/setup_ccd.py @@ -7,9 +7,7 @@ import requests from biotite.structure.io.pdbx import * -OUTPUT_CCD = ( - Path(__file__).parent / "structure" / "info" / "components.bcif" -) +OUTPUT_CCD = Path(__file__).parent / "structure" / "info" / "components.bcif" CCD_URL = "https://files.wwpdb.org/pub/pdb/data/monomers/components.cif.gz" diff --git a/src/biotite/structure/info/ccd.py b/src/biotite/structure/info/ccd.py index adcbc92f0..8c791b554 100644 --- a/src/biotite/structure/info/ccd.py +++ b/src/biotite/structure/info/ccd.py @@ -53,7 +53,7 @@ def get_ccd(): return BinaryCIFFile.read(_CCD_FILE).block except FileNotFoundError: raise RuntimeError( - "Internal CCD not found. Please run 'setup_ccd.py' and reinstall Biotite." + "Internal CCD not found. Please run 'python -m biotite.setup_ccd'." ) @@ -68,7 +68,7 @@ def set_ccd_path(ccd_path): ---------- ccd_path : path-like The path to the custom CCD in BinaryCIF format, prepared with the - ``setup_ccd.py`` script. + ``setup_ccd.py`` module. Notes -----