Skip to content

Commit 4ada734

Browse files
committed
--wheel-source -> --wheel-path
1 parent ffe2696 commit 4ada734

8 files changed

Lines changed: 80 additions & 78 deletions

File tree

docs/quickstart.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ Using Pre-built Wheels
7070
----------------------
7171

7272
By default, riot installs your project in editable mode (``pip install -e .``).
73-
If you want to test with pre-built wheels instead, use the ``--wheel-source`` option:
73+
If you want to test with pre-built wheels instead, use the ``--wheel-path`` option:
7474

7575
.. code-block:: bash
7676
7777
$ pip wheel --no-deps -w dist/ .
78-
$ riot --wheel-source dist/ run test
78+
$ riot --wheel-path dist/ run test
7979
8080
See :doc:`wheel_sources` for more details on using pre-built wheels.
8181

docs/wheel_sources.rst

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,47 @@ pre-built wheels instead. This is useful for:
1111
- **Reproducibility**: Testing with exact wheel artifacts
1212

1313

14-
Specifying a Wheel Source
15-
--------------------------
14+
Specifying a Wheel Path
15+
------------------------
1616

17-
There are two ways to specify a wheel source:
17+
There are two ways to specify a wheel path:
1818

1919

2020
Command-line Option
2121
~~~~~~~~~~~~~~~~~~~
2222

23-
Use the global ``--wheel-source`` option before any subcommand:
23+
Use the global ``--wheel-path`` option before any subcommand:
2424

2525
.. code-block:: bash
2626
2727
# With a local directory containing wheels
28-
riot --wheel-source /path/to/wheels run test
28+
riot --wheel-path /path/to/wheels run test
2929
3030
# With a remote URL (e.g., index.html)
31-
riot --wheel-source https://example.com/wheels/ generate
31+
riot --wheel-path https://example.com/wheels/ generate
3232
3333
# Works with all commands
34-
riot --wheel-source /tmp/wheels shell mypy
34+
riot --wheel-path /tmp/wheels shell mypy
3535
3636
3737
Environment Variable
3838
~~~~~~~~~~~~~~~~~~~~
3939

40-
Set the ``RIOT_WHEEL_SOURCE`` environment variable:
40+
Set the ``RIOT_WHEEL_PATH`` environment variable:
4141

4242
.. code-block:: bash
4343
44-
export RIOT_WHEEL_SOURCE=/path/to/wheels
44+
export RIOT_WHEEL_PATH=/path/to/wheels
4545
riot run test
4646
4747
This is particularly useful in CI/CD environments where you want to configure
48-
wheel sources without modifying commands.
48+
wheel paths without modifying commands.
4949

5050

5151
Package Name Resolution
5252
-----------------------
5353

54-
When using wheel sources, riot needs to know the package name to install. It
54+
When using wheel paths, riot needs to know the package name to install. It
5555
determines this automatically by:
5656

5757
1. **Checking the ``RIOT_PACKAGE_NAME`` environment variable** (highest priority)
@@ -72,14 +72,14 @@ For projects not using ``pyproject.toml`` or with custom naming, set the
7272
.. code-block:: bash
7373
7474
export RIOT_PACKAGE_NAME=my-package
75-
export RIOT_WHEEL_SOURCE=/tmp/wheels
75+
export RIOT_WHEEL_PATH=/tmp/wheels
7676
riot run test
7777
7878
7979
How It Works
8080
------------
8181

82-
When a wheel source is specified:
82+
When a wheel path is specified:
8383

8484
1. **Download**: riot downloads the wheel using ``pip download --no-index --find-links``
8585
to ensure only wheels from the specified source are used (not PyPI)
@@ -93,18 +93,18 @@ This ensures reproducibility and prevents accidental use of incorrect package ve
9393
Example: CI/CD Workflow
9494
-----------------------
9595

96-
A typical CI/CD workflow using wheel sources:
96+
A typical CI/CD workflow using wheel paths:
9797

