bfflearn 0.1.0.dev1__tar.gz → 0.1.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/PKG-INFO +28 -1
  2. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/README.md +27 -0
  3. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/__init__.py +1 -1
  4. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/cli.py +40 -0
  5. bfflearn-0.1.0.dev2/bff/workflows/examples.py +132 -0
  6. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bfflearn.egg-info/PKG-INFO +28 -1
  7. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bfflearn.egg-info/SOURCES.txt +1 -0
  8. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/pyproject.toml +1 -1
  9. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/LICENSE +0 -0
  10. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/__init__.py +0 -0
  11. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/gaussian_process.py +0 -0
  12. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/kernels.py +0 -0
  13. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/learning.py +0 -0
  14. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/likelihoods.py +0 -0
  15. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/posterior.py +0 -0
  16. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/priors.py +0 -0
  17. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/results.py +0 -0
  18. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/bayes/utils.py +0 -0
  19. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/data.py +0 -0
  20. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/domain/__init__.py +0 -0
  21. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/domain/bias.py +0 -0
  22. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/domain/specs.py +0 -0
  23. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/domain/trainset.py +0 -0
  24. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/__init__.py +0 -0
  25. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/colvars.py +0 -0
  26. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/commands.py +0 -0
  27. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/cp2k.py +0 -0
  28. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/logs.py +0 -0
  29. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/mdp.py +0 -0
  30. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/plumed.py +0 -0
  31. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/progress.py +0 -0
  32. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/schedulers.py +0 -0
  33. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/io/utils.py +0 -0
  34. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/mcmc/__init__.py +0 -0
  35. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/mcmc/convergence.py +0 -0
  36. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/mcmc/proposal.py +0 -0
  37. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/mcmc/sampler.py +0 -0
  38. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/plotting.py +0 -0
  39. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/qoi/__init__.py +0 -0
  40. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/qoi/analysis.py +0 -0
  41. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/qoi/data.py +0 -0
  42. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/qoi/hbonds.py +0 -0
  43. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/qoi/rdf.py +0 -0
  44. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/qoi/routines.py +0 -0
  45. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/tools.py +0 -0
  46. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/topology.py +0 -0
  47. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/__init__.py +0 -0
  48. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/configs.py +0 -0
  49. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/learn.py +0 -0
  50. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/md.py +0 -0
  51. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/prepare.py +0 -0
  52. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/qoi.py +0 -0
  53. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/runsims.py +0 -0
  54. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/simulate.py +0 -0
  55. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/train.py +0 -0
  56. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bff/workflows/validate.py +0 -0
  57. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bfflearn.egg-info/dependency_links.txt +0 -0
  58. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bfflearn.egg-info/entry_points.txt +0 -0
  59. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bfflearn.egg-info/requires.txt +0 -0
  60. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/bfflearn.egg-info/top_level.txt +0 -0
  61. {bfflearn-0.1.0.dev1 → bfflearn-0.1.0.dev2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bfflearn
3
- Version: 0.1.0.dev1
3
+ Version: 0.1.0.dev2
4
4
  Summary: Bayesian workflows for fixed-charge molecular force fields
5
5
  Author-email: Vojtech Kostal <vojtakostal8@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -746,6 +746,12 @@ The public CLI is centered around six workflows:
746
746
  - `bff learn`
747
747
  - `bff validate`
748
748
 
749
+ Examples can be fetched on demand with:
750
+
751
+ ```bash
752
+ bff examples
753
+ ```
754
+
749
755
  Documentation lives under [docs/](docs/) and is intended to be published with
750
756
  MkDocs on GitHub Pages.
751
757
 
@@ -795,6 +801,20 @@ Then install BFF from PyPI:
795
801
  pip install bfflearn
796
802
  ```
797
803
 
804
+ If you want the exact code used for the paper, do not install `v0.0.1`
805
+ directly through a `pip` Git URL. That archived tag predates the packaging
806
+ cleanup. Instead, clone the repository, check out the archived tag, and follow
807
+ the `README.md` and `environment.yaml` shipped with that snapshot:
808
+
809
+ ```bash
810
+ git clone https://github.com/vojtechkostal/BayesicForceFields.git
811
+ cd BayesicForceFields
812
+ git checkout v0.0.1
813
+ ```
814
+
815
+ Use `v0.0.1` for exact reproduction of the published paper data. The current
816
+ `bfflearn` release line is the post-paper refactored workflow.
817
+
798
818
  External tools are still required for full workflows:
799
819
 
800
820
  - [Gromacs](https://www.gromacs.org) for `prepare`, `simulate`, and `validate`
@@ -856,6 +876,13 @@ Two notebooks are included in the example:
856
876
  - [07-visualize/visualize.ipynb](examples/acetate/07-visualize/visualize.ipynb)
857
877
  focuses on plotting and inspection only.
858
878
 
879
+ If you installed BFF from PyPI and want the example tree locally, run:
880
+
881
+ ```bash
882
+ bff examples
883
+ cd examples/acetate
884
+ ```
885
+
859
886
  ## Repository Layout
860
887
 
861
888
  - [bff/](bff/) contains the package code.
@@ -21,6 +21,12 @@ The public CLI is centered around six workflows:
21
21
  - `bff learn`
22
22
  - `bff validate`
23
23
 
24
+ Examples can be fetched on demand with:
25
+
26
+ ```bash
27
+ bff examples
28
+ ```
29
+
24
30
  Documentation lives under [docs/](docs/) and is intended to be published with
25
31
  MkDocs on GitHub Pages.
26
32
 
@@ -70,6 +76,20 @@ Then install BFF from PyPI:
70
76
  pip install bfflearn
71
77
  ```
72
78
 
79
+ If you want the exact code used for the paper, do not install `v0.0.1`
80
+ directly through a `pip` Git URL. That archived tag predates the packaging
81
+ cleanup. Instead, clone the repository, check out the archived tag, and follow
82
+ the `README.md` and `environment.yaml` shipped with that snapshot:
83
+
84
+ ```bash
85
+ git clone https://github.com/vojtechkostal/BayesicForceFields.git
86
+ cd BayesicForceFields
87
+ git checkout v0.0.1
88
+ ```
89
+
90
+ Use `v0.0.1` for exact reproduction of the published paper data. The current
91
+ `bfflearn` release line is the post-paper refactored workflow.
92
+
73
93
  External tools are still required for full workflows:
74
94
 
75
95
  - [Gromacs](https://www.gromacs.org) for `prepare`, `simulate`, and `validate`
@@ -131,6 +151,13 @@ Two notebooks are included in the example:
131
151
  - [07-visualize/visualize.ipynb](examples/acetate/07-visualize/visualize.ipynb)
132
152
  focuses on plotting and inspection only.
133
153
 
154
+ If you installed BFF from PyPI and want the example tree locally, run:
155
+
156
+ ```bash
157
+ bff examples
158
+ cd examples/acetate
159
+ ```
160
+
134
161
  ## Repository Layout
135
162
 
136
163
  - [bff/](bff/) contains the package code.
@@ -2,7 +2,7 @@
2
2
 
3
3
  from importlib import import_module
4
4
 
5
- __version__ = "0.1.0.dev1"
5
+ __version__ = "0.1.0.dev2"
6
6
 
7
7
  __all__ = [
8
8
  "bayes",
@@ -20,6 +20,7 @@ WORKFLOW_COMMANDS = (
20
20
  "train",
21
21
  "learn",
22
22
  "validate",
23
+ "examples",
23
24
  )
24
25
 
25
26
  _COMPLETION_ACTIVATE = f"""# Managed automatically by Bayesic Force Fields.
@@ -172,6 +173,45 @@ def version() -> None:
172
173
  typer.echo(f"BayesicForceFields version: {version_str}")
173
174
 
174
175
 
176
+ @app.command()
177
+ def examples(
178
+ output_dir: Path = typer.Option(
179
+ Path("examples"),
180
+ "--output-dir",
181
+ file_okay=False,
182
+ dir_okay=True,
183
+ writable=True,
184
+ resolve_path=False,
185
+ help="Directory to write the example tree into.",
186
+ ),
187
+ ref: str | None = typer.Option(
188
+ None,
189
+ "--ref",
190
+ help="Git ref to download examples from. Defaults to the installed tag.",
191
+ ),
192
+ force: bool = typer.Option(
193
+ False,
194
+ "--force",
195
+ help="Replace the output directory if it already exists.",
196
+ ),
197
+ ) -> None:
198
+ """
199
+ Download or copy all repository examples.
200
+ """
201
+ from bff.workflows.examples import fetch_examples
202
+
203
+ try:
204
+ examples_dir, source = fetch_examples(output_dir, ref=ref, force=force)
205
+ except FileExistsError as exc:
206
+ raise typer.BadParameter(str(exc), param_hint="output_dir") from exc
207
+ except RuntimeError as exc:
208
+ typer.echo(str(exc), err=True)
209
+ raise typer.Exit(code=1) from exc
210
+
211
+ typer.echo(f"Examples written to: {examples_dir}")
212
+ typer.echo(f"Source: {source}")
213
+
214
+
175
215
  @app.command()
176
216
  def prepare(fn_config: Path = config_argument()) -> None:
177
217
  """
@@ -0,0 +1,132 @@
1
+ """Download or copy example workflows for local use."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import shutil
6
+ import tarfile
7
+ import tempfile
8
+ from importlib import metadata
9
+ from pathlib import Path
10
+ from urllib.error import HTTPError, URLError
11
+ from urllib.request import Request, urlopen
12
+
13
+ from .. import __version__
14
+
15
+ _REPOSITORY = "https://github.com/vojtechkostal/BayesicForceFields"
16
+ _ARCHIVE_API = "https://api.github.com/repos/vojtechkostal/BayesicForceFields/tarball"
17
+
18
+
19
+ def _installed_version() -> str:
20
+ try:
21
+ return metadata.version("bfflearn")
22
+ except metadata.PackageNotFoundError:
23
+ return __version__
24
+
25
+
26
+ def _default_ref() -> str:
27
+ return f"v{_installed_version()}"
28
+
29
+
30
+ def _local_examples_dir() -> Path | None:
31
+ repo_root = Path(__file__).resolve().parents[2]
32
+ examples_dir = repo_root / "examples"
33
+ if examples_dir.is_dir() and (repo_root / ".git").exists():
34
+ return examples_dir
35
+ return None
36
+
37
+
38
+ def _prepare_output_dir(output_dir: Path, *, force: bool) -> None:
39
+ if output_dir.exists():
40
+ if not force:
41
+ raise FileExistsError(
42
+ f"Output directory already exists: {output_dir}. "
43
+ "Use --force to replace it."
44
+ )
45
+ shutil.rmtree(output_dir)
46
+
47
+
48
+ def _copy_local_examples(source_dir: Path, output_dir: Path) -> Path:
49
+ shutil.copytree(source_dir, output_dir)
50
+ return output_dir
51
+
52
+
53
+ def _download_archive(ref: str, archive_path: Path) -> None:
54
+ request = Request(
55
+ f"{_ARCHIVE_API}/{ref}",
56
+ headers={"User-Agent": "bfflearn-example-fetcher"},
57
+ )
58
+ try:
59
+ with urlopen(request) as response, archive_path.open("wb") as out_file:
60
+ shutil.copyfileobj(response, out_file)
61
+ except HTTPError as exc:
62
+ raise RuntimeError(
63
+ f"Could not download examples for ref '{ref}' from {_REPOSITORY}."
64
+ ) from exc
65
+ except URLError as exc:
66
+ raise RuntimeError(
67
+ "Could not reach GitHub to download examples. "
68
+ "Check your internet connection and try again."
69
+ ) from exc
70
+
71
+
72
+ def _extract_examples_archive(archive_path: Path, output_dir: Path) -> Path:
73
+ files_written = 0
74
+ with tarfile.open(archive_path, "r:gz") as archive:
75
+ for member in archive.getmembers():
76
+ parts = Path(member.name).parts
77
+ if len(parts) < 3 or parts[1] != "examples":
78
+ continue
79
+
80
+ relative_path = Path(*parts[2:])
81
+ target_path = output_dir / relative_path
82
+
83
+ if member.isdir():
84
+ target_path.mkdir(parents=True, exist_ok=True)
85
+ continue
86
+
87
+ if not member.isfile():
88
+ continue
89
+
90
+ target_path.parent.mkdir(parents=True, exist_ok=True)
91
+ extracted = archive.extractfile(member)
92
+ if extracted is None:
93
+ continue
94
+ with extracted, target_path.open("wb") as out_file:
95
+ shutil.copyfileobj(extracted, out_file)
96
+ files_written += 1
97
+
98
+ if files_written == 0:
99
+ raise RuntimeError("Downloaded archive did not contain an examples directory.")
100
+
101
+ return output_dir
102
+
103
+
104
+ def fetch_examples(
105
+ output_dir: Path,
106
+ *,
107
+ ref: str | None = None,
108
+ force: bool = False,
109
+ ) -> tuple[Path, str]:
110
+ """
111
+ Fetch all repository examples into ``output_dir``.
112
+
113
+ If running from a source checkout, examples are copied from the local
114
+ repository. Otherwise, the example tree is downloaded from GitHub for the
115
+ requested ref or the installed package version tag.
116
+ """
117
+
118
+ output_dir = output_dir.expanduser().resolve()
119
+ _prepare_output_dir(output_dir, force=force)
120
+
121
+ local_examples = _local_examples_dir()
122
+ if local_examples is not None:
123
+ return _copy_local_examples(local_examples, output_dir), "local checkout"
124
+
125
+ resolved_ref = ref or _default_ref()
126
+ with tempfile.TemporaryDirectory() as tmpdir:
127
+ archive_path = Path(tmpdir) / "examples.tar.gz"
128
+ _download_archive(resolved_ref, archive_path)
129
+ return (
130
+ _extract_examples_archive(archive_path, output_dir),
131
+ f"{_REPOSITORY} @ {resolved_ref}",
132
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bfflearn
3
- Version: 0.1.0.dev1
3
+ Version: 0.1.0.dev2
4
4
  Summary: Bayesian workflows for fixed-charge molecular force fields
5
5
  Author-email: Vojtech Kostal <vojtakostal8@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -746,6 +746,12 @@ The public CLI is centered around six workflows:
746
746
  - `bff learn`
747
747
  - `bff validate`
748
748
 
749
+ Examples can be fetched on demand with:
750
+
751
+ ```bash
752
+ bff examples
753
+ ```
754
+
749
755
  Documentation lives under [docs/](docs/) and is intended to be published with
750
756
  MkDocs on GitHub Pages.
751
757
 
@@ -795,6 +801,20 @@ Then install BFF from PyPI:
795
801
  pip install bfflearn
796
802
  ```
797
803
 
804
+ If you want the exact code used for the paper, do not install `v0.0.1`
805
+ directly through a `pip` Git URL. That archived tag predates the packaging
806
+ cleanup. Instead, clone the repository, check out the archived tag, and follow
807
+ the `README.md` and `environment.yaml` shipped with that snapshot:
808
+
809
+ ```bash
810
+ git clone https://github.com/vojtechkostal/BayesicForceFields.git
811
+ cd BayesicForceFields
812
+ git checkout v0.0.1
813
+ ```
814
+
815
+ Use `v0.0.1` for exact reproduction of the published paper data. The current
816
+ `bfflearn` release line is the post-paper refactored workflow.
817
+
798
818
  External tools are still required for full workflows:
799
819
 
800
820
  - [Gromacs](https://www.gromacs.org) for `prepare`, `simulate`, and `validate`
@@ -856,6 +876,13 @@ Two notebooks are included in the example:
856
876
  - [07-visualize/visualize.ipynb](examples/acetate/07-visualize/visualize.ipynb)
857
877
  focuses on plotting and inspection only.
858
878
 
879
+ If you installed BFF from PyPI and want the example tree locally, run:
880
+
881
+ ```bash
882
+ bff examples
883
+ cd examples/acetate
884
+ ```
885
+
859
886
  ## Repository Layout
860
887
 
861
888
  - [bff/](bff/) contains the package code.
@@ -42,6 +42,7 @@ bff/qoi/rdf.py
42
42
  bff/qoi/routines.py
43
43
  bff/workflows/__init__.py
44
44
  bff/workflows/configs.py
45
+ bff/workflows/examples.py
45
46
  bff/workflows/learn.py
46
47
  bff/workflows/md.py
47
48
  bff/workflows/prepare.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bfflearn"
3
- version = "0.1.0.dev1"
3
+ version = "0.1.0.dev2"
4
4
  description = "Bayesian workflows for fixed-charge molecular force fields"
5
5
  authors = [
6
6
  { name="Vojtech Kostal", email="vojtakostal8@gmail.com" }
File without changes
File without changes
File without changes