diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 46626c0..0a3cb77 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -1,24 +1,23 @@ name: Publish release on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+' + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+.[0-9]+" jobs: - publish-release: - runs-on: ubuntu-22.04 - env: - VERSION: ${{ github.ref_name }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - cache: "pip" - - run: pip install -e '.[dev]' - - run: python -m build - - name: Publish - run: - twine upload - -u ${{ secrets.PYPI_USERNAME }} - -p ${{ secrets.PYPI_PASSWORD }} - dist/* \ No newline at end of file + publish-release: + runs-on: ubuntu-latest + env: + VERSION: ${{ github.ref_name }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: "pip" + - run: pip install -e '.[dev]' + - run: python -m build + - name: Publish + run: twine upload + -u ${{ secrets.PYPI_USERNAME }} + -p ${{ secrets.PYPI_PASSWORD }} + dist/* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb625bb..2ef7a88 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: jobs: ruff: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -18,7 +18,7 @@ jobs: - run: ruff check . mypy: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -29,7 +29,7 @@ jobs: - run: mypy src examples ruff-format: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -41,7 +41,7 @@ jobs: pytest: # https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/ - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest defaults: run: shell: bash -l {0} @@ -67,7 +67,7 @@ jobs: example-tests: # https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/ - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest defaults: run: shell: bash -l {0} @@ -92,7 +92,7 @@ jobs: run: python examples/testable_example.py doctest: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest defaults: run: shell: bash -l {0} diff --git a/.readthedocs.yml b/.readthedocs.yml index d0b255c..da5f4f3 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,19 +1,19 @@ version: 2 build: - os: "ubuntu-22.04" - tools: - python: "mambaforge-latest" + os: "ubuntu-lts-latest" + tools: + python: "mambaforge-latest" sphinx: - configuration: "docs/source/conf.py" + configuration: "docs/source/conf.py" conda: - environment: "docs/environment.yml" + environment: "docs/environment.yml" python: - install: - - method: pip - path: . - extra_requirements: - - dev + install: + - method: pip + path: . + extra_requirements: + - dev diff --git a/README.rst b/README.rst index 2676908..e865339 100644 --- a/README.rst +++ b/README.rst @@ -32,10 +32,6 @@ Some optional dependencies are only available through conda: .. code-block:: bash - # for OpenMM and espaloma charge - # note the temporary issue with rdkit versions and conda will overwrite pip - # installed software - mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge # for xtb mamba install xtb # for openbabel @@ -43,6 +39,27 @@ Some optional dependencies are only available through conda: # for mdanalysis mamba install mdanalysis +With OpenMM +----------- + +To get ``stko`` and use ``OpenMM``, we had some installation issues. The +current solution is to first, in a new environment, install the ``OpenMM`` +requirements: + +.. code-block:: bash + + # for OpenMM and espaloma charge + # note the temporary issue with rdkit versions and conda will overwrite pip + # installed software + mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge + +Then install ``stko`` with pip: + +.. code-block:: bash + + pip install stko + + Developer Setup --------------- diff --git a/docs/source/index.rst b/docs/source/index.rst index d4539a0..c6a5a1a 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -43,10 +43,6 @@ Some optional dependencies are only available through conda: .. code-block:: bash - # for OpenMM and espaloma charge - # note the temporary issue with rdkit versions and conda will overwrite pip - # installed software - mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge # for xtb mamba install xtb # for openbabel @@ -54,6 +50,26 @@ Some optional dependencies are only available through conda: # for mdanalysis mamba install mdanalysis +With OpenMM +----------- + +To get :mod:`.stko` and use ``OpenMM``, we had some installation issues. The +current solution is to first, in a new environment, install the ``OpenMM`` +requirements: + +.. code-block:: bash + + # for OpenMM and espaloma charge + # note the temporary issue with rdkit versions and conda will overwrite pip + # installed software + mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge + +Then install :mod:`.stko` with pip: + +.. code-block:: bash + + pip install stko + Developer Setup --------------- diff --git a/examples/cage_analysis_example.py b/examples/cage_analysis_example.py index 8ce9d67..c7574d3 100644 --- a/examples/cage_analysis_example.py +++ b/examples/cage_analysis_example.py @@ -7,10 +7,12 @@ import stko +logger = logging.getLogger(__name__) + def main() -> None: """Run the example.""" - logging.warning( + logger.warning( "This code is only present in the latest versions of stko that " "require Python 3.11!" ) diff --git a/examples/cage_openmm_example.py b/examples/cage_openmm_example.py index 3ed0ef0..1f74553 100644 --- a/examples/cage_openmm_example.py +++ b/examples/cage_openmm_example.py @@ -10,6 +10,8 @@ import stko +logger = logging.getLogger(__name__) + def integrator( *, @@ -118,14 +120,14 @@ def main() -> None: ), ), ) - logging.info("starting calculations...") + logger.info("starting calculations...") st = time.time() optimised_cage = optimisation_sequence.optimize(cage) et = time.time() - logging.info("calculations done!") + logger.info("calculations done!") optimised_cage.write(output_directory / "opt_cage.mol") - logging.info( + logger.info( "cage energy: %s kJmol-1 in %s s", stko.OpenMMEnergy( force_field=ForceField("openff_unconstrained-2.1.0.offxml"), diff --git a/examples/intermediates_example.py b/examples/intermediates_example.py index 97dc37d..ca80198 100644 --- a/examples/intermediates_example.py +++ b/examples/intermediates_example.py @@ -5,6 +5,8 @@ import stko +logger = logging.getLogger(__name__) + def main() -> None: """Run the example.""" @@ -23,16 +25,14 @@ def main() -> None: cage_graphs = stko.topology_functions.UnreactedTopologyGraph( stk.cage.FourPlusSix((bb1, bb2)) ) - logging.info( + logger.info( "there are %s possible reactions", len(cage_graphs.get_available_reactions()), ) # With up to N reactions performed. intermediate_pool = cage_graphs.get_named_intermediates(n=4) - logging.info( - "there are %s structures with n=%s", len(intermediate_pool), 4 - ) + logger.info("there are %s structures with n=%s", len(intermediate_pool), 4) for named_intermediate in intermediate_pool.intermediates: named_intermediate.molecule.write( examples_output / f"{named_intermediate.intermediate_name}.mol" @@ -41,7 +41,7 @@ def main() -> None: # Now iterate over all possible reactions with varying amounts of # completeness and get their smiles. all_possible_smiles = cage_graphs.get_reacted_smiles() - logging.info("there are %s unique smiles", len(all_possible_smiles)) + logger.info("there are %s unique smiles", len(all_possible_smiles)) if __name__ == "__main__": diff --git a/examples/openmm_hg_example.py b/examples/openmm_hg_example.py index e6a8081..b90af6e 100644 --- a/examples/openmm_hg_example.py +++ b/examples/openmm_hg_example.py @@ -10,6 +10,8 @@ import stko +logger = logging.getLogger(__name__) + def integrator( *, @@ -116,14 +118,14 @@ def main() -> None: ), ), ) - logging.info("starting calculations...") + logger.info("starting calculations...") st = time.time() optimised_complex = optimisation_sequence.optimize(hg_complex) et = time.time() - logging.info("calculations done!") + logger.info("calculations done!") optimised_complex.write(output / "opt_complex.mol") - logging.info( + logger.info( "hgcomplex energy: %s kJmol-1 in %s s", stko.OpenMMEnergy( force_field=ForceField("openff_unconstrained-2.1.0.offxml"), diff --git a/examples/optwrite_example.py b/examples/optwrite_example.py index cd4ce99..45ce3d4 100644 --- a/examples/optwrite_example.py +++ b/examples/optwrite_example.py @@ -7,6 +7,8 @@ import stko +logger = logging.getLogger(__name__) + def main() -> None: """Run the example.""" diff --git a/examples/testable_example.py b/examples/testable_example.py index 774d9ac..0e06e33 100644 --- a/examples/testable_example.py +++ b/examples/testable_example.py @@ -20,6 +20,8 @@ from stko import WrapperNotInstalledError +logger = logging.getLogger(__name__) + def main() -> None: """Run the example.""" @@ -43,7 +45,7 @@ def main() -> None: torsion_example.main() zmatrix_example.main() optwrite_example.main() - logging.info("all examples ran, at least!") + logger.info("all examples ran, at least!") finally: os.chdir(init_dir) diff --git a/pyproject.toml b/pyproject.toml index 3f25464..db50d7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ maintainers = [ { name = "Lukas Turcani", email = "lukasturcani93@gmail.com" }, ] dependencies = [ - "numpy", + "numpy<2", # Pinned while rdkit changes stk results. "rdkit == 2024.3.4", "stk", diff --git a/src/stko/_internal/optimizers/xtb.py b/src/stko/_internal/optimizers/xtb.py index b881aa0..e695108 100644 --- a/src/stko/_internal/optimizers/xtb.py +++ b/src/stko/_internal/optimizers/xtb.py @@ -437,7 +437,7 @@ def _run_optimizations( # case, exit optimization loop and warn. self.incomplete.add(mol) msg = f"Small negative frequencies present in {mol}." - logging.warning(msg) + logger.warning(msg) return mol, opt_complete else: # Optimization is complete. @@ -482,7 +482,7 @@ def optimize(self, mol: MoleculeT) -> MoleculeT: if not complete: self.incomplete.add(mol) msg = f"Optimization is incomplete for {mol}." - logging.warning(msg) + logger.warning(msg) return mol @@ -881,7 +881,7 @@ def optimize(self, mol: MoleculeT) -> MoleculeT: if not complete: msg = f"CREST run is incomplete for {mol}." - logging.warning(msg) + logger.warning(msg) return mol @@ -1122,7 +1122,7 @@ def optimize(self, mol: MoleculeT) -> MoleculeT: if not complete: msg = f"Optimization is incomplete for {mol}." - logging.warning(msg) + logger.warning(msg) return mol @@ -1473,6 +1473,6 @@ def optimize(self, mol: MoleculeT) -> MoleculeT: if not complete: msg = f"CREST run is incomplete for {mol}." - logging.warning(msg) + logger.warning(msg) return mol