From ff21f449cf0b6f50d88dd3dc1c6ec8a31c540d92 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Fri, 12 Dec 2025 01:06:10 -0500 Subject: [PATCH] Add --find-links to make it easier to use custom wheels Just point the installer or sync command at your directory and it should find the wheel. Maybe we should add this to pyproject.toml too? --- robotpy_installer/cli_installer.py | 9 ++++++++- robotpy_installer/cli_sync.py | 9 +++++++++ robotpy_installer/installer.py | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/robotpy_installer/cli_installer.py b/robotpy_installer/cli_installer.py index 8e03b60..de068bc 100644 --- a/robotpy_installer/cli_installer.py +++ b/robotpy_installer/cli_installer.py @@ -236,6 +236,12 @@ def common_pip_options( help="Install from the given requirements file. This option can be used multiple times.", ) + parser.add_argument( + "--find-links", + help="Tell pip to search a specified URL or a local directory", + type=pathlib.Path, + ) + parser.add_argument( "packages", nargs="*", @@ -256,13 +262,14 @@ def __init__(self, parser: argparse.ArgumentParser) -> None: @handle_cli_error def run( self, + find_links: typing.Optional[pathlib.Path], no_deps: bool, pre: bool, requirements: typing.Tuple[pathlib.Path], packages: typing.Tuple[str], ): installer = RobotpyInstaller() - installer.pip_download(no_deps, pre, requirements, packages) + installer.pip_download(no_deps, pre, requirements, packages, find_links) class InstallerInstall: diff --git a/robotpy_installer/cli_sync.py b/robotpy_installer/cli_sync.py index 9ef8bf7..7ce2327 100644 --- a/robotpy_installer/cli_sync.py +++ b/robotpy_installer/cli_sync.py @@ -6,6 +6,7 @@ import subprocess import sys import tempfile +import typing as T from packaging.version import Version @@ -74,11 +75,18 @@ def __init__(self, parser: argparse.ArgumentParser): help="Do not check to see if the project can be upgraded", ) + parser.add_argument( + "--find-links", + help="Tell pip to search a specified URL or a local directory", + type=pathlib.Path, + ) + @handle_cli_error def run( self, project_path: pathlib.Path, main_file: pathlib.Path, + find_links: T.Optional[pathlib.Path], no_install: bool, no_upgrade_project: bool, user: bool, @@ -149,6 +157,7 @@ def run( pre=False, requirements=[], packages=packages, + find_links=find_links, ) # diff --git a/robotpy_installer/installer.py b/robotpy_installer/installer.py index bbdde70..89e2e27 100755 --- a/robotpy_installer/installer.py +++ b/robotpy_installer/installer.py @@ -469,6 +469,7 @@ def pip_download( pre: bool, requirements: typing.Sequence[pathlib.Path], packages: typing.Sequence[str], + find_links: typing.Optional[pathlib.Path], ): """ Specify Python package(s) to download, and store them in the cache. @@ -510,6 +511,9 @@ def pip_download( str(self.pip_cache), ] + if find_links: + pip_args += ["--find-links", str(find_links)] + self._extend_pip_args( pip_args, None,