From 6132c7c9fe49e0023e67cd2fe60e4fb4e32af253 Mon Sep 17 00:00:00 2001 From: Faiz Surani Date: Sat, 9 Nov 2024 12:05:37 -0800 Subject: [PATCH] Split off more deps into extras --- pyproject.toml | 12 +++++++----- rl/cli/main.py | 6 +++--- rl/utils/core.py | 5 ++--- uv.lock | 22 ++++++++++------------ 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bd2e820..81f62d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,18 +21,20 @@ dependencies = [ "tqdm", "ipdb", "requests", - "regex", "python-dotenv", - "unidecode", "StrEnum", - # TODO: Maybe move into an extra? - "watchdog", "pydantic>=2", "typing-extensions", - "legal-segmenter @ git+https://github.com/lexeme-dev/legal-segmenter@main", ] [project.optional-dependencies] +segmenter = [ + "unidecode", + "legal-segmenter @ git+https://github.com/lexeme-dev/legal-segmenter@main", +] +devsync = [ + "watchdog", +] sherlock = [ "pexpect", "pyotp", diff --git a/rl/cli/main.py b/rl/cli/main.py index ac0eee0..203b190 100644 --- a/rl/cli/main.py +++ b/rl/cli/main.py @@ -3,6 +3,7 @@ import json import os import random +import re import subprocess import threading import time @@ -13,7 +14,6 @@ import paramiko import pexpect # type: ignore import questionary -import regex import rich import rich.progress import rich.table @@ -75,8 +75,8 @@ _DEFAULT_SSH_TUNNEL_PORT = 5549 -_MFA_LINE_REGEX = regex.compile( - r"\s*(?P\d+)\. Duo Push to XXX-XXX-0199\s*", regex.IGNORECASE +_MFA_LINE_REGEX = re.compile( + r"\s*(?P\d+)\. Duo Push to XXX-XXX-0199\s*", re.IGNORECASE ) # endregion diff --git a/rl/utils/core.py b/rl/utils/core.py index 3beb952..c165f23 100644 --- a/rl/utils/core.py +++ b/rl/utils/core.py @@ -1,9 +1,8 @@ import collections +import re from collections.abc import Callable, Iterable from typing import Any, TypeVar -import regex - import rl.utils.io K = TypeVar("K") @@ -31,7 +30,7 @@ def dig(d: dict, *keys: str) -> Any: return d -def safe_extract(pattern: regex.Pattern, text: str, key: str) -> str | None: +def safe_extract(pattern: re.Pattern, text: str, key: str) -> str | None: match = pattern.search(text) if match: return match.group(key) diff --git a/uv.lock b/uv.lock index 368c39d..bfcc3c5 100644 --- a/uv.lock +++ b/uv.lock @@ -2952,23 +2952,20 @@ source = { editable = "." } dependencies = [ { name = "click" }, { name = "ipdb" }, - { name = "legal-segmenter" }, - { name = "paramiko" }, { name = "pydantic" }, { name = "python-dotenv" }, - { name = "questionary" }, - { name = "regex" }, { name = "requests" }, { name = "rich" }, { name = "rich-click" }, { name = "strenum" }, { name = "tqdm" }, { name = "typing-extensions" }, - { name = "unidecode" }, - { name = "watchdog" }, ] [package.optional-dependencies] +devsync = [ + { name = "watchdog" }, +] llm = [ { name = "anthropic" }, { name = "google-generativeai" }, @@ -2994,6 +2991,10 @@ plot = [ { name = "matplotlib" }, { name = "pandas" }, ] +segmenter = [ + { name = "legal-segmenter" }, + { name = "unidecode" }, +] sherlock = [ { name = "appdirs" }, { name = "paramiko" }, @@ -3026,13 +3027,12 @@ requires-dist = [ { name = "google-generativeai", marker = "extra == 'llm'" }, { name = "huggingface-hub", marker = "extra == 'local-llm'" }, { name = "ipdb" }, - { name = "legal-segmenter", git = "https://github.com/lexeme-dev/legal-segmenter?rev=main" }, + { name = "legal-segmenter", marker = "extra == 'segmenter'", git = "https://github.com/lexeme-dev/legal-segmenter?rev=main" }, { name = "matplotlib", marker = "extra == 'plot'" }, { name = "modal", marker = "extra == 'llm'" }, { name = "openai", marker = "extra == 'llm'" }, { name = "pandas", marker = "extra == 'local-llm'" }, { name = "pandas", marker = "extra == 'plot'" }, - { name = "paramiko", specifier = ">=3.4.1" }, { name = "paramiko", marker = "extra == 'sherlock'" }, { name = "peft", marker = "extra == 'local-llm'" }, { name = "pexpect", marker = "extra == 'sherlock'" }, @@ -3041,9 +3041,7 @@ requires-dist = [ { name = "pyotp", marker = "extra == 'sherlock'" }, { name = "pyspark", marker = "extra == 'spark'" }, { name = "python-dotenv" }, - { name = "questionary", specifier = ">=1.10.0" }, { name = "questionary", marker = "extra == 'sherlock'" }, - { name = "regex" }, { name = "requests" }, { name = "rich" }, { name = "rich-click" }, @@ -3054,10 +3052,10 @@ requires-dist = [ { name = "transformers", marker = "extra == 'local-llm'", specifier = ">=4.43" }, { name = "trl", marker = "extra == 'local-llm'" }, { name = "typing-extensions" }, - { name = "unidecode" }, + { name = "unidecode", marker = "extra == 'segmenter'" }, { name = "vllm", marker = "platform_system == 'Linux' and extra == 'local-llm'", specifier = "~=0.5.3.post1" }, { name = "wandb", marker = "extra == 'local-llm'" }, - { name = "watchdog" }, + { name = "watchdog", marker = "extra == 'devsync'" }, ] [package.metadata.requires-dev]