Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Relax ruff requirements and patch import positions

Herumb Shandilyabce4310553bc
diff --git a/dsp/utils/utils.py b/dsp/utils/utils.py
index d5a30b0e3..4025dfa3f 100644
--- a/dsp/utils/utils.py
+++ b/dsp/utils/utils.py
@@ -1,10 +1,10 @@
-import datetime
-import itertools
import os
-from collections import defaultdict
-
import tqdm
+import copy
+import datetime
+import itertools
+from collections import defaultdict
def print_message(*s, condition=True, pad=False, sep=None):
s = " ".join([str(x) for x in s])
@@ -75,9 +75,6 @@ def batch(group, bsize, provide_offset=False):
# __delattr__ = dict.__delitem__
-import copy
-
-
class dotdict(dict):
def __getattr__(self, key):
if key.startswith('__') and key.endswith('__'):
diff --git a/examples/longformqa/utils.py b/examples/longformqa/utils.py
index bdae81a24..3ba37fbcd 100644
--- a/examples/longformqa/utils.py
+++ b/examples/longformqa/utils.py
@@ -1,8 +1,8 @@
import nltk
import regex as re
-nltk.download('punkt')
from nltk.tokenize import sent_tokenize
+nltk.download('punkt')
def extract_text_by_citation(paragraph):
diff --git a/pyproject.toml b/pyproject.toml
index 8501bbfcf..7e0f7bdcb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -208,102 +208,21 @@ exclude_lines = [
[tool.ruff]
line-length = 120
indent-width = 4
-target-version = "py39"
-extend-unsafe-fixes = ["D"]
+target-version = "py38"
[tool.ruff.lint]
-# List of rules: https://docs.astral.sh/ruff/rules
-select = [
- # flake8-builtins
- "A",
- # flake8-commas
- "COM812",
- # flake8-comprehensions
- "C4",
- # pydocstyle
- "D",
- # pycodestyle
- "E",
- # Pyflakes
- "F",
- # pyupgrade
- "UP",
- # flake8-bugbear
- "B",
- # flake8-simplify
- "SIM",
- # flake8-implicit-str-concat
- "ISC",
- # pep8-naming
- "N",
- # flake8-annotations
- "ANN",
- # flake8-async
- "ASYNC",
- # flake8-bandid selected
- "S",
- # flake8-print
- "T20",
- # flake8-return
- "RET",
- # flake8-simplify
- "SIM",
- # flake8-unused-arguments
- "ARG",
- # flake8-use-pathlib
- "PTH",
- # eradicate
- "ERA",
- # pandas-vet
- "PD",
- # Import sort
- "I",
- # avoid shadowing
- "PLW",
-]
-ignore = [
- "D100",
- "D101",
- "D104",
- "D106",
- # missing-type-self
- "ANN101",
- # missing-type-cls
- "ANN102",
- # missing-type-kwargs
- "ANN003",
- # utf-8 encoding skip
- "UP009",
- # Missing return type annotation for special method `__init__`
- "ANN204",
- # Star-arg unpacking after a keyword argument is strongly discouraged
- "B026",
- # Missing type annotation for function argument `self`
- "ANN001",
- # Dynamically typed expressions (typing.Any) are disallowed in `wrapper`
- "ANN401",
- # We don't need docstrings for every method
- "ANN202",
- "D107",
- "D102",
- "D103",
- # Inline lambdas
- "E731",
- # Sometimes we need List and Tuple
- "UP006",
- # Ignore assert
- "S101",
-]
-
-# Allow fix for all enabled rules (when `--fix`) is provided.
+select = ["E4", "E9", "Q"]
+ignore = []
fixable = ["ALL"]
unfixable = []
+dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
+
[tool.ruff.format]
docstring-code-format = true
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
-indent-style = "space"
+indent-style = "tab"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
@@ -313,5 +232,5 @@ line-ending = "auto"
convention = "google"
[tool.ruff.lint.per-file-ignores]
-"**/{tests,docs}/*" = ["ALL"]
-"**__init__.py" = ["F401"]
+"**/{tests,testing,docs}/*" = ["ALL"]
+"**__init__.py" = ["ALL"]
diff --git a/setup.py b/setup.py
index 54362bf10..660ad6e47 100644
--- a/setup.py
+++ b/setup.py
@@ -15,13 +15,13 @@ setup(
version="2.4.10",
description="DSPy",
long_description=long_description,
- long_description_content_type='text/markdown',
+ long_description_content_type="text/markdown",
url="https://github.com/stanfordnlp/dsp",
author="Omar Khattab",
author_email="[email protected]",
license="MIT License",
- packages=find_packages(include=['dsp.*', 'dspy.*', 'dsp', 'dspy']),
- python_requires='>=3.9',
+ packages=find_packages(include=["dsp.*", "dspy.*", "dsp", "dspy"]),
+ python_requires=">=3.9",
install_requires=requirements,
extras_require={
@@ -37,8 +37,6 @@ setup(
"myscale":["clickhouse-connect"],
"snowflake": ["snowflake-snowpark-python"],
"fastembed": ["fastembed"],
- "google-vertex-ai": ["google-cloud-aiplatform==1.43.0"],
- "myscale":["clickhouse-connect"],
"groq": ["groq~=0.8.0"],
},
classifiers=[