[tool]
[tool.poetry]
name = "codeflash"
version = "0.0.0" # Determined by poetry-dynamic-versioning during `poetry build`
description = "Client for codeflash.ai - automatic code performance optimization, powered by AI"
license = "BSL-1.1"
authors = ["CodeFlash Inc. <contact@codeflash.ai>"]
homepage = "https://codeflash.ai"
readme = "README.md"
packages = [{ include = "codeflash" }]
keywords = [
    "codeflash",
    "performance",
    "optimization",
    "ai",
    "code",
    "machine learning",
    "LLM",
]
exclude = [
    "docs/*",
    "experiments/*",
    "tests/*",
    "*.pyc",
    "__pycache__",
    "*.pyo",
    "*.pyd",
    "*.so",
    "*.dylib",
    "*.dll",
    "*.exe",
    "*.log",
    "*.tmp",
    ".env",
    ".env.*",
    "**/.env",
    "**/.env.*",
    ".env.example",
    "*.pem",
    "*.key",
    "secrets.*",
    "config.yaml",
    "config.json",
    ".git",
    ".gitignore",
    ".gitattributes",
    ".github",
    "Dockerfile",
    "docker-compose.yml",
    "*.md",
    "*.txt",
    "*.csv",
    "*.db",
    "*.sqlite3",
    "*.pdf",
    "*.docx",
    "*.xlsx",
    "*.pptx",
    "*.iml",
    ".idea",
    ".vscode",
    ".DS_Store",
    "Thumbs.db",
    "venv",
    "env",
]

# Versions here the minimum required versions for the project. These should be as loose as possible.
[tool.poetry.dependencies]
python = "^3.9"
unidiff = ">=0.7.4"
pytest = ">=7.0.0"
gitpython = ">=3.1.31"
libcst = ">=1.0.1"
jedi = ">=0.19.1"
tiktoken = ">=0.3.2"
timeout-decorator = ">=0.5.0"
pytest-timeout = ">=2.1.0"
tomlkit = ">=0.11.7"
unittest-xml-reporting = ">=3.2.0"
junitparser = ">=3.1.0"
pydantic = ">=1.10.1"
humanize = ">=4.0.0"
posthog = ">=3.0.0"
click = ">=8.1.0"
inquirer = ">=3.0.0"
sentry-sdk = ">=1.40.6,<3.0.0"
parameterized = ">=0.9.0"
isort = ">=5.11.0"
dill = ">=0.3.8"
rich = ">=13.8.1"
lxml = ">=5.3.0"
crosshair-tool = ">=0.0.78"
coverage = ">=7.6.4"


[tool.poetry.group.dev]
optional = true

# Don't forget to install the poetry plugins we use too:
# poetry self add poetry-dynamic-versioning

[tool.poetry.group.dev.dependencies]
ipython = ">=8.12.0"
mypy = ">=1.13"
ruff = ">=0.7.0"
lxml-stubs = ">=0.5.1"
pandas-stubs = ">=2.2.2.240807, <2.2.3.241009"
types-Pygments = ">=2.18.0.20240506"
types-colorama = ">=0.4.15.20240311"
types-decorator = ">=5.1.8.20240310"
types-jsonschema = ">=4.23.0.20240813"
types-requests = ">=2.32.0.20241016"
types-six = ">=1.16.21.20241009"
types-cffi = ">=1.16.0.20240331"
types-openpyxl = ">=3.1.5.20241020"
types-regex = ">=2024.9.11.20240912"
types-python-dateutil = ">=2.9.0.20241003"
pytest-cov = "^6.0.0"

[tool.poetry.build]
script = "codeflash/update_license_version.py"

[tool.poetry.scripts]
codeflash = "codeflash.main:main"

[tool.mypy]
show_error_code_links = true
pretty = true
show_absolute_path = true
show_error_context = true
show_error_end = true
strict = true
warn_unreachable = true
install_types = true
plugins = ["pydantic.mypy"]

[[tool.mypy.overrides]]
module = ["jedi", "jedi.api.classes", "inquirer", "inquirer.themes"]
ignore_missing_imports = true

[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true

[tool.ruff]
line-length = 120
fix = true
show-fixes = true
exclude = ["code_to_optimize/", "pie_test_set/"]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    "C901",
    "D100",
    "D101",
    "D102",
    "D103",
    "D105",
    "D107",
    "S101",
    "S603",
    "S607",
    "ANN101",
    "COM812",
    "FIX002",
    "PLR0912",
    "PLR0913",
    "PLR0915",
    "TD002",
    "TD003",
    "TD004",
]

[tool.ruff.lint.flake8-type-checking]
strict = true
runtime-evaluated-base-classes = ["pydantic.BaseModel"]
runtime-evaluated-decorators = ["pydantic.validate_call"]

[tool.ruff.lint.pep8-naming]
classmethod-decorators = [
    # Allow Pydantic's `@validator` decorator to trigger class method treatment.
    "pydantic.validator",
]

[tool.ruff.format]
docstring-code-format = true
skip-magic-trailing-comma = true

[tool.poetry-dynamic-versioning]
enable = true
style = "pep440"
vcs = "git"

[tool.poetry-dynamic-versioning.substitution]
files = ["codeflash/version.py"]

[tool.poetry-dynamic-versioning.files."codeflash/version.py"]
persistent-substitution = true
initial-content = """
  # These version placeholders will be replaced by poetry-dynamic-versioning during `poetry build`.
  __version__ = "0.0.0"
  __version_tuple__ = (0, 0, 0)
"""


[tool.codeflash]
module-root = "codeflash"
tests-root = "tests"
test-framework = "pytest"
formatter-cmds = [
    "poetry run ruff check --exit-zero --fix $file",
    "poetry run ruff format $file",
]


[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.2.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"
