Skip to content

Commit

Permalink
Merge branch 'RMeli:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
RMeli authored Apr 6, 2024
2 parents 1cd6871 + a530454 commit 8d532d6
Show file tree
Hide file tree
Showing 41 changed files with 858 additions and 3,106 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand All @@ -24,7 +24,8 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
python -m pip install setuptools
python -m pip install flake8
- name: Install package
run: |
python setup.py develop --no-deps
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand All @@ -24,7 +24,8 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install mypy
python -m pip install setuptools
python -m pip install mypy
- name: Install Types
run: |
python -m pip install types-requests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ jobs:
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
chemlib: [obabel, rdkit]
graphlib: [nx, gt]
graphlib: [nx, gt, rx, all]
exclude:
# graph-tools does not work on Windows
- {os: "windows-latest", graphlib: "gt"}
# FIXME: Keeps failing in CI for unknown reasons during miniconda setup
- {os: "ubuntu-latest", graphlib: "gt", chemlib: "rdkit", python-version: "3.7"}
- {os: "windows-latest", graphlib: "all"}
- {graphlib: "all", chemlib: "obabel"}
include:
- {os: "macOS-14", graphlib: "gt", chemlib: "obabel", python-version: "3.12"}
- {os: "macOS-14", graphlib: "nx", chemlib: "rdkit", python-version: "3.12"}

steps:
- uses: actions/checkout@v3
Expand All @@ -43,20 +46,23 @@ jobs:
df -h
ulimit -a
- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: devtools/conda-envs/spyrmsd-test-${{ matrix.chemlib }}-${{ matrix.graphlib }}.yaml
channels: conda-forge,defaults
miniforge-version: "latest"
activate-environment: spyrmsd
miniforge-variant: Mambaforge
use-mamba: true
auto-update-conda: true
auto-activate-base: false
show-channel-urls: true

- name: Install
run: |
python -m pip install . --no-deps
conda list
mamba info
mamba list
- name: Test
run: |
Expand Down
10 changes: 0 additions & 10 deletions .lgtm.yml

This file was deleted.

1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ repos:
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
Expand Down
10 changes: 7 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# .readthedocs.yml
# Read the Docs configuration file
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"

sphinx:
builder: html
configuration: docs/source/conf.py

formats:
- epub
- pdf
- epub

conda:
environment: devtools/conda-envs/spyrmsd-docs.yaml
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@

------------------------------------------------------------------------------

## Version 0.7.0

Date: 05/04/2024
Contributors: @RMeli, @takluyver, @Jnelen

### Added

