Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/codeflash-optimize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ jobs:
- name: ⚡️Codeflash Optimization
id: optimize_code
run: |
source .venv/bin/activate
poetry run codeflash
uv run codeflash
19 changes: 5 additions & 14 deletions .github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ jobs:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python 3.11 for CLI
uses: astral-sh/setup-uv@v5
with:
python-version: 3.11.6

- name: Install dependencies (CLI)
run: |
uv tool install poetry
uv venv
source .venv/bin/activate
poetry install --with dev

- name: Remove .git
run: |
if [ -d ".git" ]; then
Expand All @@ -49,9 +37,12 @@ jobs:
echo ".git directory does not exist. Nothing to remove."
exit 1
fi
- name: Set up uv Python 3.11 for CLI
uses: astral-sh/setup-uv@v5
with:
python-version: 3.11.6

- name: Run Codeflash to optimize code
id: optimize_code
run: |
source .venv/bin/activate
poetry run python tests/scripts/end_to_end_test_bubblesort_pytest.py
uv run -p 3.11 python tests/scripts/end_to_end_test_bubblesort_pytest.py
12 changes: 2 additions & 10 deletions .github/workflows/end-to-end-test-bubblesort-unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,12 @@ jobs:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python 3.11 for CLI
- name: Set up uv Python 3.11 for CLI
uses: astral-sh/setup-uv@v5
with:
python-version: 3.11.6

- name: Install dependencies (CLI)
run: |
uv tool install poetry
uv venv
source .venv/bin/activate
poetry install --with dev

- name: Run Codeflash to optimize code
id: optimize_code
run: |
source .venv/bin/activate
poetry run python tests/scripts/end_to_end_test_bubblesort_unittest.py
uv run -p 3.11 python tests/scripts/end_to_end_test_bubblesort_unittest.py
11 changes: 1 addition & 10 deletions .github/workflows/end-to-end-test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,7 @@ jobs:
with:
python-version: 3.11.6

- name: Install dependencies (CLI)
run: |
uv tool install poetry
uv venv
source .venv/bin/activate
poetry install --with dev
poetry add black # my-best-repo in end_to_end_test_coverage.py is configured to use black

- name: Run Codeflash to optimize code
id: optimize_code
run: |
source .venv/bin/activate
poetry run python tests/scripts/end_to_end_test_coverage.py
uv run --with black -p 3.11 python tests/scripts/end_to_end_test_coverage.py
9 changes: 1 addition & 8 deletions .github/workflows/end-to-end-test-futurehouse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,8 @@ jobs:
with:
python-version: 3.11.6

- name: Install dependencies (CLI)
run: |
uv tool install poetry
uv venv
source .venv/bin/activate
poetry install --with dev

- name: Run Codeflash to optimize code
id: optimize_code
run: |
source .venv/bin/activate
poetry run python tests/scripts/end_to_end_test_futurehouse.py
uv run -p 3.11 python tests/scripts/end_to_end_test_futurehouse.py
9 changes: 1 addition & 8 deletions .github/workflows/end-to-end-test-init-optim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,8 @@ jobs:
with:
python-version: 3.11.6

- name: Install dependencies (CLI)
run: |
uv tool install poetry
uv venv
source .venv/bin/activate
poetry install --with dev

- name: Run Codeflash to optimize code
id: optimize_code
run: |
source .venv/bin/activate
poetry run python tests/scripts/end_to_end_test_init_optimization.py
uv run -p 3.11 python tests/scripts/end_to_end_test_init_optimization.py
10 changes: 1 addition & 9 deletions .github/workflows/end-to-end-test-tracer-replay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ jobs:
with:
python-version: 3.11.6

- name: Install dependencies (CLI)
run: |
uv tool install poetry
uv venv
source .venv/bin/activate
poetry install --with dev

