codeflash 0.18.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. codeflash-0.18.5/.gitignore +257 -0
  2. codeflash-0.18.5/PKG-INFO +125 -0
  3. codeflash-0.18.5/README.md +84 -0
  4. codeflash-0.18.5/codeflash/LICENSE +98 -0
  5. codeflash-0.18.5/codeflash/__init__.py +0 -0
  6. codeflash-0.18.5/codeflash/api/__init__.py +0 -0
  7. codeflash-0.18.5/codeflash/api/aiservice.py +649 -0
  8. codeflash-0.18.5/codeflash/api/cfapi.py +391 -0
  9. codeflash-0.18.5/codeflash/benchmarking/__init__.py +0 -0
  10. codeflash-0.18.5/codeflash/benchmarking/codeflash_trace.py +220 -0
  11. codeflash-0.18.5/codeflash/benchmarking/function_ranker.py +158 -0
  12. codeflash-0.18.5/codeflash/benchmarking/instrument_codeflash_trace.py +114 -0
  13. codeflash-0.18.5/codeflash/benchmarking/plugin/__init__.py +0 -0
  14. codeflash-0.18.5/codeflash/benchmarking/plugin/plugin.py +288 -0
  15. codeflash-0.18.5/codeflash/benchmarking/pytest_new_process_trace_benchmarks.py +46 -0
  16. codeflash-0.18.5/codeflash/benchmarking/replay_test.py +314 -0
  17. codeflash-0.18.5/codeflash/benchmarking/trace_benchmarks.py +48 -0
  18. codeflash-0.18.5/codeflash/benchmarking/utils.py +132 -0
  19. codeflash-0.18.5/codeflash/cli_cmds/__init__.py +0 -0
  20. codeflash-0.18.5/codeflash/cli_cmds/cli.py +279 -0
  21. codeflash-0.18.5/codeflash/cli_cmds/cli_common.py +97 -0
  22. codeflash-0.18.5/codeflash/cli_cmds/cmd_init.py +1379 -0
  23. codeflash-0.18.5/codeflash/cli_cmds/console.py +154 -0
  24. codeflash-0.18.5/codeflash/cli_cmds/console_constants.py +65 -0
  25. codeflash-0.18.5/codeflash/cli_cmds/extension.py +194 -0
  26. codeflash-0.18.5/codeflash/cli_cmds/logging_config.py +31 -0
  27. codeflash-0.18.5/codeflash/cli_cmds/workflows/codeflash-optimize.yaml +34 -0
  28. codeflash-0.18.5/codeflash/code_utils/__init__.py +0 -0
  29. codeflash-0.18.5/codeflash/code_utils/checkpoint.py +156 -0
  30. codeflash-0.18.5/codeflash/code_utils/code_extractor.py +1187 -0
  31. codeflash-0.18.5/codeflash/code_utils/code_replacer.py +590 -0
  32. codeflash-0.18.5/codeflash/code_utils/code_utils.py +378 -0
  33. codeflash-0.18.5/codeflash/code_utils/codeflash_wrap_decorator.py +167 -0
  34. codeflash-0.18.5/codeflash/code_utils/compat.py +47 -0
  35. codeflash-0.18.5/codeflash/code_utils/concolic_utils.py +95 -0
  36. codeflash-0.18.5/codeflash/code_utils/config_consts.py +38 -0
  37. codeflash-0.18.5/codeflash/code_utils/config_parser.py +167 -0
  38. codeflash-0.18.5/codeflash/code_utils/coverage_utils.py +76 -0
  39. codeflash-0.18.5/codeflash/code_utils/deduplicate_code.py +250 -0
  40. codeflash-0.18.5/codeflash/code_utils/edit_generated_tests.py +249 -0
  41. codeflash-0.18.5/codeflash/code_utils/env_utils.py +167 -0
  42. codeflash-0.18.5/codeflash/code_utils/formatter.py +190 -0
  43. codeflash-0.18.5/codeflash/code_utils/git_utils.py +200 -0
  44. codeflash-0.18.5/codeflash/code_utils/git_worktree_utils.py +124 -0
  45. codeflash-0.18.5/codeflash/code_utils/github_utils.py +40 -0
  46. codeflash-0.18.5/codeflash/code_utils/instrument_existing_tests.py +1329 -0
  47. codeflash-0.18.5/codeflash/code_utils/line_profile_utils.py +224 -0
  48. codeflash-0.18.5/codeflash/code_utils/shell_utils.py +83 -0
  49. codeflash-0.18.5/codeflash/code_utils/static_analysis.py +167 -0
  50. codeflash-0.18.5/codeflash/code_utils/tabulate.py +915 -0
  51. codeflash-0.18.5/codeflash/code_utils/time_utils.py +86 -0
  52. codeflash-0.18.5/codeflash/code_utils/version_check.py +77 -0
  53. codeflash-0.18.5/codeflash/context/__init__.py +0 -0
  54. codeflash-0.18.5/codeflash/context/code_context_extractor.py +899 -0
  55. codeflash-0.18.5/codeflash/context/unused_definition_remover.py +752 -0
  56. codeflash-0.18.5/codeflash/discovery/__init__.py +0 -0
  57. codeflash-0.18.5/codeflash/discovery/discover_unit_tests.py +930 -0
  58. codeflash-0.18.5/codeflash/discovery/functions_to_optimize.py +727 -0
  59. codeflash-0.18.5/codeflash/discovery/pytest_new_process_discovery.py +61 -0
  60. codeflash-0.18.5/codeflash/either.py +41 -0
  61. codeflash-0.18.5/codeflash/github/PrComment.py +48 -0
  62. codeflash-0.18.5/codeflash/github/__init__.py +0 -0
  63. codeflash-0.18.5/codeflash/lsp/__init__.py +0 -0
  64. codeflash-0.18.5/codeflash/lsp/beta.py +549 -0
  65. codeflash-0.18.5/codeflash/lsp/context.py +9 -0
  66. codeflash-0.18.5/codeflash/lsp/features/__init__.py +0 -0
  67. codeflash-0.18.5/codeflash/lsp/features/perform_optimization.py +137 -0
  68. codeflash-0.18.5/codeflash/lsp/helpers.py +61 -0
  69. codeflash-0.18.5/codeflash/lsp/lsp_logger.py +153 -0
  70. codeflash-0.18.5/codeflash/lsp/lsp_message.py +110 -0
  71. codeflash-0.18.5/codeflash/lsp/server.py +86 -0
  72. codeflash-0.18.5/codeflash/lsp/server_entry.py +19 -0
  73. codeflash-0.18.5/codeflash/main.py +61 -0
  74. codeflash-0.18.5/codeflash/models/ExperimentMetadata.py +10 -0
  75. codeflash-0.18.5/codeflash/models/__init__.py +0 -0
  76. codeflash-0.18.5/codeflash/models/models.py +732 -0
  77. codeflash-0.18.5/codeflash/models/test_type.py +22 -0
  78. codeflash-0.18.5/codeflash/optimization/__init__.py +0 -0
  79. codeflash-0.18.5/codeflash/optimization/function_context.py +46 -0
  80. codeflash-0.18.5/codeflash/optimization/function_optimizer.py +2104 -0
  81. codeflash-0.18.5/codeflash/optimization/optimizer.py +503 -0
  82. codeflash-0.18.5/codeflash/picklepatch/__init__.py +0 -0
  83. codeflash-0.18.5/codeflash/picklepatch/pickle_patcher.py +370 -0
  84. codeflash-0.18.5/codeflash/picklepatch/pickle_placeholder.py +73 -0
  85. codeflash-0.18.5/codeflash/result/__init__.py +0 -0
  86. codeflash-0.18.5/codeflash/result/create_pr.py +291 -0
  87. codeflash-0.18.5/codeflash/result/critic.py +119 -0
  88. codeflash-0.18.5/codeflash/result/explanation.py +151 -0
  89. codeflash-0.18.5/codeflash/telemetry/__init__.py +0 -0
  90. codeflash-0.18.5/codeflash/telemetry/posthog_cf.py +46 -0
  91. codeflash-0.18.5/codeflash/telemetry/sentry.py +27 -0
  92. codeflash-0.18.5/codeflash/tracer.py +239 -0
  93. codeflash-0.18.5/codeflash/tracing/__init__.py +1 -0
  94. codeflash-0.18.5/codeflash/tracing/profile_stats.py +92 -0
  95. codeflash-0.18.5/codeflash/tracing/pytest_parallelization.py +84 -0
  96. codeflash-0.18.5/codeflash/tracing/replay_test.py +175 -0
  97. codeflash-0.18.5/codeflash/tracing/tracing_new_process.py +869 -0
  98. codeflash-0.18.5/codeflash/tracing/tracing_utils.py +72 -0
  99. codeflash-0.18.5/codeflash/update_license_version.py +49 -0
  100. codeflash-0.18.5/codeflash/verification/__init__.py +0 -0
  101. codeflash-0.18.5/codeflash/verification/codeflash_capture.py +168 -0
  102. codeflash-0.18.5/codeflash/verification/comparator.py +300 -0
  103. codeflash-0.18.5/codeflash/verification/concolic_testing.py +100 -0
  104. codeflash-0.18.5/codeflash/verification/coverage_utils.py +232 -0
  105. codeflash-0.18.5/codeflash/verification/equivalence.py +84 -0
  106. codeflash-0.18.5/codeflash/verification/instrument_codeflash_capture.py +192 -0
  107. codeflash-0.18.5/codeflash/verification/parse_line_profile_test_output.py +91 -0
  108. codeflash-0.18.5/codeflash/verification/parse_test_output.py +575 -0
  109. codeflash-0.18.5/codeflash/verification/pytest_plugin.py +475 -0
  110. codeflash-0.18.5/codeflash/verification/test_runner.py +309 -0
  111. codeflash-0.18.5/codeflash/verification/verification_utils.py +79 -0
  112. codeflash-0.18.5/codeflash/verification/verifier.py +88 -0
  113. codeflash-0.18.5/codeflash/version.py +2 -0
  114. codeflash-0.18.5/pyproject.toml +331 -0
