Skip to content

Commit 52dba26

Browse files
IAlibaymikemhenry
andauthored
fix packaging (#323)
* Add init files + recursive-includes * Add init to storage * Add CI test for package build * add verbosity to pytest calls Co-authored-by: Mike Henry <[email protected]> * update manifest * try something out * override defined benzene_modifications * limit gufe imports * fix gufe imports * more imports * how about this? * minimum fix * how about pulling all the fixtures directly into openfe? * make package test a cron job * separate out the yaml files --------- Co-authored-by: Mike Henry <[email protected]>
1 parent 3d3a231 commit 52dba26

File tree

10 files changed

+155
-2
lines changed

10 files changed

+155
-2
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- main
99
schedule:
1010
# At 07:00 UTC on Monday and Thursday.
11-
- cron: "0 7 * * 1,4"
11+
- cron: "0 7 * * *"
1212

1313
concurrency:
1414
group: "${{ github.workflow }}-${{ github.ref }}"

.github/workflows/package-tests.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "CI"
2+
on:
3+
schedule:
4+
# At 07:00 UTC on Monday and Thursday.
5+
- cron: "0 7 * * *"
6+
7+
defaults:
8+
run:
9+
shell: bash -l {0}
10+
11+
jobs:
12+
package-tests:
13+
runs-on: ubuntu-latest
14+
name: "package install tests"
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Setup Micromamba
19+
uses: mamba-org/provision-with-micromamba@main
20+
with:
21+
environment-file: environment.yml
22+
environment-name: openfe
23+
extra-specs: python==3.10
24+
25+
- name: "install extra deps"
26+
run: pip install pipx wheel twine readme-renderer
27+
28+
- name: "build sdist"
29+
run: pipx run build --sdist --outdir dist
30+
31+
- name: "check package build"
32+
run: |
33+
dist=$(ls -t1 dist/openfe-*tar.gz | head -n1)
34+
test -n "${dist}" || { echo "no distribution found"; exit 1; }
35+
twine check $dist
36+
37+
- name: "install from source dist"
38+
working-directory: ./dist
39+
run: python -m pip install openfe-*tar.gz
40+
41+
- name: "run tests"
42+
working-directory: ./dist
43+
run: |
44+
pytest -n auto -v --pyargs openfe.tests
45+
pytest -n auto -v --pyargs openfecli.tests

MANIFEST.in

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
recursive-include openfe/tests/data/ *.sdf
2+
recursive-include openfe/tests/data/ *.pdb
3+
recursive-include openfe/tests/data/ *.mol2
4+
recursive-include openfe/tests/data/ *.xml
5+
recursive-include openfe/tests/data/ *.graphml
6+
include openfecli/tests/data/*.json
7+
include openfecli/tests/data/*.tar.gz

openfe/storage/__init__.py

Whitespace-only changes.

openfe/tests/dev/__init__.py

Whitespace-only changes.

openfe/tests/protocols/__init__.py

Whitespace-only changes.

openfe/tests/storage/__init__.py

Whitespace-only changes.

openfe/tests/storage/conftest.py

+102-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,102 @@
1-
from gufe.tests.conftest import *
1+
import pytest
2+
from openff.units import unit
3+
import gufe
4+
from gufe import SolventComponent, ChemicalSystem
5+
from gufe.tests.test_protocol import DummyProtocol
6+
7+
8+
@pytest.fixture
9+
def solv_comp():
10+
yield SolventComponent(positive_ion="K", negative_ion="Cl",
11+
ion_concentration=0.0 * unit.molar)
12+
13+
@pytest.fixture
14+
def solvated_complex(T4_protein_component, benzene_transforms, solv_comp):
15+
return ChemicalSystem(
16+
{"ligand": benzene_transforms['toluene'],
17+
"protein": T4_protein_component, "solvent": solv_comp,}
18+
)
19+
20+
21+
@pytest.fixture
22+
def solvated_ligand(benzene_transforms, solv_comp):
23+
return ChemicalSystem(
24+
{"ligand": benzene_transforms['toluene'],
25+
"solvent": solv_comp,}
26+
)
27+
28+
29+
@pytest.fixture
30+
def absolute_transformation(solvated_ligand, solvated_complex):
31+
return gufe.Transformation(
32+
solvated_ligand,
33+
solvated_complex,
34+
protocol=DummyProtocol(settings=None),
35+
mapping=None,
36+
)
37+
38+
39+
@pytest.fixture
40+
def complex_equilibrium(solvated_complex):
41+
return gufe.NonTransformation(
42+
solvated_complex,
43+
protocol=DummyProtocol(settings=None),
44+
)
45+
46+
47+
@pytest.fixture
48+
def benzene_variants_star_map(benzene_transforms, solv_comp,
49+
T4_protein_component):
50+
variants = ['toluene', 'phenol', 'benzonitrile', 'anisole',
51+
'benzaldehyde', 'styrene']
52+
53+
# define the solvent chemical systems and transformations between
54+
# benzene and the others
55+
solvated_ligands = {}
56+
solvated_ligand_transformations = {}
57+
58+
solvated_ligands['benzene'] = ChemicalSystem(
59+
{"solvent": solv_comp, "ligand": benzene_transforms['benzene'],},
60+
name="benzene-solvent",
61+
)
62+
63+
for ligand in variants:
64+
solvated_ligands[ligand] = ChemicalSystem(
65+
{"solvent": solv_comp, "ligand": benzene_transforms[ligand],},
66+
name=f"{ligand}-solvent"
67+
)
68+
69+
solvated_ligand_transformations[("benzene", ligand)] = gufe.Transformation(
70+
solvated_ligands['benzene'], solvated_ligands[ligand],
71+
protocol=DummyProtocol(settings=None),
72+
mapping=None,
73+
)
74+
75+
# define the complex chemical systems and transformations between
76+
# benzene and the others
77+
solvated_complexes = {}
78+
solvated_complex_transformations = {}
79+
80+
solvated_complexes["benzene"] = gufe.ChemicalSystem(
81+
{"protein": T4_protein_component, "solvent": solv_comp,
82+
"ligand": benzene_transforms['benzene']},
83+
name="benzene-complex",
84+
)
85+
86+
for ligand in variants:
87+
solvated_complexes[ligand] = gufe.ChemicalSystem(
88+
{"protein": T4_protein_component, "solvent": solv_comp,
89+
"ligand": benzene_transforms[ligand]},
90+
name=f"{ligand}-complex",
91+
)
92+
solvated_complex_transformations[("benzene", ligand)] = gufe.Transformation(
93+
solvated_complexes["benzene"],
94+
solvated_complexes[ligand],
95+
protocol=DummyProtocol(settings=None),
96+
mapping=None,
97+
)
98+
99+
return gufe.AlchemicalNetwork(
100+
list(solvated_ligand_transformations.values())
101+
+ list(solvated_complex_transformations.values())
102+
)

openfe/tests/utils/__init__.py

Whitespace-only changes.

openfecli/tests/dev/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)