* Support for `rustworkx` graph library [PR 111 | @RMeli]
* Functionality to manually select the backend from CLI [PR #108 | @RMeli]
* Functionality to manually select the backend [PR #107 | @Jnelen]
* Python `3.12` to CI [PR #102 | @RMeli]
* macOS M1 (`macoOS-14`) to CI [PR #102 | @RMeli]

### Changed

* Molecular graphs cache to cache by backend [PR #107 | @Jnelen]
* Python build system to use flit_core directly [PR #103 | @takluyver]
* Minimum version of Python to `3.9` (to reduce CI matrix) [PR #102 | @RMeli]

### Fixed

* Failing tests with `pytest=8.0.0` [PR #101 | @RMeli]

### Improved

* Messages for `NotImplementedError` exceptions [PR #90 | @RMeli]

### Removed

* `.gitattributes` and `.lgtm.yaml` stale files
* `versioneer` [PR #91 | @RMeli]

## Version 0.6.0

Date: 08/09/2023
Expand Down
5 changes: 4 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ authors:
- family-names: "Meli"
given-names: "Rocco"
orcid: "https://orcid.org/0000-0002-2845-3410"
- family-names: "Nelen"
given-names: "Jochem"
orcid: "https://orcid.org/0000-0002-9970-4950"
title: "spyrmsd"
version: 0.6.0
version: 0.7.0
doi: 10.5281/zenodo.3631876
date-released: 2021-06-21
url: "https://github.com/RMeli/spyrmsd"
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include LICENSE
include MANIFEST.in
include versioneer.py

graft spyrmsd
global-exclude *.py[cod] __pycache__ *.so
65 changes: 41 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![Documentation Status](https://readthedocs.org/projects/spyrmsd/badge/?version=develop)](https://spyrmsd.readthedocs.io/en/develop/?badge=develop)

[![License](https://img.shields.io/github/license/RMeli/pyrmsd?color=%2333BBFF)](https://opensource.org/licenses/MIT)
[![PyPI](https://img.shields.io/badge/PyPI-v0.6.0%20-ff69b4)](https://pypi.org/project/spyrmsd/)
[![PyPI](https://img.shields.io/badge/PyPI-v0.7.0%20-ff69b4)](https://pypi.org/project/spyrmsd/)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/spyrmsd.svg)](https://anaconda.org/conda-forge/spyrmsd)

[![J. Cheminform.](https://img.shields.io/badge/J.%20Cheminform.-10.1186%2Fs13321--020--00455--2-blue)](https://doi.org/10.1186/s13321-020-00455-2)
Expand Down Expand Up @@ -38,7 +38,7 @@ If you find `spyrmsd` useful, please consider citing the following paper:
`spyrmsd` is available on [PyPI](https://pypi.org/project/spyrmsd/) and [conda-forge](https://github.com/conda-forge/spyrmsd-feedstock) and can be easily installed from source. See [Dependencies](###Dependencies) for a description of all the dependencies.

> [!NOTE]
> `spyrmsd` will install [NetworkX](https://networkx.github.io/) (multi-platform). You can install [graph-tool](https://graph-tool.skewed.de/) on macOS and Linux for higher performance.
> `spyrmsd` will install [NetworkX](https://networkx.github.io/) (multi-platform). You can install the other backends for higher performance.
> [!WARNING]
> If `spyrmsd` is used as a standalone tool, it is required to install either [RDKit](https://rdkit.org/) or [Open Babel](http://openbabel.org/). Neither is automatically installed with `pip` nor `conda`.
Expand Down Expand Up @@ -71,12 +71,16 @@ pip install .

The following packages are required to use `spyrmsd` as a module:

* [graph-tool](https://graph-tool.skewed.de/) or [NetworkX](https://networkx.github.io/)
* [numpy](https://numpy.org/)
* [scipy](https://www.scipy.org/)

One of the following graph libraries is required:
* [graph-tool]
* [NetworkX]
* [rustworkx]

> [!NOTE]
> `spyrmsd` uses [graph-tool](https://graph-tool.skewed.de/) by default but will fall back to [NetworkX](https://networkx.github.io/) if the former is not installed (e.g. on Windows). However, in order to support cross-platform installation [NetworkX](https://networkx.github.io/) is installed by default, and [graph-tool](https://graph-tool.skewed.de/) needs to be installed manually.
> `spyrmsd` uses the following priority when multiple graph libraries are present: [graph-tool], [NetworkX], [rustworkx]. *This order might change. Use `set_backend` to ensure you are always using the same backend, if needed.* However, in order to support cross-platform installation [NetworkX](https://networkx.github.io/) is installed by default, and the other graph library need to be installed manually.
#### Standalone Tool

Expand All @@ -89,27 +93,12 @@ Additionally, one of the following packages is required to use `spyrmsd` as a st

### Standalone Tool

`spyrmsd` provides a convenient CLI tool. See `spyrmsd`'s `--help` for the usage:

```bash
python -m spyrmsd -h
```

```text
usage: python -m spyrmsd [-h] [-m] [-c] [--hydrogens] [-n] reference molecules [molecules ...]
Symmetry-corrected RMSD calculations in Python.
positional arguments:
reference Reference file
molecules Input file(s)
optional arguments:
-h, --help show this help message and exit
-m, --minimize Minimize (fit)
-c, --center Center molecules at origin
--hydrogens Keep hydrogen atoms
-n, --nosymm No graph isomorphism
```

### Module

```python
Expand All @@ -133,7 +122,7 @@ def rmsd(
```

> [!NOTE]
> Atomic properties (`aprops`) can be any Python object when using [NetworkX](https://networkx.github.io/), or integers, floats, or strings when using [graph-tool](https://graph-tool.skewed.de/).
> Atomic properties (`aprops`) can be any Python object when using [NetworkX] and [rustworkx], or integers, floats, or strings when using [graph-tool].
#### Symmetry-Corrected RMSD

Expand All @@ -157,7 +146,31 @@ def symmrmsd(
```

> [!NOTE]
> Atomic properties (`aprops`) can be any Python object when using [NetworkX](https://networkx.github.io/), or integers, floats, or strings when using [graph-tool](https://graph-tool.skewed.de/).
> Atomic properties (`aprops`) can be any Python object when using [NetworkX] and [rustworkx], or integers, floats, or strings when using [graph-tool](https://graph-tool.skewed.de/).
#### Select Backend

`spyrmsd` supports the following graph libraries for the calculation of graph isomorphisms:
* [graph-tool]
* [NetworkX]
* [rustworkx]

You can check which backend is being used with

```python
spyrmsd.get_backend()
```

You can also manually select your preferred backend with

```python
spyrmsd.set_backend("networkx")
# spyrmsd uses NetworkX
spyrmsd.set_backend("graph_tool")
# spyrmsd uses graph_tool
```

The available backends (which depend on the installed dependencies) are stored in `spyrmsd.available_backends`.

## Development

Expand All @@ -172,7 +185,7 @@ Pre-commit `git` hooks can be installed with [pre-commit](https://pre-commit.com

## Copyright

Copyright (c) 2019-2021, Rocco Meli.
Copyright (c) 2019-2024, Rocco Meli.

## References

Expand All @@ -181,3 +194,7 @@ References are tracked with [duecredit](https://github.com/duecredit/duecredit/)
### Acknowledgements

Project based on the [Computational Molecular Science Python Cookiecutter](https://github.com/molssi/cookiecutter-cms) version `1.1`.

[rustworkx]: https://www.rustworkx.org
[NetworkX]: https://networkx.github.io/
[graph-tool]: https://graph-tool.skewed.de/
1 change: 1 addition & 0 deletions devtools/conda-envs/spyrmsd-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
- python
- pip
- ipython
- setuptools

# Jupyter
- jupyterlab
Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/spyrmsd-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ channels:
dependencies:
# Base
- python
- setuptools

# Maths
- numpy
Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/spyrmsd-test-obabel-gt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ channels:
dependencies:
# Base
- python
- setuptools

# Maths
- numpy
Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/spyrmsd-test-obabel-nx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ channels:
dependencies:
# Base
- python
- setuptools

# Maths
- numpy
Expand Down
26 changes: 26 additions & 0 deletions devtools/conda-envs/spyrmsd-test-obabel-rx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: spyrmsd
channels:
- conda-forge
dependencies:
# Base
- python
- setuptools

# Maths
- numpy
- scipy
- rustworkx

# Chemistry
- openbabel

# Testing
- pytest
- pytest-cov
- pytest-benchmark

# Dev
- mypy
- flake8
- black
- codecov
Loading

0 comments on commit 8d532d6

Please sign in to comment.