@@ -0,0 +1,257 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ **/__pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ cli/dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+ *.pyc
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ # For a library or package, you might want to ignore these files since the code is
89
+ # intended to run in multiple environments; otherwise, check them in:
90
+ # .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # poetry
100
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
102
+ # commonly ignored for libraries.
103
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104
+ #poetry.lock
105
+
106
+ # pdm
107
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108
+ #pdm.lock
109
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110
+ # in version control.
111
+ # https://pdm.fming.dev/#use-with-ide
112
+ .pdm.toml
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ **/.env
127
+ .venv
128
+ env/
129
+ venv/
130
+ ENV/
131
+ env.bak/
132
+ venv.bak/
133
+
134
+ # Spyder project settings
135
+ .spyderproject
136
+ .spyproject
137
+
138
+ # Rope project settings
139
+ .ropeproject
140
+
141
+ # mkdocs documentation
142
+ /site
143
+
144
+ # mypy
145
+ .mypy_cache/
146
+ .dmypy.json
147
+ dmypy.json
148
+
149
+ # Pyre type checker
150
+ .pyre/
151
+
152
+ # pytype static type analyzer
153
+ .pytype/
154
+
155
+ # Cython debug symbols
156
+ cython_debug/
157
+
158
+ # PyCharm
159
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
160
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
161
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
162
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
163
+ #.idea/
164
+ .aider*
165
+ /js/common/node_modules/
166
+ /node_modules/
167
+ *.xml
168
+ *.pem
169
+
170
+ # Ruff cache
171
+ .ruff_cache/
172
+
173
+ # IDE settings
174
+ .idea/
175
+ .vscode/
176
+
177
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
178
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
179
+
180
+ # User-specific stuff
181
+ .idea/**/workspace.xml
182
+ .idea/**/tasks.xml
183
+ .idea/**/usage.statistics.xml
184
+ .idea/**/dictionaries
185
+ .idea/**/shelf
186
+
187
+ # AWS User-specific
188
+ .idea/**/aws.xml
189
+
190
+ # Generated files
191
+ .idea/**/contentModel.xml
192
+
193
+ # Sensitive or high-churn files
194
+ .idea/**/dataSources/
195
+ .idea/**/dataSources.ids
196
+ .idea/**/dataSources.local.xml
197
+ .idea/**/sqlDataSources.xml
198
+ .idea/**/dynamic.xml
199
+ .idea/**/uiDesigner.xml
200
+ .idea/**/dbnavigator.xml
201
+
202
+ # Gradle
203
+ .idea/**/gradle.xml
204
+ .idea/**/libraries
205
+
206
+ # Gradle and Maven with auto-import
207
+ # When using Gradle or Maven with auto-import, you should exclude module files,
208
+ # since they will be recreated, and may cause churn. Uncomment if using
209
+ # auto-import.
210
+ # .idea/artifacts
211
+ # .idea/compiler.xml
212
+ # .idea/jarRepositories.xml
213
+ # .idea/modules.xml
214
+ # .idea/*.iml
215
+ # .idea/modules
216
+ # *.iml
217
+ # *.ipr
218
+
219
+ # CMake
220
+ cmake-build-*/
221
+
222
+ # Mongo Explorer plugin
223
+ .idea/**/mongoSettings.xml
224
+
225
+ # File-based project format
226
+ *.iws
227
+
228
+ # IntelliJ
229
+ out/
230
+
231
+ # mpeltonen/sbt-idea plugin
232
+ .idea_modules/
233
+
234
+ # JIRA plugin
235
+ atlassian-ide-plugin.xml
236
+
237
+ # Cursive Clojure plugin
238
+ .idea/replstate.xml
239
+
240
+ # SonarLint plugin
241
+ .idea/sonarlint/
242
+
243
+ # Crashlytics plugin (for Android Studio and IntelliJ)
244
+ com_crashlytics_export_strings.xml
245
+ crashlytics.properties
246
+ crashlytics-build.properties
247
+ fabric.properties
248
+
249
+ # Editor-based Rest Client
250
+ .idea/httpRequests
251
+
252
+ # Android studio 3.1+ serialized cache file
253
+ .idea/caches/build_file_checksums.ser
254
+
255
+ # Mac
256
+ .DS_Store
257
+ WARP.MD
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: codeflash
3
+ Version: 0.18.5
4
+ Summary: Client for codeflash.ai - automatic code performance optimization, powered by AI
5
+ Project-URL: Homepage, https://codeflash.ai
6
+ Author-email: "CodeFlash Inc." <contact@codeflash.ai>
7
+ License: BSL-1.1
8
+ Keywords: LLM,ai,code,codeflash,machine learning,optimization,performance
9
+ Requires-Python: >=3.9
10
+ Requires-Dist: click>=8.1.0
11
+ Requires-Dist: codeflash-benchmark
12
+ Requires-Dist: coverage>=7.6.4
13
+ Requires-Dist: crosshair-tool>=0.0.78
14
+ Requires-Dist: dill>=0.3.8
15
+ Requires-Dist: filelock
16
+ Requires-Dist: gitpython>=3.1.31
17
+ Requires-Dist: humanize>=4.0.0
18
+ Requires-Dist: inquirer>=3.0.0
19
+ Requires-Dist: isort>=5.11.0
20
+ Requires-Dist: jedi>=0.19.1
21
+ Requires-Dist: junitparser>=3.1.0
22
+ Requires-Dist: libcst>=1.0.1
23
+ Requires-Dist: line-profiler>=4.2.0
24
+ Requires-Dist: lxml>=5.3.0
25
+ Requires-Dist: parameterized>=0.9.0
26
+ Requires-Dist: platformdirs>=4.3.7
27
+ Requires-Dist: posthog>=3.0.0
28
+ Requires-Dist: pydantic>=1.10.1
29
+ Requires-Dist: pygls<3.0.0,>=2.0.0
30
+ Requires-Dist: pytest-timeout>=2.1.0
31
+ Requires-Dist: pytest>=7.0.0
32
+ Requires-Dist: rich>=13.8.1
33
+ Requires-Dist: sentry-sdk<3.0.0,>=1.40.6
34
+ Requires-Dist: timeout-decorator>=0.5.0
35
+ Requires-Dist: tomlkit>=0.11.7
36
+ Requires-Dist: unidiff>=0.7.4
37
+ Requires-Dist: unittest-xml-reporting>=3.2.0
38
+ Provides-Extra: asyncio
39
+ Requires-Dist: pytest-asyncio>=1.2.0; extra == 'asyncio'
40
+ Description-Content-Type: text/markdown
41
+
42
+ ![Codeflash-banner](https://i.postimg.cc/GmPRC52t/Codeflash-banner.png)
43
+ <p align="center">
44
+ <a href="https://github.com/codeflash-ai/codeflash">
45
+ <img src="https://img.shields.io/github/commit-activity/m/codeflash-ai/codeflash" alt="GitHub commit activity">
46
+ </a>
47
+ <a href="https://pypi.org/project/codeflash/"><img src="https://static.pepy.tech/badge/codeflash" alt="PyPI Downloads"></a>
48
+ <a href="https://pypi.org/project/codeflash/">
49
+ <img src="https://img.shields.io/pypi/v/codeflash?label=PyPI%20version" alt="PyPI Downloads">
50
+ </a>
51
+ </p>
52
+
53
+ [Codeflash](https://www.codeflash.ai) is a general purpose optimizer for Python that helps you improve the performance of your Python code while maintaining its correctness.
54
+ It uses advanced LLMs to generate multiple optimization ideas for your code, tests them to be correct and benchmarks them for performance. It then creates merge-ready pull requests containing the best optimization found, which you can review and merge.
55
+
56
+ How to use Codeflash -
57
+ - Optimize an entire existing codebase by running `codeflash --all`
58
+ - Automate optimizing all __future__ code you will write by installing Codeflash as a GitHub action.
59
+ - Optimize a Python workflow `python myscript.py` end-to-end by running `codeflash optimize myscript.py`
60
+
61
+ Codeflash is used by top engineering teams at **Pydantic** [(PRs Merged)](https://github.com/pydantic/pydantic/pulls?q=is%3Apr+author%3Amisrasaurabh1+is%3Amerged), **Roboflow** [(PRs Merged 1](https://github.com/roboflow/inference/issues?q=state%3Aclosed%20is%3Apr%20author%3Amisrasaurabh1%20is%3Amerged), [PRs Merged 2)](https://github.com/roboflow/inference/issues?q=state%3Amerged%20is%3Apr%20author%3Acodeflash-ai%5Bbot%5D), **Unstructured** [(PRs Merged 1](https://github.com/Unstructured-IO/unstructured/pulls?q=is%3Apr+Explanation+and+details+in%3Abody+is%3Amerged), [PRs Merged 2)](https://github.com/Unstructured-IO/unstructured-ingest/pulls?q=is%3Apr+Explanation+and+details+in%3Abody+is%3Amerged), **Langflow** [(PRs Merged)](https://github.com/langflow-ai/langflow/issues?q=state%3Aclosed%20is%3Apr%20author%3Amisrasaurabh1) and many others to ship performant, expert level code.
62
+
63
+ Codeflash is great at optimizing AI Agents, Computer Vision algorithms, PyTorch code, numerical code, backend code or anything else you might write with Python.
64
+
65
+
66
+ ## Installation
67
+
68
+ To install Codeflash, run:
69
+
70
+ ```
71
+ pip install codeflash
72
+ ```
73
+ Add codeflash as a development time dependency if you are using package managers like uv or poetry.
74
+ ## Quick Start
75
+
76
+
77
+ 1. To configure Codeflash for a project, at the root directory of your project where the pyproject.toml file is located, run:
78
+ ```
79
+ codeflash init
80
+ ```
81
+ - It will ask you a few questions about your project like the location of your code and tests
82
+ - Ask you to generate an [API Key](https://app.codeflash.ai/app/apikeys) to access Codeflash's LLMs
83
+ - Install a [GitHub app](https://github.com/apps/codeflash-ai/installations/select_target) to open Pull Requests on GitHub.
84
+ - Ask if you want to setup a GitHub actions which will optimize all your future code.
85
+ - The codeflash config is then saved in the pyproject.toml file.
86
+
87
+ 2. Optimize your entire codebase:
88
+ ```
89
+ codeflash --all
90
+ ```
91
+ This can take a while to run for a large codebase, but it will keep opening PRs as it finds optimizations.
92
+ 3. Optimize a script:
93
+ ```
94
+ codeflash optimize myscript.py
95
+ ```
96
+
97
+ ## Documentation
98
+ For detailed installation and usage instructions, visit our documentation at [docs.codeflash.ai](https://docs.codeflash.ai)
99
+
100
+ ## Demo
101
+
102
+
103
+ - Optimizing the performance of new code for a Pull Request through GitHub Actions. This lets you ship code quickly while ensuring it remains performant.
104
+
105
+ https://github.com/user-attachments/assets/38f44f4e-be1c-4f84-8db9-63d5ee3e61e5
106
+
107
+ - Optiming a workflow end to end automatically with `codeflash optimize`
108
+
109
+
110
+ https://github.com/user-attachments/assets/355ba295-eb5a-453a-8968-7fb35c70d16c
111
+
112
+
113
+
114
+ ## Support
115
+
116
+ Join our community for support and discussions. If you have any questions, feel free to reach out to us using one of the following methods:
117
+
118
+ - [Free live Installation Support](https://calendly.com/codeflash-saurabh/codeflash-setup)
119
+ - [Join our Discord](https://www.codeflash.ai/discord)
120
+ - [Follow us on Twitter](https://x.com/codeflashAI)
121
+ - [Follow us on Linkedin](https://www.linkedin.com/in/saurabh-misra/)
122
+
123
+ ## License
124
+
125
+ Codeflash is licensed under the BSL-1.1 License. See the [LICENSE](https://github.com/codeflash-ai/codeflash/blob/main/codeflash/LICENSE) file for details.
@@ -0,0 +1,84 @@
1
+ ![Codeflash-banner](https://i.postimg.cc/GmPRC52t/Codeflash-banner.png)
2
+ <p align="center">
3
+ <a href="https://github.com/codeflash-ai/codeflash">
4
+ <img src="https://img.shields.io/github/commit-activity/m/codeflash-ai/codeflash" alt="GitHub commit activity">
5
+ </a>
6
+ <a href="https://pypi.org/project/codeflash/"><img src="https://static.pepy.tech/badge/codeflash" alt="PyPI Downloads"></a>
7
+ <a href="https://pypi.org/project/codeflash/">
8
+ <img src="https://img.shields.io/pypi/v/codeflash?label=PyPI%20version" alt="PyPI Downloads">
9
+ </a>
10
+ </p>
11
+
12
+ [Codeflash](https://www.codeflash.ai) is a general purpose optimizer for Python that helps you improve the performance of your Python code while maintaining its correctness.
13
+ It uses advanced LLMs to generate multiple optimization ideas for your code, tests them to be correct and benchmarks them for performance. It then creates merge-ready pull requests containing the best optimization found, which you can review and merge.
14
+
15
+ How to use Codeflash -
16
+ - Optimize an entire existing codebase by running `codeflash --all`
17
+ - Automate optimizing all __future__ code you will write by installing Codeflash as a GitHub action.
18
+ - Optimize a Python workflow `python myscript.py` end-to-end by running `codeflash optimize myscript.py`
19
+
20
+ Codeflash is used by top engineering teams at **Pydantic** [(PRs Merged)](https://github.com/pydantic/pydantic/pulls?q=is%3Apr+author%3Amisrasaurabh1+is%3Amerged), **Roboflow** [(PRs Merged 1](https://github.com/roboflow/inference/issues?q=state%3Aclosed%20is%3Apr%20author%3Amisrasaurabh1%20is%3Amerged), [PRs Merged 2)](https://github.com/roboflow/inference/issues?q=state%3Amerged%20is%3Apr%20author%3Acodeflash-ai%5Bbot%5D), **Unstructured** [(PRs Merged 1](https://github.com/Unstructured-IO/unstructured/pulls?q=is%3Apr+Explanation+and+details+in%3Abody+is%3Amerged), [PRs Merged 2)](https://github.com/Unstructured-IO/unstructured-ingest/pulls?q=is%3Apr+Explanation+and+details+in%3Abody+is%3Amerged), **Langflow** [(PRs Merged)](https://github.com/langflow-ai/langflow/issues?q=state%3Aclosed%20is%3Apr%20author%3Amisrasaurabh1) and many others to ship performant, expert level code.
21
+
22
+ Codeflash is great at optimizing AI Agents, Computer Vision algorithms, PyTorch code, numerical code, backend code or anything else you might write with Python.
23
+
24
+
25
+ ## Installation
26
+
27
+ To install Codeflash, run:
28
+
29
+ ```
30
+ pip install codeflash
31
+ ```
32
+ Add codeflash as a development time dependency if you are using package managers like uv or poetry.
33
+ ## Quick Start
34
+
35
+
36
+ 1. To configure Codeflash for a project, at the root directory of your project where the pyproject.toml file is located, run:
37
+ ```
38
+ codeflash init
39
+ ```
40
+ - It will ask you a few questions about your project like the location of your code and tests
41
+ - Ask you to generate an [API Key](https://app.codeflash.ai/app/apikeys) to access Codeflash's LLMs
42
+ - Install a [GitHub app](https://github.com/apps/codeflash-ai/installations/select_target) to open Pull Requests on GitHub.
43
+ - Ask if you want to setup a GitHub actions which will optimize all your future code.
44
+ - The codeflash config is then saved in the pyproject.toml file.
45
+
46
+ 2. Optimize your entire codebase:
47
+ ```
48
+ codeflash --all
49
+ ```
50
+ This can take a while to run for a large codebase, but it will keep opening PRs as it finds optimizations.
51
+ 3. Optimize a script:
52
+ ```
53
+ codeflash optimize myscript.py
54
+ ```
55
+
56
+ ## Documentation
57
+ For detailed installation and usage instructions, visit our documentation at [docs.codeflash.ai](https://docs.codeflash.ai)
58
+
59
+ ## Demo
60
+
61
+
62
+ - Optimizing the performance of new code for a Pull Request through GitHub Actions. This lets you ship code quickly while ensuring it remains performant.
63
+
64
+ https://github.com/user-attachments/assets/38f44f4e-be1c-4f84-8db9-63d5ee3e61e5
65
+
66
+ - Optiming a workflow end to end automatically with `codeflash optimize`
67
+
68
+
69
+ https://github.com/user-attachments/assets/355ba295-eb5a-453a-8968-7fb35c70d16c
70
+
71
+
72
+
73
+ ## Support
74
+
75
+ Join our community for support and discussions. If you have any questions, feel free to reach out to us using one of the following methods:
76
+
77
+ - [Free live Installation Support](https://calendly.com/codeflash-saurabh/codeflash-setup)
78
+ - [Join our Discord](https://www.codeflash.ai/discord)
79
+ - [Follow us on Twitter](https://x.com/codeflashAI)
80
+ - [Follow us on Linkedin](https://www.linkedin.com/in/saurabh-misra/)
81
+
82
+ ## License
83
+
84
+ Codeflash is licensed under the BSL-1.1 License. See the [LICENSE](https://github.com/codeflash-ai/codeflash/blob/main/codeflash/LICENSE) file for details.
@@ -0,0 +1,98 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: CodeFlash Inc.
6
+ Licensed Work: Codeflash Client version 0.18.x
7
+ The Licensed Work is (c) 2024 CodeFlash Inc.
8
+
9
+ Additional Use Grant: None. Production use of the Licensed Work is only permitted
10
+ if you have entered into a separate written agreement
11
+ with CodeFlash Inc. for production use in connection
12
+ with a subscription to CodeFlash's Code Optimization
13
+ Platform. Please visit codeflash.ai for further
14
+ information.
15
+
16
+ Change Date: 2029-10-21
17
+
18
+ Change License: MIT
19
+
20
+ Notice
21
+
22
+ The Business Source License (this document, or the “License”) is not an Open
23
+ Source license. However, the Licensed Work will eventually be made available
24
+ under an Open Source License, as stated in this License.
25
+
26
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
27
+ “Business Source License” is a trademark of MariaDB Corporation Ab.
28
+
29
+ -----------------------------------------------------------------------------
30
+
31
+ Business Source License 1.1
32
+
33
+ Terms
34
+
35
+ The Licensor hereby grants you the right to copy, modify, create derivative
36
+ works, redistribute, and make non-production use of the Licensed Work. The
37
+ Licensor may make an Additional Use Grant, above, permitting limited
38
+ production use.
39
+
40
+ Effective on the Change Date, or the fourth anniversary of the first publicly
41
+ available distribution of a specific version of the Licensed Work under this
42
+ License, whichever comes first, the Licensor hereby grants you rights under
43
+ the terms of the Change License, and the rights granted in the paragraph
44
+ above terminate.
45
+
46
+ If your use of the Licensed Work does not comply with the requirements
47
+ currently in effect as described in this License, you must purchase a
48
+ commercial license from the Licensor, its affiliated entities, or authorized
49
+ resellers, or you must refrain from using the Licensed Work.
50
+
51
+ All copies of the original and modified Licensed Work, and derivative works
52
+ of the Licensed Work, are subject to this License. This License applies
53
+ separately for each version of the Licensed Work and the Change Date may vary
54
+ for each version of the Licensed Work released by Licensor.
55
+
56
+ You must conspicuously display this License on each original or modified copy
57
+ of the Licensed Work. If you receive the Licensed Work in original or
58
+ modified form from a third party, the terms and conditions set forth in this
59
+ License apply to your use of that work.
60
+
61
+ Any use of the Licensed Work in violation of this License will automatically
62
+ terminate your rights under this License for the current and all other
63
+ versions of the Licensed Work.
64
+
65
+ This License does not grant you any right in any trademark or logo of
66
+ Licensor or its affiliates (provided that you may use a trademark or logo of
67
+ Licensor as expressly required by this License).
68
+
69
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
70
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
71
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
72
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
73
+ TITLE.
74
+
75
+ MariaDB hereby grants you permission to use this License’s text to license
76
+ your works, and to refer to it using the trademark “Business Source License”,
77
+ as long as you comply with the Covenants of Licensor below.
78
+
79
+ Covenants of Licensor
80
+
81
+ In consideration of the right to use this License’s text and the “Business
82
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
83
+ other recipients of the licensed work to be provided by Licensor:
84
+
85
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
86
+ or a license that is compatible with GPL Version 2.0 or a later version,
87
+ where “compatible” means that software provided under the Change License can
88
+ be included in a program with software provided under GPL Version 2.0 or a
89
+ later version. Licensor may specify additional Change Licenses without
90
+ limitation.
91
+
92
+ 2. To either: (a) specify an additional grant of rights to use that does not
93
+ impose any additional restriction on the right granted in this License, as
94
+ the Additional Use Grant; or (b) insert the text “None”.
95
+
96
+ 3. To specify a Change Date.
97
+
98
+ 4. Not to modify this License in any other way.
File without changes
File without changes