Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions documentation/qml-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ Instructs the build process to use the latest development (unreleased) versions
qml build --dev demo_name
```

##### `--venv`

Specify a new or existing virtual environment to use for installing the demo dependencies. If omitted, the defaul virtual environment name of `.venv-build` will be used.

```bash
qml build --venv .my_env
```


## Viewing Build Outputs

Expand Down
4 changes: 3 additions & 1 deletion lib/qml/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def build(
bool, typer.Option(help="Continue if sphinx-build fails for a demo")
] = False,
dev: Annotated[bool, typer.Option(help="Whether to use dev dependencies")] = False,
venv: Annotated[Optional[str], typer.Option(help="Name of the virtual environment to install build dependencies")] = None,
) -> None:
"""
Build the named demos.
Expand All @@ -66,7 +67,7 @@ def build(
quiet: Suppress sphinx output if True.
keep_going: Continue building even if some demos fail.
dev: Use development dependencies.

venv: Name of the virtual environment to install build dependencies.
Raises:
typer.Exit: If build process fails.
"""
Expand Down Expand Up @@ -104,6 +105,7 @@ def build(
quiet=quiet,
keep_going=keep_going,
dev=dev,
venv=venv,
)

except Exception as e:
Expand Down
5 changes: 4 additions & 1 deletion lib/qml/lib/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from logging import getLogger
import subprocess
from enum import Enum
from typing import Optional
import functools
import requirements
import json
Expand Down Expand Up @@ -152,6 +153,7 @@ def build(
quiet: bool = False,
keep_going: bool = False,
dev: bool = False,
venv: Optional[str] = None,
) -> None:
"""Build the provided demos using 'sphinx-build', optionally
executing them to generate plots and cell outputs.
Expand All @@ -169,7 +171,8 @@ def build(
done = 0
logger.info("Building %d demos", len(demos))

build_venv = Virtualenv(ctx.build_venv_path)
build_venv = Virtualenv(ctx.repo_root / venv) if venv else Virtualenv(ctx.build_venv_path)
logger.info("Using build environment: %s", build_venv.path)
cmds.pip_install(
build_venv.python,
requirements=ctx.build_requirements_file,
Expand Down
5 changes: 2 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ---------------------------
[project]
name = "qml"
version = "0.0.0"
version = "0.1.0"
description = "Introductions to key concepts in quantum computing, as well as tutorials and implementations from cutting-edge quantum computing research."
readme = "README.md"
license = "Apache-2.0"
Expand Down
Loading