9898
.. code-block:: bash
9999
100100
# Step 1: Build wheels
101101
pip wheel --no-deps -w dist/ .
102102
103103
# Step 2: Run tests with built wheels
104-
riot --wheel-source dist/ run test
104+
riot --wheel-path dist/ run test
105105
106106
# Step 3: Verify wheels work in clean environments
107-
riot --wheel-source dist/ generate --recreate-venvs
107+
riot --wheel-path dist/ generate --recreate-venvs
108108
109109
110110
Example: Testing with Remote Wheels
@@ -115,9 +115,9 @@ Test against wheels published to a remote location:
115115
.. code-block:: bash
116116
117117
# Test against wheels on an S3 bucket or web server
118-
riot --wheel-source https://artifacts.example.com/wheels/v1.2.3/ run test
118+
riot --wheel-path https://artifacts.example.com/wheels/v1.2.3/ run test
119119
120-
The wheel source can be any location supported by pip's ``--find-links`` option,
120+
The wheel path can be any location supported by pip's ``--find-links`` option,
121121
including:
122122

123123
- Local directories (``/path/to/wheels``)
@@ -133,13 +133,13 @@ Wheel sources work with all existing riot options:
133133
.. code-block:: bash
134134
135135
# Recreate environments with wheels
136-
riot --wheel-source /tmp/wheels run --recreate-venvs test
136+
riot --wheel-path /tmp/wheels run --recreate-venvs test
137137
138138
# Skip base install (wheels already installed)
139-
riot --wheel-source /tmp/wheels run --skip-base-install test
139+
riot --wheel-path /tmp/wheels run --skip-base-install test
140140
141141
# Generate base environments with wheels
142-
riot --wheel-source /tmp/wheels generate
142+
riot --wheel-path /tmp/wheels generate
143143
144144
145145
Troubleshooting
@@ -170,7 +170,7 @@ Environment Variables Reference
170170

171171
* - Variable
172172
- Description
173-
* - ``RIOT_WHEEL_SOURCE``
173+
* - ``RIOT_WHEEL_PATH``
174174
- Path or URL to wheel files. When set, installs from wheels instead of editable mode.
175175
* - ``RIOT_PACKAGE_NAME``
176176
- Package name to use when installing from wheels. Overrides automatic detection from ``pyproject.toml``.

releasenotes/notes/wheel-source-support-612999b83b5b0b9b.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
features:
33
- |
44
Add support for installing from pre-built wheels instead of editable mode via the
5-
``--wheel-source`` global option and ``RIOT_WHEEL_SOURCE`` environment variable.
6-
See https://ddriot.readthedocs.io/en/latest/wheel_sources.html for details.
5+
``--wheel-path`` global option and ``RIOT_WHEEL_PATH`` environment variable.
6+
See https://riot.readthedocs.io/en/latest/wheel_sources.html for details.

riot/cli.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ def convert(self, value, param, ctx):
7979
help="Pipe mode. Makes riot emit plain output.",
8080
)
8181
@click.option(
82-
"--wheel-source",
83-
"wheel_source",
82+
"--wheel-path",
83+
"wheel_path",
8484
type=str,
8585
default=None,
86-
envvar="RIOT_WHEEL_SOURCE",
86+
envvar="RIOT_WHEEL_PATH",
8787
help="Path or URL to wheel files. When set, installs from wheels instead of editable mode.",
8888
)
8989
@click.version_option(__version__)
9090
@click.pass_context
91-
def main(ctx, riotfile, log_level, pipe_mode, wheel_source):
91+
def main(ctx, riotfile, log_level, pipe_mode, wheel_path):
9292
if pipe_mode:
9393
if log_level:
9494
logging.basicConfig(level=log_level)
@@ -102,7 +102,7 @@ def main(ctx, riotfile, log_level, pipe_mode, wheel_source):
102102

103103
ctx.ensure_object(dict)
104104
ctx.obj["pipe"] = pipe_mode
105-
ctx.obj["wheel_source"] = wheel_source
105+
ctx.obj["wheel_path"] = wheel_path
106106

