Skip to content

Commit

Permalink
Update CI and docs for new CCD build process
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed Dec 20, 2024
1 parent 756d2a0 commit 7e92135
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,20 @@ You can also install *Biotite* from the
`project repository <https://github.com/biotite-dev/biotite>`_.
However, in addition to building and installing the package, the internal
`Chemical Component Dictionary (CCD) <https://www.wwpdb.org/data/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:

.. code-block:: console
$ 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.
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -109,7 +109,6 @@ exclude = [
"benchmarks",
"doc",
"environment.yml",
"setup_ccd.py",
# .github, .gitignore, .gitattributes
".git*",
]
Expand Down
4 changes: 1 addition & 3 deletions src/biotite/setup_ccd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
4 changes: 2 additions & 2 deletions src/biotite/structure/info/ccd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'."
)


Expand All @@ -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
-----
Expand Down

0 comments on commit 7e92135

Please sign in to comment.