Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Connectivity Strategy #1

Merged
merged 23 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6588354
Created the ConnectivityStrategy class and added tests
ianmkenney Oct 6, 2024
975211b
Added documentation base
ianmkenney Oct 16, 2024
4620ed6
Implemented ConnectivityStrategySettings and weight penalty
ianmkenney Oct 29, 2024
1e1dbaa
Added more model validation
ianmkenney Oct 30, 2024
58f0cc4
Change property name from num_components to n_protocol_dag_results
ianmkenney Oct 30, 2024
a66cb55
Added normalization to StrategyResult
ianmkenney Oct 30, 2024
a18dd82
Enforce correct settings for each strategy
ianmkenney Nov 5, 2024
6964024
Improved error messages around invalid settings arguments
ianmkenney Nov 13, 2024
9572c38
Connectivity cutoff now applies to unnormalized weights
ianmkenney Nov 13, 2024
9358d20
Merge remote-tracking branch 'origin/main' into feature/connectivity_…
ianmkenney Nov 13, 2024
5f9ff78
Removed debugging print statement
ianmkenney Nov 13, 2024
924256f
Increase testing coverage
ianmkenney Nov 20, 2024
f326568
Test determinism for connectivity strategies
ianmkenney Nov 20, 2024
1c821e6
Add gufe submodule for testing until gufev1.2.0 release
ianmkenney Jan 7, 2025
7d071a8
Merge remote-tracking branch 'origin/feature/docs' into feature/conne…
ianmkenney Jan 7, 2025
85e2b91
Update docs and environment information
ianmkenney Jan 7, 2025
895525e
Extract test fixtures from gufe
ianmkenney Jan 13, 2025
b3a42db
Use isort for import formatting
ianmkenney Jan 13, 2025
dfe01c3
Remove gufe submodule and fix pydantic import
ianmkenney Jan 14, 2025
26a2314
Add tests GitHub action
ianmkenney Jan 14, 2025
6ad9794
Use quotes for python versions in workflow
ianmkenney Jan 14, 2025
d1d38d6
Remove typing.Self for Python 3.10 compatibility
ianmkenney Jan 14, 2025
75e66dc
Add test badge to README
ianmkenney Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[report]
exclude_lines =
@abstractmethod
@abc.abstractmethod
59 changes: 59 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "CI"
on:
# on PR to main
pull_request:
branches:
- main
# on push to main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

jobs:
tests:
runs-on: ${{ matrix.os }}
name: "${{ matrix.os }} python-${{ matrix.python-version }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version:
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v2
with:
environment-name: stratocaster-test
init-shell: bash
cache-environment: true
# Since gufe the single dependency, install it without env file
create-args: >-
python=${{ matrix.python-version }}
gufe

- name: Install stratocaster
# install test dependencies
run: python -m pip install -e ".[test]"

- name: Environment information
run: |
micromamba info
micromamba list

- name: Run tests
run: |
pytest -v src/stratocaster/tests/
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/stratocaster.egg-info/
/stratocaster/__pycache__/
/src/stratocaster/stratocaster.egg-info/
/src/stratocaster/__pycache__/
docs/_build/
Empty file added .gitmodules
Empty file.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# stratocaster

[![CI](https://github.com/OpenFreeEnergy/stratocaster/actions/workflows/tests.yaml/badge.svg)](https://github.com/OpenFreeEnergy/stratocaster/actions/workflows/tests.yaml)

A library for proposing a prioritization of Transformations within AlchemicalNetworks.

## Installation
Expand Down
6 changes: 6 additions & 0 deletions devtools/conda-envs/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: stratocaster-docs
channels:
- conda-forge

dependencies:
- python>=3.12
8 changes: 8 additions & 0 deletions devtools/conda-envs/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: stratocaster-test
channels:
- conda-forge

dependencies:
- python>=3.10

- gufe>=1.2.0
13 changes: 0 additions & 13 deletions devtools/conda-envs/test.yml

This file was deleted.

20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3 changes: 3 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
API Reference
=============

27 changes: 27 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'stratocaster'
copyright = '2024, Ian Kenney'
author = 'Ian Kenney'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'ofe_sphinx_theme'
html_static_path = ['_static']
2 changes: 2 additions & 0 deletions docs/developer_guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Developer Guide
===============
31 changes: 31 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Getting Started
===============

This guide will help you quickly get started using stratocaster.

1. Installation
~~~~~~~~~~~~~~~

For installation instructions, refer to the :ref:`installation page<installation-label>`.

2. Verify the installation
~~~~~~~~~~~~~~~~~~~~~~~~~~

Verify the installation was successful in a Python interpreter

.. code:: python

import statocaster
print(stratocaster.__version__)

3. Quick-start example
~~~~~~~~~~~~~~~~~~~~~~

TODO

Other resources
~~~~~~~~~~~~~~~

- `Source code repository <https://github.com/OpenFreeEnergy/stratocaster>`_
- `GitHub issue tracker <https://github.com/OpenFreeEnergy/stratocaster/issues>`_

17 changes: 17 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
stratocaster
============

The stratocaster library is complimentary to gufe and provides suggestions, via Strategies, for optimally executing Transformation Protocols defined in AlchemicalNetworks.

This library includes a set of Strategy implementations as well as base classes to facilitate the creation of custom Strategy implementations.

.. toctree::
:maxdepth: 2
:caption: Contents:
:hidden:

installation
getting_started
user_guide
developer_guide
api
28 changes: 28 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. _installation-label:

Installation
============

The only requirement for installing statocaster is a working installation of gufe with a version 1.2.0 or higher.
For general use, we recommend installing from the conda-forge channel, which will also install gufe in the process.

conda-forge channel
~~~~~~~~~~~~~~~~~~~

If you use conda, stratocaster can be installed through the conda-forge channel.

.. code::

conda create -n statocaster-env
conda activate stratocaster-env
conda install -c conda-forge stratocaster

Development version
~~~~~~~~~~~~~~~~~~~

If you want to install the latest development version of stratocaster, you can do so using pip, provided that you have a working installation of gufe (version >=1.2.0) in your environment.

.. code::

pip install git+https://github.com/OpenFreeEnergy/stratocaster.git@main

35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
2 changes: 2 additions & 0 deletions docs/user_guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User guide
==========
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ Issues = "https://github.com/OpenFreeEnergy/stratocaster/issues"
[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
]
dev = [
"stratocaster[test]",
"black",
"isort",
]
docs = [
"sphinx",
"ofe-sphinx-theme @ git+https://github.com/OpenFreeEnergy/ofe-sphinx-theme.git@main",
]

[build-system]
Expand All @@ -37,6 +43,9 @@ requires = [
]
build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"

[tool.versioningit]
default-version = "1+unknown"

Expand Down
2 changes: 1 addition & 1 deletion src/stratocaster/base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .strategy import Strategy, StrategyResult
from .models import StrategySettings
from .strategy import Strategy, StrategyResult
5 changes: 2 additions & 3 deletions src/stratocaster/base/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from gufe.settings.models import SettingsBaseModel


# TODO: docstrings
class StrategySettings(SettingsBaseModel):

def __init__(self):
normalize_weights: bool = True
pass
Loading
Loading