- name: Run Codeflash to optimize code
id: optimize_code
run: |
source .venv/bin/activate
poetry run python tests/scripts/end_to_end_test_tracer_replay.py
uv run -p 3.11 python tests/scripts/end_to_end_test_tracer_replay.py
10 changes: 1 addition & 9 deletions .github/workflows/end-to-end-topological-sort-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ jobs:
with:
python-version: 3.11.6

- name: Install dependencies (CLI)
run: |
uv tool install poetry
uv venv
source .venv/bin/activate
poetry install --with dev

- name: Run Codeflash to optimize code
id: optimize_code
run: |
source .venv/bin/activate
poetry run python tests/scripts/end_to_end_test_topological_sort.py
uv run -p 3.11 python tests/scripts/end_to_end_test_topological_sort.py
10 changes: 1 addition & 9 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ jobs:

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.30"

- name: install poetry as a tool
run: uv tool install poetry

- name: install dependencies
run: uvx poetry install --with dev

- name: Run mypy on allowlist
run: uvx poetry run mypy --non-interactive --config-file pyproject.toml @mypy_allowlist.txt
run: uv run --all-groups mypy --non-interactive --config-file pyproject.toml @mypy_allowlist.txt
8 changes: 1 addition & 7 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,9 @@ jobs:
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
version: "0.5.30"
- name: install poetry as a tool
run: uv tool install poetry

- name: install dependencies
run: uvx poetry install --with dev

- name: Unit tests
run: uvx poetry run pytest tests/ --cov --cov-report=xml
run: uv run pytest tests/ --cov --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
Expand Down
2 changes: 1 addition & 1 deletion codeflash/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These version placeholders will be replaced by poetry-dynamic-versioning during `poetry build`.
# These version placeholders will be replaced by hatch-vcs during build.
__version__ = "0.10.3"
__version_tuple__ = (0, 10, 3)
159 changes: 71 additions & 88 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[tool]
[tool.poetry]
[project]
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. <[email protected]>"]
homepage = "https://codeflash.ai"
authors = [{ name = "CodeFlash Inc.", email = "[email protected]" }]
requires-python = ">=3.9"
readme = "README.md"
packages = [{ include = "codeflash", format = ["sdist"] }]
license = "BUSL-1.1 "
keywords = [
"codeflash",
"performance",
Expand All @@ -17,6 +14,64 @@ keywords = [
"machine learning",
"LLM",
]
dependencies = [
"unidiff>=0.7.4",
"pytest>=7.0.0,<8.3.4",
"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,<=3.11.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",
]
urls = { "Homepage" = "https://codeflash.ai" }
scripts = { codeflash = "codeflash.main:main" }

dynamic = ["version"] # Determined by uv-dynamic-versioning during `uv build`

[dependency-groups]
dev = [
"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,<7",
"types-gevent>=24.11.0.20241230,<25",
"types-greenlet>=3.1.0.20241221,<4",
"types-pexpect>=4.9.0.20241208,<5",
"types-unidiff>=0.7.0.20240505,<0.8",
"uv>=0.6.2",
]

[tool.hatch.build]
include = ["codeflash"]
exclude = [
"docs/*",
"experiments/*",
Expand Down Expand Up @@ -65,69 +120,6 @@ exclude = [
"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,<8.3.4"
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,<=3.11.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"
line_profiler=">=4.2.0" #this is the minimum version which supports python 3.13
[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"
types-gevent = "^24.11.0.20241230"
types-greenlet = "^3.1.0.20241221"
types-pexpect = "^4.9.0.20241208"
types-unidiff = "^0.7.0.20240505"
uv = ">=0.6.2"

[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
Expand Down Expand Up @@ -199,22 +191,6 @@ split-on-trailing-comma = false
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"
Expand All @@ -225,7 +201,14 @@ formatter-cmds = [
"uvx ruff format $file",
]

[tool.hatch.build.hooks.vcs]
version-file = "codeflash/version.py"

[tool.hatch.version]
source = "vcs"
tag-pattern = "(?:^|^v|^release/)(?P<version>[0-9]+\\.[0-9]+\\.[0-9]+)$"


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