107107
# Check if file exists first (before checking for subcommand)
108108
import os
@@ -177,13 +177,13 @@ def list_venvs(ctx, pythons, pattern, venv_pattern, interpreters, hash_only):
177177
@PATTERN_ARG
178178
@click.pass_context
179179
def generate(ctx, recreate_venvs, skip_base_install, pythons, pattern):
180-
wheel_source = ctx.obj.get("wheel_source")
180+
wheel_path = ctx.obj.get("wheel_path")
181181
ctx.obj["session"].generate_base_venvs(
182182
pattern=re.compile(pattern),
183183
recreate=recreate_venvs,
184184
skip_deps=skip_base_install,
185185
pythons=pythons,
186-
wheel_source=wheel_source,
186+
wheel_path=wheel_path,
187187
)
188188

189189

@@ -213,7 +213,7 @@ def run(
213213
venv_pattern,
214214
recompile_reqs,
215215
):
216-
wheel_source = ctx.obj.get("wheel_source")
216+
wheel_path = ctx.obj.get("wheel_path")
217217
ctx.obj["session"].run(
218218
pattern=re.compile(pattern),
219219
venv_pattern=re.compile(venv_pattern),
@@ -225,7 +225,7 @@ def run(
225225
skip_missing=skip_missing,
226226
exit_first=exit_first,
227227
recompile_reqs=recompile_reqs,
228-
wheel_source=wheel_source,
228+
wheel_path=wheel_path,
229229
)
230230

231231

@@ -234,11 +234,11 @@ def run(
234234
@click.option("--pass-env", "pass_env", is_flag=True, default=False)
235235
@click.pass_context
236236
def shell(ctx, ident, pass_env):
237-
wheel_source = ctx.obj.get("wheel_source")
237+
wheel_path = ctx.obj.get("wheel_path")
238238
ctx.obj["session"].shell(
239239
ident=ident,
240240
pass_env=pass_env,
241-
wheel_source=wheel_source,
241+
wheel_path=wheel_path,
242242
)
243243

244244

riot/riot.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ def prepare(
578578
skip_deps: bool = False,
579579
recompile_reqs: bool = False,
580580
child_was_installed: bool = False,
581-
wheel_source: t.Optional[str] = None,
581+
wheel_path: t.Optional[str] = None,
582582
) -> None:
583583
# Propagate the interpreter down the parenting relation
584584
self.py = py = py or self.py
@@ -602,7 +602,7 @@ def prepare(
602602
if self.created:
603603
py.create_venv(recreate, venv_path)
604604
if not self.venv.skip_dev_install or not skip_deps:
605-
install_dev_pkg(venv_path, force=True, wheel_source=wheel_source)
605+
install_dev_pkg(venv_path, force=True, wheel_path=wheel_path)
606606

607607
pkg_str = self.pkg_str
608608
assert pkg_str is not None
@@ -641,7 +641,7 @@ def prepare(
641641
env,
642642
py,
643643
child_was_installed=installed or exists or child_was_installed,
644-
wheel_source=wheel_source,
644+
wheel_path=wheel_path,
645645
)
646646

647647

@@ -724,7 +724,7 @@ def run(
724724
skip_missing: bool = False,
725725
exit_first: bool = False,
726726
recompile_reqs: bool = False,
727-
wheel_source: t.Optional[str] = None,
727+
wheel_path: t.Optional[str] = None,
728728
) -> None:
729729
results = []
730730

@@ -733,7 +733,7 @@ def run(
733733
recreate=recreate_venvs,
734734
skip_deps=skip_base_install,
735735
pythons=pythons,
736-
wheel_source=wheel_source,
736+
wheel_path=wheel_path,
737737
)
738738

739739
for inst in self.venv.instances():
@@ -801,7 +801,7 @@ def run(
801801
skip_deps=skip_base_install or inst.venv.skip_dev_install,
802802
recreate=recreate_venvs,
803803
recompile_reqs=recompile_reqs,
804-
wheel_source=wheel_source,
804+
wheel_path=wheel_path,
805805
)
806806

807807
pythonpath = inst.pythonpath
@@ -967,7 +967,7 @@ def generate_base_venvs(
967967
recreate: bool,
968968
skip_deps: bool,
969969
pythons: t.Optional[t.Set[Interpreter]],
970-
wheel_source: t.Optional[str] = None,
970+
wheel_path: t.Optional[str] = None,
971971
) -> None:
972972
"""Generate all the required base venvs."""
973973
# Find all the python interpreters used.
@@ -1004,7 +1004,7 @@ def generate_base_venvs(
10041004
continue
10051005

10061006
# Install the dev package into the base venv.
1007-
install_dev_pkg(py.venv_path, force=True, wheel_source=wheel_source)
1007+
install_dev_pkg(py.venv_path, force=True, wheel_path=wheel_path)
10081008

10091009
def _generate_shell_rcfile(self):
10101010
with tempfile.NamedTemporaryFile() as rcfile:
@@ -1028,7 +1028,9 @@ def requirements(self, ident):
10281028
with Status("Producing requirements.txt"):
10291029
_ = inst.requirements
10301030

1031-
def shell(self, ident: str, pass_env: bool, wheel_source: t.Optional[str] = None) -> None:
1031+
def shell(
1032+
self, ident: str, pass_env: bool, wheel_path: t.Optional[str] = None
1033+
) -> None:
10321034
for inst, venv_path in self._venvs_matching_identifier(ident):
10331035
logger.info("Launching shell inside venv instance %s", inst)
10341036
logger.debug("Setting venv path to %s", venv_path)
@@ -1043,7 +1045,7 @@ def shell(self, ident: str, pass_env: bool, wheel_source: t.Optional[str] = None
10431045
# Should we expect the venv to be ready?
10441046
with Status("Preparing shell virtual environment"):
10451047
inst.py.create_venv(False)
1046-
inst.prepare(env, wheel_source=wheel_source)
1048+
inst.prepare(env, wheel_path=wheel_path)
10471049

10481050
pythonpath = inst.pythonpath
10491051
if pythonpath:
@@ -1285,7 +1287,7 @@ def get_package_name() -> str:
12851287

12861288

12871289
def install_dev_pkg(
1288-
venv_path: str, force: bool = False, wheel_source: t.Optional[str] = None
1290+
venv_path: str, force: bool = False, wheel_path: t.Optional[str] = None
12891291
) -> None:
12901292
dev_pkg_lockfile = Path(venv_path) / ".riot-dev-pkg-installed"
12911293
if dev_pkg_lockfile.exists() and not force:
@@ -1300,28 +1302,28 @@ def install_dev_pkg(
13001302
return
13011303

13021304
# Determine installation method
1303-
if wheel_source:
1305+
if wheel_path:
13041306
# Install from wheels (two-step process to ensure we use only wheels from source)
13051307
package_name = get_package_name()
13061308
logger.info(
13071309
"Installing dev package from wheels: %s (source: %s)",
13081310
package_name,
1309-
wheel_source,
1311+
wheel_path,
13101312
)
13111313

13121314
# Step 1: Download wheel to temp directory using --no-index to avoid PyPI
13131315
with tempfile.TemporaryDirectory() as tmp_dir:
13141316
download_cmd = (
13151317
f"pip --disable-pip-version-check download "
1316-
f"--no-index --no-deps --find-links '{wheel_source}' "
1318+
f"--no-index --no-deps --find-links '{wheel_path}' "
13171319
f"--pre --dest '{tmp_dir}' '{package_name}'"
13181320
)
13191321
try:
13201322
Session.run_cmd_venv(venv_path, download_cmd, env=dict(os.environ))
13211323
except CmdFailure as e:
13221324
logger.error(
13231325
"Wheel download failed. Ensure wheel exists at %s\n%s",
1324-
wheel_source,
1326+
wheel_path,
13251327
e.proc.stdout,
13261328
)
13271329
sys.exit(1)

0 commit comments

Comments
 (0)