Skip to content

Commit

Permalink
Merge branch 'dev' into feature-default-smiles-and-selfies-tokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgondu committed Aug 8, 2024
2 parents db89b28 + e9cf11a commit b9f5843
Show file tree
Hide file tree
Showing 91 changed files with 627 additions and 1,386 deletions.
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ There are several different environments (depending on the black boxes we test).

If you want to run tests in all environments, remove `-e poli-base-py39` and just run `tox`. This might take a while, and several conda envs will be created.

## Bump the version!

Your last commit in your branch should be a bump version.

One of the dev requirements is `bump-my-version`. You should be able to check what the version would be bumped to by running

```bash
bump-my-version show-bump
```

For most cases, you'll be bumping `pre_n` in the `dev` branch. You can bump it with

```bash
bump-my-version bump pre_n
```

This will modify the relevant files: `pyproject.toml` and `src/poli/__init__.py`.

## Create a pull request to dev

Once all tests pass and you are ready to share your changes, create a pull request to the `dev` branch.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| Black box | References | Tests
|----------|----------|----------|
| [Toy continuous functions (e.g. Ackley, Hartmann...)](https://machinelearninglifescience.github.io/poli-docs/using_poli/objective_repository/toy_continuous_problems.html) | [(Al-Roomi 2015)](https://www.al-roomi.org/benchmarks/unconstrained), [(Surjanovic & Bingham 2013)](https://www.sfu.ca/~ssurjano/optimization.html) | [![poli base (dev, conda, python 3.9)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-base.yml/badge.svg)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-base.yml) |
| Ehrlich functions | [(Stanton et al. 2024)](https://arxiv.org/abs/2407.00236) | [![poli base (dev, conda, python 3.9)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-base.yml/badge.svg)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-base.yml)
| [Ehrlich functions](https://machinelearninglifescience.github.io/poli-docs/using_poli/objective_repository/ehrlich_functions.html) | [(Stanton et al. 2024)](https://arxiv.org/abs/2407.00236) | [![poli base (dev, conda, python 3.9)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-base.yml/badge.svg)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-base.yml)
| [PMO/GuacaMol benchmark](https://machinelearninglifescience.github.io/poli-docs/#small-molecules) | [(Brown et al. 2019)](https://arxiv.org/abs/1811.09621), [(Gao et al. 2022)](https://openreview.net/forum?id=yCZRdI0Y7G), [(Huang et al. 2021)](https://openreview.net/pdf?id=8nvgnORnoWr) | [![poli tdc (dev, conda, python 3.9)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-tdc-env.yml/badge.svg)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-tdc-env.yml)
| [Dockstring](https://machinelearninglifescience.github.io/poli-docs/using_poli/objective_repository/dockstring.html) | [(García-Ortegón et al. 2022)](https://pubs.acs.org/doi/full/10.1021/acs.jcim.1c01334) | [![poli dockstring (dev, conda, python 3.9)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-dockstring-env.yml/badge.svg)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-dockstring-env.yml)
| [FoldX stability and SASA](https://machinelearninglifescience.github.io/poli-docs/#proteins) | [(Schymkowitz et al. 2005)](https://academic.oup.com/nar/article/33/suppl_2/W382/2505499?login=true) | - |
Expand Down
49 changes: 46 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "poli"
version = "0.2.1"
version = "1.0.0.dev2"
description = "poli, a library of discrete objective functions"
readme = "README.md"
authors = [{name="Miguel González-Duque", email="[email protected]"}, {name="Simon Bartels"}]
Expand All @@ -28,7 +28,7 @@ dependencies = [
]

[project.optional-dependencies]
dev = ["black", "tox", "pytest"]
dev = ["black", "tox", "pytest", "bump-my-version"]
docs = ["sphinx", "furo"]

[project.urls]
Expand All @@ -50,4 +50,47 @@ markers = [
profile = "black"

[tool.ruff]
exclude = ["src/poli/core/util/proteins/rasp/inner_rasp", "src/poli/objective_repository/gfp_cbas"]
exclude = ["src/poli/core/util/proteins/rasp/inner_rasp", "src/poli/objective_repository/gfp_cbas"]

[tool.bumpversion]
current_version = "1.0.0.dev2"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
(?P<patch>0|[1-9]\\d*)
(?:
. # dash separator for pre-release section
(?P<pre_l>[a-zA-Z-]+) # pre-release label
(?P<pre_n>0|[1-9]\\d*) # pre-release version number
)? # pre-release section is optional
"""
serialize = [
"{major}.{minor}.{patch}.{pre_l}{pre_n}",
"{major}.{minor}.{patch}",
]
search = 'current_version = "{current_version}"'
replace = 'current_version = "{new_version}"'
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = false
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = false
message = "Bump version: {current_version} → {new_version}"
commit_args = ""

[tool.bumpversion.parts.pre_l]
values = ["dev"]

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'

[[tool.bumpversion.files]]
filename = "src/poli/__init__.py"
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ tox
pytest
setuptools
sphinx
furo
furo
bump-my-version
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = poli
version = 0.2.1
author_email = bartels@di.ku.dk
version = "1.0.0.dev0"
author_email = miguel.gonzalez-duque@bio.ku.dk
description = Protein Objectives Library
long_description = file: README.md
long_description_content_type = text/markdown
Expand All @@ -14,7 +14,7 @@ classifiers =
package_dir =
=src
packages = find:
python_requires = >=3.6
python_requires = >=3.8
include_package_data = True

[options.packages.find]
Expand Down
2 changes: 1 addition & 1 deletion src/poli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""poli, a library for discrete black-box objective functions."""

__author__ = "Simon Bartels & Miguel González-Duque (MLLS)"
__version__ = "1.0.0.dev2"
from .core.util.isolation.instancing import instance_function_as_isolated_process

# from .core import get_problems
Expand Down
6 changes: 5 additions & 1 deletion src/poli/core/abstract_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import List, Union

from poli.core.abstract_problem_factory import AbstractProblemFactory
Expand Down Expand Up @@ -46,6 +48,8 @@ def info(self) -> str:
@property
def problem_names(self) -> List[str]:
return [
problem_factory.get_setup_information().name
problem_factory.__module__.replace(
"poli.objective_repository.", ""
).replace(".register", "")
for problem_factory in self.problem_factories
]
5 changes: 2 additions & 3 deletions src/poli/core/abstract_black_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,14 @@ def __init__(

self.batch_size = batch_size

@staticmethod
def get_black_box_info() -> BlackBoxInformation:
def get_black_box_info(self) -> BlackBoxInformation:
raise NotImplementedError(
"Black box information must be implemented in subclasses."
)

@property
def info(self) -> BlackBoxInformation:
return self.__class__.get_black_box_info()
return self.get_black_box_info()

def set_observer(self, observer: AbstractObserver):
"""
Expand Down
30 changes: 4 additions & 26 deletions src/poli/core/abstract_problem_factory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""This module implements the abstract problem factory."""

from poli.core.black_box_information import BlackBoxInformation
from poli.core.problem import Problem


Expand All @@ -11,12 +10,7 @@ class MetaProblemFactory(type):
"""

def __repr__(cls) -> str:
try:
problem_info = cls().get_setup_information()
except NotImplementedError:
return f"<{cls.__name__}()>"

return f"<{cls.__name__}(L={problem_info.max_sequence_length})>"
return f"<{cls.__name__}()>"

def __str__(cls) -> str:
return f"{cls.__name__}"
Expand All @@ -30,28 +24,10 @@ class AbstractProblemFactory(metaclass=MetaProblemFactory):
Methods
-------
get_setup_information:
Returns the setup information for the problem.
create:
Creates a problem instance with the specified parameters.
"""

def get_setup_information(self) -> BlackBoxInformation:
"""
Returns the setup information for the problem.
Returns
--------
problem_info: BlackBoxInformation
Information for the problem (e.g. whether it is discrete, deterministic...).
Raises
-------
NotImplementedError:
This method is abstract and must be implemented by subclasses.
"""
raise NotImplementedError("abstract method")

def create(
self,
seed: int = None,
Expand Down Expand Up @@ -90,4 +66,6 @@ def create(
NotImplementedError: This method is abstract and must be implemented by subclasses.
"""
raise NotImplementedError("abstract method")
raise NotImplementedError(
"Abstract method create() must be implemented by subclasses."
)
2 changes: 1 addition & 1 deletion src/poli/core/chemistry/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- cachetools
- rdkit
- selfies
- pytdc==0.4.7
- pytdc
- pyscreener
- colorama
- configparse
Expand Down
105 changes: 0 additions & 105 deletions src/poli/core/problem_setup_information.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/poli/core/proteins/foldx_black_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from uuid import uuid4

from poli.core.abstract_black_box import AbstractBlackBox
from poli.core.problem_setup_information import ProblemSetupInformation
from poli.core.black_box_information import BlackBoxInformation
from poli.core.util.proteins.foldx import FoldxInterface
from poli.core.util.proteins.pdb_parsing import (
parse_pdb_as_residue_strings,
Expand Down Expand Up @@ -85,7 +85,7 @@ class FoldxBlackBox(AbstractBlackBox):

def __init__(
self,
info: ProblemSetupInformation = None,
info: BlackBoxInformation = None,
batch_size: int = None,
parallelize: bool = False,
num_workers: int = None,
Expand Down
15 changes: 0 additions & 15 deletions src/poli/objective_repository/albuterol_similarity/information.py

This file was deleted.

Loading

0 comments on commit b9f5843

Please sign in to comment.