Skip to content

Commit fdb0323

Browse files
committed
[no ci] docs: only build dev docs, use jax instead of TF
1 parent 5632da3 commit fdb0323

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

.github/workflows/multiversion-docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
- name: Commit changes to docs
5252
run: |
5353
cd ./gh-pages-dev
54+
git rm -rf .
5455
cp -R ../dev/docs/* ./
5556
git config --local user.email ""
5657
git config --local user.name "github-actions"

docsrc/poly.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
root = Git.root(Path(__file__).parent)
3232

3333
#: CodeRegex matching the branches to build docs for
34-
BRANCH_REGEX = r"^(master|dev)$"
35-
# BRANCH_REGEX = r"^(master)$"
34+
# BRANCH_REGEX = r"^(master|dev)$"
35+
BRANCH_REGEX = r"^(dev)$"
3636

3737
#: Regex matching the tags to build docs for
38-
TAG_REGEX = r"^v(1\.1\.6|(?!1\.)[\.0-9]*)$"
39-
# TAG_REGEX = r"^(v1.1.6)$"
38+
# TAG_REGEX = r"^v(1\.1\.6|(?!1\.)[\.0-9]*)$"
39+
TAG_REGEX = r""
4040

4141
#: Output dir relative to project root
4242
OUTPUT_DIR = "_build_polyversion"
@@ -66,8 +66,8 @@
6666
#: Extra dependencies to install for version 2
6767
V2_BACKEND_DEPS = [
6868
"jax",
69-
"torch",
70-
"tensorflow",
69+
# "torch",
70+
# "tensorflow",
7171
]
7272

7373
VENV_DIR_NAME = ".bf_doc_gen_venv"
@@ -170,6 +170,8 @@ def __init__(
170170
# the .git directory, which is not copied for the build.
171171
logger.info("Setting setuptools version 'SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BAYESFLOW=" + name[1:] + "'")
172172
self.env_vars["SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BAYESFLOW"] = name[1:]
173+
else:
174+
self.env_vars["KERAS_BACKEND"] = "jax"
173175

174176
super().__init__(path, name, Path(venv) / name, creator=creator)
175177

@@ -210,6 +212,31 @@ async def __aenter__(self):
210212
raise BuildError from CalledProcessError(cast(int, process.returncode), " ".join(cmd), out, err)
211213
return self
212214

215+
def activate(self, env: dict[str, str]) -> dict[str, str]:
216+
"""
217+
Activate a python venv in a dictionary of environment variables.
218+
219+
.. warning:: This modifies the given dictionary in-place.
220+
221+
Parameters
222+
----------
223+
env : dict[str, str]
224+
The environment variable mapping to update.
225+
226+
Returns
227+
-------
228+
dict[str, str]
229+
The dictionary that was passed with `env`.
230+
231+
"""
232+
env["VIRTUAL_ENV"] = str(self.venv)
233+
env["PATH"] = str(self.venv / "bin") + ":" + env["PATH"]
234+
235+
# add environment variables to environment
236+
for key, value in self.env_vars.items():
237+
env[key] = value
238+
return env
239+
213240

214241
# for some reason, VenvWrapper did not work for me (probably something specific
215242
# to my system, so we use subprocess.call directly to use the system utilities

0 commit comments

Comments
 (0)