unstructured/pyproject.toml
Saurabh Misra e3854d279f
Setup Codeflash Github Actions to optimize all future code (#4082)
- This Pull Request sets up the `codeflash.yml` file which will run on
every new Pull Request that modifies the source code for `unstructured`
directory.
- We setup the codeflash config in the pyproject.toml file. This defines
basic project config for codeflash.
- The workflow uses uv to install the CI dependencies faster than your
current caching solution. Speed is useful to get quicker optimizations.
- Please take a look at the requirements that are being installed. Feel
free to add more to the install list. Codeflash tries to execute code
and if it is missing a dependency needed to make something run, it will
fail to optimize.
- Codeflash is being installed everytime in the CI. This helps the
workflow always use the latest version of codeflash as it improves
rapidly. Feel free to add codeflash to dev dependency as well, since we
are about to release more local optimization tools like VS Code and
claude code extensions.
- Feel free to modify this Github action anyway you want

**Actions Required to make this work-**

- Install the Codeflash Github app from [this
link](https://github.com/apps/codeflash-ai/installations/select_target)
to this repo. This is required for our github-bot to comment and create
suggestions on the github repo.
- Create a new `CODEFLASH_API_KEY` after signing up to [Codeflash from
our website](https://www.codeflash.ai/). The onboarding will ask you to
create an API Key and show instructions on how to save the api key on
your repo secrets.

Then, after this PR is merged in it will start generating new
optimizations 🎉

---------

Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
Co-authored-by: cragwolfe <cragcw@gmail.com>
2025-09-02 20:15:29 +00:00

66 lines
2.0 KiB
TOML

[tool.black]
line-length = 100
exclude = '''
/(
\.venv # Ignore virtual environment directory
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.nox
| \.env
| \.pytest_cache
| \.venv
| _build
| buck-out
| build
| dist
| unstructured/nlp/patterns\.py
)/|
unstructured/nlp/patterns\.py
'''
[tool.pyright]
pythonPlatform = "Linux"
pythonVersion = "3.10"
reportUnnecessaryCast = true
reportUnnecessaryTypeIgnoreComment = true
stubPath = "./typings"
typeCheckingMode = "strict"
verboseOutput = true
[tool.ruff]
line-length = 100
target-version = "py310"
[tool.ruff.lint]
ignore = [
"COM812", # -- over aggressively insists on trailing commas where not desireable --
"PT001", # -- wants empty parens on @pytest.fixture where not used (essentially always) --
"PT011", # -- pytest.raises({exc}) too broad, use match param or more specific exception --
"PT012", # -- pytest.raises() block should contain a single simple statement --
"SIM117", # -- merge `with` statements for context managers that have same scope --
]
select = [
"C4", # -- flake8-comprehensions --
"COM", # -- flake8-commas --
"E", # -- pycodestyle errors --
"F", # -- pyflakes --
"I", # -- isort (imports) --
"PLR0402", # -- Name compared with itself like `foo == foo` --
"PT", # -- flake8-pytest-style --
"SIM", # -- flake8-simplify --
"UP015", # -- redundant `open()` mode parameter (like "r" is default) --
"UP018", # -- Unnecessary {literal_type} call like `str("abc")`. (rewrite as a literal) --
"UP032", # -- Use f-string instead of `.format()` call --
"UP034", # -- Avoid extraneous parentheses --
"W", # -- Warnings, including invalid escape-sequence --
]
[tool.codeflash]
module-root = "unstructured"
tests-root = "test_unstructured"
test-framework = "pytest"
ignore-paths = []
formatter-cmds = ["ruff check --exit-zero --fix-only $file", "autoflake --in-place $file", "black --line-length=100 $file"]