codeflash-agent/pyproject.toml

299 lines
12 KiB
TOML
Raw Normal View History

2026-04-03 22:36:50 +00:00
[project]
name = "codeflash-workspace"
version = "0.1.0"
requires-python = ">=3.9"
[tool.uv.workspace]
members = ["packages/*", "reports/*"]
2026-04-03 22:36:50 +00:00
[dependency-groups]
dev = [
"codeflash-core",
"codeflash-python",
2026-04-09 08:36:01 +00:00
"codeflash-service",
"black>=25.1",
2026-04-03 22:36:50 +00:00
"interrogate>=1.7.0",
"memray>=1.19.2",
"mypy>=1.14",
"parameterized>=0.9.0",
"pydantic>=2.12.5",
"pytest>=7.4",
"pytest-asyncio>=1.2.0",
2026-04-09 08:36:01 +00:00
"respx>=0.22.0",
2026-04-03 22:36:50 +00:00
"ruff>=0.15.7",
"tomlkit>=0.14.0",
"types-requests>=2.32.4.20260107",
]
2026-04-09 08:36:01 +00:00
test-optional = [
"jax[cpu]>=0.5",
"numba>=0.61",
"numpy>=2.2",
"pandas>=2.2",
"pyarrow>=19.0",
"pyrsistent>=0.20",
"scipy>=1.15",
"tensorflow>=2.19",
"torch>=2.6",
"xarray>=2025.3",
]
2026-04-03 22:36:50 +00:00
[tool.uv.sources]
codeflash-core = { workspace = true }
codeflash-python = { workspace = true }
2026-04-09 08:36:01 +00:00
codeflash-service = { workspace = true }
2026-04-03 22:36:50 +00:00
[tool.ruff]
src = [
"packages/codeflash-core/src",
"packages/codeflash-python/src",
"packages/codeflash-python/tests",
2026-04-09 08:36:01 +00:00
"packages/github-app",
2026-04-03 22:36:50 +00:00
]
extend-exclude = [
".codeflash/",
2026-04-03 22:36:50 +00:00
"packages/codeflash-python/tests/code_to_optimize",
"packages/codeflash-python/src/codeflash_python/ai/_tabulate.py",
]
line-length = 79
target-version = "py39"
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A", # shadowing is fine
"ANN", # Mypy is better at this
"ARG", # unused arguments are common w/ interfaces
"COM", # formatter takes care of that
"D", # we prefer our own docstring style
"E501", # line length handled by formatter
"FIX", # we don't want these
"INP001", # tests have no __init__.py
"ISC001", # conflicts with formatter
"PD", # not using pandas
"RET504", # unnecessary-assign is useful for readability
"TD", # we don't want these
"TID252", # relative imports are fine
]
[tool.ruff.lint.per-file-ignores]
"packages/codeflash-core/src/codeflash_core/_model.py" = [
"C901", # humanize_runtime is complex but faithfully ported
"PLR2004", # magic values in humanize_runtime thresholds
"PLR0912", # too many branches in humanize_runtime
]
"packages/codeflash-python/src/codeflash_python/_compat.py" = [
"C901", # humanize_runtime is complex but faithfully ported
"PLR0911", # too many return statements in faithfully ported modify_addopts
"PLR0912", # too many branches in humanize_runtime
"PLR0915", # too many statements in faithfully ported save_api_key_to_rc
"PLR2004", # magic values in humanize_runtime thresholds
"TRY300", # ported version_check control flow
]
"packages/codeflash-core/src/codeflash_core/_git.py" = [
"PLR0911", # too many return statements in faithfully ported check_and_push_branch
]
"packages/codeflash-core/src/codeflash_core/_shell.py" = [
"C901", # save_api_key_to_rc is complex but faithfully ported
"PLR0912", # too many branches in faithfully ported save_api_key_to_rc
]
"packages/codeflash-python/src/codeflash_python/pipeline/_config.py" = [
"C901", # parse_config_file is complex but faithfully ported
"PLR0912", # too many branches in faithfully ported parse_config_file
"PLR2004", # HTTP status code 200
"TRY300", # ported version_check control flow
]
"packages/codeflash-python/src/codeflash_python/testing/_pytest_config.py" = [
"PLR0911", # too many return statements in faithfully ported modify_addopts
]
"packages/codeflash-python/src/codeflash_python/analysis/_extraction.py" = [
"C901", # get_code has nested find_target closure
"PLR0912", # too many branches in faithfully ported get_code
"PLR0915", # too many statements in faithfully ported get_code
"PLR2004", # magic values in AST traversal (dunder name length, name_parts indices)
]
"packages/codeflash-python/src/codeflash_python/verification/_comparator.py" = [
"BLE001", # catching broad Exception is intentional in comparator
"E501", # long docstring line
]
"packages/codeflash-python/src/codeflash_python/analysis/_discovery.py" = [
"N802", # libcst visitor methods must match visit_NodeName
]
"packages/codeflash-core/src/codeflash_core/danom/safe.py" = [
"BLE001", # catching blind Exception is the point of @safe
]
"packages/codeflash-python/src/codeflash_python/testing/_instrumentation.py" = [
"C901", # faithfully ported complex methods
"PLR0912", # too many branches in ported methods
"PLR0915", # too many statements in find_and_update_line_node
2026-04-09 08:36:01 +00:00
]
"packages/codeflash-python/src/codeflash_python/testing/_instrument_core.py" = [
"C901", # detect_frameworks_from_code has many framework branches
]
"packages/codeflash-python/src/codeflash_python/testing/_instrument_capture.py" = [
"C901", # visit_ClassDef is complex but faithfully ported
"ERA001", # comments show equivalent Python for AST code below
"PLR0912", # too many branches in visit_ClassDef
"PLR0913", # add_codeflash_capture_to_init has 6 args
2026-04-03 22:36:50 +00:00
"PLR2004", # magic value in decorator part-count check
]
"packages/codeflash-python/src/codeflash_python/analysis/_discovery_worker.py" = [
"BLE001", # broad Exception catches are intentional in subprocess worker
"I001", # import sorting not applicable to standalone script
"PLW0602", # global statement without assignment (list.extend)
"PLW0603", # global statement is intentional for subprocess communication
"T201", # print is the logging mechanism for subprocess workers
]
"packages/codeflash-python/src/codeflash_python/benchmarking/_benchmark_tracing.py" = [
"BLE001", # broad Exception catches are intentional in tracing infrastructure
"PLR2004", # magic buffer-size thresholds ported from reference
"T201", # print is the error-reporting mechanism for tracing
]
"packages/codeflash-python/src/codeflash_python/benchmarking/_benchmark_plugin.py" = [
"BLE001", # broad Exception catches are intentional in plugin infrastructure
"SLF001", # _getframe access is required for line number capture
"T201", # print is the error-reporting mechanism for the plugin
]
"packages/codeflash-python/src/codeflash_python/analysis/_formatter.py" = [
"FBT", # ported signatures use boolean positional args
"PLR0913", # ported format_code signature has 6 args
"PLR2004", # magic numeric thresholds in formatting diff logic
]
"packages/codeflash-python/src/codeflash_python/benchmarking/_benchmarking.py" = [
"C901", # inspect_function_properties faithfully ported
"N802", # libcst visitor methods must match visit_NodeName
"PLR0913", # ported signatures require many args
"PLR2004", # magic numeric thresholds in formatting functions
]
"packages/codeflash-python/src/codeflash_python/benchmarking/_benchmark_worker.py" = [
"BLE001", # broad Exception catch is intentional in subprocess worker
"I001", # import sorting not applicable to standalone script
"T201", # print is the logging mechanism for subprocess workers
]
"packages/*/tests/*" = [
"ASYNC251", # time.sleep in async tests (testing blocking behavior)
"B007", # unused loop variable in tests
"B011", # assert False is fine in tests
"B018", # useless expressions fine in test setup
"BLE001", # blind except fine in tests
"C901", # complex test functions are fine
"DTZ001", # datetime without tz fine in tests
"E402", # import not at top fine in tests
"E501", # test data strings often exceed line length
"E712", # comparison to True/False fine in tests
"E741", # ambiguous variable names fine in test data
"EM101", # string literal in exception fine in tests
"ERA001", # commented code fine in tests
"F401", # try/except import guards appear unused to ruff
"F821", # ExceptionGroup and other 3.11+ names
"FA100", # future annotations fine in tests
"FBT", # boolean params are fine in test helpers
"F841", # unused locals are fine in test setup
"FURB177", # Path.cwd vs Path() fine in tests
"N802", # non-lowercase function names fine in tests
"N806", # non-lowercase variable names fine in tests
"N818", # exception naming fine in tests
"NPY002", # legacy numpy random fine in tests
"PERF401", # list comprehension alternative fine in tests
"PGH003", # blanket type:ignore fine in tests
"PLC0415", # imports inside functions are fine in tests
"PLR0915", # too many statements fine in tests
"PLR2004", # magic values are fine in tests
"PLW1641", # missing __hash__ fine in tests
"PT006", # parametrize types fine in tests
"PT009", # unittest-style assertions fine in ported tests
"PT014", # duplicate parametrize fine in tests
"PT015", # assert in fixtures fine in tests
"PT016", # pytest.fail message fine in tests
"PT017", # assert in except fine in tests
"PT018", # compound assertions are fine in tests
"PT019", # fixture without return fine in tests
"PTH109", # Path.getcwd fine in tests
"PTH123", # open() fine in tests
"PYI024", # named tuple fine in tests
"RUF005", # tuple concat is fine in tests
"RUF012", # mutable class vars fine in tests
"RUF013", # implicit Optional fine in tests
"RUF015", # next() vs slice fine in tests
"RUF032", # decimal literal fine in tests
"RUF043", # pairwise fine in tests
"RUF059", # unused unpacked vars are fine in tests
"S101", # assert is fine in tests
"S108", # temp paths are fine in tests
"S301", # pickle fine in tests
"S311", # random fine in tests
"SIM102", # collapsible if fine in tests
"SIM108", # explicit if/else is fine in tests
"SIM118", # dict key check fine in tests
"SIM300", # Yoda style is fine in tests (expected == actual)
"SLF001", # private member access is fine in tests
"T201", # print is fine in tests
"TC001", # type-checking imports are fine in tests
"TC002", # type-checking imports are fine in tests
"TC003", # type-checking imports are fine in tests
"TRY002", # exception subclass fine in tests
"TRY003", # long exception message fine in tests
"W", # whitespace issues in test data strings
]
"reports/*" = [
"C901", # complex layout builders are expected in Dash apps
"E501", # long strings in inline HTML
"ERA001", # section separator comments
"PERF403", # dict comprehension not clearer here
"PLR0913", # helper functions with many style params
"PLR0915", # long layout functions are expected in Dash
"PLR2004", # magic values in layout (pixel sizes, etc.)
"T201", # print for dev server
]
2026-04-03 22:36:50 +00:00
[tool.isort]
known_first_party = ["codeflash_python", "codeflash_core"]
[tool.mypy]
strict = true
pretty = true
[[tool.mypy.overrides]]
module = "dill.*"
ignore_missing_imports = true
follow_imports = "skip"
[[tool.mypy.overrides]]
module = "codeflash_python.ai._tabulate"
ignore_errors = true
[[tool.mypy.overrides]]
module = "codeflash_python.benchmarking._profile_stats"
ignore_errors = true
[[tool.mypy.overrides]]
module = "codeflash_python.testing._instrumentation"
ignore_errors = true
[tool.pytest.ini_options]
asyncio_mode = "auto"
2026-04-03 22:36:50 +00:00
addopts = [
"--strict-markers",
"--strict-config",
"--import-mode=importlib",
]
testpaths = [
"packages/codeflash-core/tests",
"packages/codeflash-python/tests",
2026-04-09 08:36:01 +00:00
"packages/github-app/tests",
2026-04-03 22:36:50 +00:00
]
norecursedirs = [
"code_to_optimize",
]
xfail_strict = true
markers = [
"asyncio: mark a test as an asyncio test",
"ci_skip: skip test in CI environments",
]
[tool.interrogate]
fail-under = 100
verbose = 2
exclude = [
"packages/codeflash-python/src/codeflash_python/ai/_tabulate.py",
]