diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 309e70b..1ac626e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,8 @@ jobs: # only run once if internal PR if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository strategy: - matrix: - include: + matrix: + include: - label: earliest os: ubuntu-latest python-version: 3.8 @@ -32,97 +32,117 @@ jobs: coverage: false - label: baseline os: ubuntu-latest - python-version: 3.9 + python-version: "3.10" rdkit-version: "rdkit~=2022.09" coverage: true - label: latest os: ubuntu-latest - python-version: "3.10" + python-version: "3.12" rdkit-version: "rdkit" coverage: false steps: - - uses: actions/checkout@v4 - - - name: Setup Conda - uses: conda-incubator/setup-miniconda@v2 - with: - python-version: ${{ matrix.python-version }} - auto-update-conda: true - channel-priority: flexible - channels: conda-forge, defaults - add-pip-as-python-dependency: true - architecture: x64 - use-mamba: true - miniforge-variant: Mambaforge - - - name: Check conda and pip - run: | - which python - python --version - pip --version - conda --version - mamba --version - - - name: Install conda dependencies - run: | - mamba install ${{ matrix.rdkit-version }} - mamba list - - - name: Install package through pip - run: | - pip install .[dev] - pip list - - - name: Run tests - run: | - pytest --color=yes --disable-pytest-warnings --cov=prolif --cov-report=xml tests/ - - - name: Measure tests coverage - if: matrix.coverage - uses: codecov/codecov-action@v3 - with: - files: ./coverage.xml - fail_ci_if_error: true - verbose: true - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Build - run: | - python -m build - - - name: Remove previous ProLIF install - run: | - pip uninstall -y prolif - - - name: Install from tar.gz - run: | - pip install dist/prolif-*.tar.gz - - - name: Test tar.gz install - run: | - python < pd.Series: """Replaces a bit value with it's corresponding color value""" interaction = s.name[-1] return s.apply( - lambda v: self.color_mapper[interaction] - if v - else self.color_mapper[None] + lambda v: ( + self.color_mapper[interaction] if v else self.color_mapper[None] + ) ) self.df = df.astype(np.uint8).T.apply(_bit_to_color_value, axis=1) @@ -85,7 +86,8 @@ def from_fingerprint(cls, fp: Fingerprint) -> Barcode: """Creates a barcode object from a fingerprint.""" if not hasattr(fp, "ifp"): raise RunRequiredError( - "Please run the fingerprint analysis before attempting to display results." + "Please run the fingerprint analysis before attempting to display" + " results." ) return cls(fp.to_dataframe()) diff --git a/prolif/plotting/complex3d.py b/prolif/plotting/complex3d.py index a8573cc..26022e4 100644 --- a/prolif/plotting/complex3d.py +++ b/prolif/plotting/complex3d.py @@ -8,6 +8,7 @@ :members: """ + from __future__ import annotations from copy import deepcopy @@ -101,7 +102,8 @@ class Complex3D: PROTEIN_RING_INTERACTIONS: ClassVar[Set[str]] = {*RING_SYSTEMS, "CationPi"} RESIDUE_HOVER_CALLBACK: ClassVar[ str - ] = """function(atom,viewer) { + ] = """ + function(atom,viewer) { if(!atom.label) { atom.label = viewer.addLabel('%s:'+atom.atom+atom.serial, {position: atom, backgroundColor: 'mintcream', fontColor:'black'}); @@ -157,7 +159,8 @@ def from_fingerprint( """ if not hasattr(fp, "ifp"): raise RunRequiredError( - "Please run the fingerprint analysis before attempting to display results." + "Please run the fingerprint analysis before attempting to display" + " results." ) ifp = fp.ifp[frame] return cls(ifp, lig_mol, prot_mol) diff --git a/prolif/plotting/network.py b/prolif/plotting/network.py index 2230693..c9e2e84 100644 --- a/prolif/plotting/network.py +++ b/prolif/plotting/network.py @@ -12,6 +12,7 @@ :members: """ + import json import re import warnings @@ -317,7 +318,8 @@ def from_fingerprint( """ if not hasattr(fp, "ifp"): raise RunRequiredError( - "Please run the fingerprint analysis before attempting to display results." + "Please run the fingerprint analysis before attempting to display" + " results." ) if kind == "frame": df = cls._make_frame_df_from_fp(fp, frame=frame, display_all=display_all) diff --git a/prolif/plotting/residues.py b/prolif/plotting/residues.py index 7ae68b5..ec3545e 100644 --- a/prolif/plotting/residues.py +++ b/prolif/plotting/residues.py @@ -7,6 +7,7 @@ .. autofunction:: display_residues """ + from typing import Any, Optional, Tuple from rdkit import Chem diff --git a/prolif/rdkitmol.py b/prolif/rdkitmol.py index eed076c..5967b92 100644 --- a/prolif/rdkitmol.py +++ b/prolif/rdkitmol.py @@ -2,6 +2,7 @@ Reading RDKit molecules --- :mod:`prolif.rdkitmol` ================================================== """ + from rdkit import Chem from rdkit.Chem.rdMolTransforms import ComputeCentroid diff --git a/prolif/residue.py b/prolif/residue.py index d646446..d92334e 100644 --- a/prolif/residue.py +++ b/prolif/residue.py @@ -2,6 +2,7 @@ Residue-related classes --- :mod:`prolif.residue` ================================================= """ + import re from collections import UserDict from typing import List, Optional @@ -182,8 +183,7 @@ def __getitem__(self, key): # bool is a subclass of int but shouldn't be used here if isinstance(key, bool): raise KeyError( - "Expected a ResidueId, int, or str, " - f"got {type(key).__name__!r} instead" + f"Expected a ResidueId, int, or str, got {type(key).__name__!r} instead" ) if isinstance(key, int): return self._residues[key] @@ -193,7 +193,7 @@ def __getitem__(self, key): elif isinstance(key, ResidueId): return self.data[key] raise KeyError( - "Expected a ResidueId, int, or str, " f"got {type(key).__name__!r} instead" + f"Expected a ResidueId, int, or str, got {type(key).__name__!r} instead" ) def select(self, mask): diff --git a/prolif/utils.py b/prolif/utils.py index c838135..65fa1d9 100644 --- a/prolif/utils.py +++ b/prolif/utils.py @@ -2,6 +2,7 @@ Helper functions --- :mod:`prolif.utils` ======================================== """ + import warnings from collections import defaultdict from contextlib import contextmanager diff --git a/pyproject.toml b/pyproject.toml index be1d8da..fa617e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,8 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Chemistry", ] @@ -76,14 +78,15 @@ Changelog = "https://github.com/chemosim-lab/ProLIF/blob/master/CHANGELOG.md" [tool.setuptools] zip-safe = false -include-package-data = false [tool.setuptools.packages.find] -include = ["prolif*", "tests*"] +include = ["prolif*"] [tool.setuptools.package-data] "prolif.data" = ["*"] "prolif.data.vina" = ["*"] +"tests" = ["*"] +"tests.plotting" = ["*"] [tool.setuptools.dynamic] version = { attr = "prolif._version.__version__" }