Skip to content

Commit

Permalink
FIX: add --no-dev flag if using --group flag (#460)
Browse files Browse the repository at this point in the history
* DOC: add `--all-extras` flag to `uv sync`
  • Loading branch information
redeboer authored Oct 28, 2024
1 parent 4e7f635 commit cee4849
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd policy
Now it's simply a matter of creating and activating the [virtual environment](https://docs.astral.sh/uv/pip/environments) with [`uv sync`](https://docs.astral.sh/uv/reference/cli/#uv-sync). The dependencies for the project are 'pinned' in each commit through the [`uv.lock` file](https://docs.astral.sh/uv/concepts/projects/#project-lockfile).

```shell
uv sync
uv sync --all-extras
source .venv/bin/activate
```

Expand Down
2 changes: 1 addition & 1 deletion src/compwa_policy/.template/CONTRIBUTING.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd {{ REPO_NAME }}
Now it's simply a matter of creating and activating the [virtual environment](https://docs.astral.sh/uv/pip/environments) with [`uv sync`](https://docs.astral.sh/uv/reference/cli/#uv-sync). The dependencies for the project are 'pinned' in each commit through the [`uv.lock` file](https://docs.astral.sh/uv/concepts/projects/#project-lockfile).

```shell
uv sync
uv sync --all-extras
source .venv/bin/activate
```

Expand Down
2 changes: 2 additions & 0 deletions src/compwa_policy/check_dev_files/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __get_post_builder_for_pixi_with_uv() -> str:
for groups in __get_notebook_groups():
expected_content += f"\n --group {groups} \\"
expected_content += dedent(R"""
--no-dev \
> requirements.txt
uv pip install \
--requirement requirements.txt \
Expand Down Expand Up @@ -127,6 +128,7 @@ def __get_post_builder_for_uv() -> str:
for group in __get_notebook_groups():
expected_content += f"\n --group {group} \\"
expected_content += dedent(R"""
--no-dev \
> requirements.txt
uv pip install \
--requirement requirements.txt \
Expand Down
14 changes: 11 additions & 3 deletions src/compwa_policy/check_dev_files/readthedocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def _update_build_step_for_pixi(config: ReadTheDocs) -> None:
uv run \
--group doc \
--locked \
--no-dev \
--with tox \
tox -e doc
mkdir -p $READTHEDOCS_OUTPUT
Expand All @@ -196,12 +197,19 @@ def _update_build_step_for_uv(config: ReadTheDocs) -> None:
new_command = "export UV_LINK_MODE=copy"
if "uv.lock" in set(git_ls_files(untracked=True)):
new_command += dedent(R"""
uv run --group doc --locked --with tox \
uv run \
--group doc \
--locked \
--no-dev \
--with tox \
tox -e doc
""")
else:
new_command += dedent(R"""
uv run --group doc --with tox \
uv run \
--group doc \
--no-dev \
--with tox \
tox -e doc
""")
new_command += dedent(R"""
Expand Down Expand Up @@ -271,7 +279,7 @@ def __get_install_steps(
pip_install = "python -m uv pip install"
constraints_file = get_constraints_file(python_version)
if package_manager == "uv":
install_statement = "python -m uv sync --group=doc"
install_statement = "python -m uv sync --group=doc --no-dev"
elif constraints_file is None:
install_statement = f"{pip_install} -e .[doc]"
else:
Expand Down

0 comments on commit cee4849

Please sign in to comment.