r/Python • u/williamsweep • Oct 18 '23
Intermediate Showcase Sweep - Python AI Assistant for automatically adding Typehints and Pytest Unit Tests
Hi r/Python,
Sweep is an AI Assistant written in Python, and specialized for Python.We automatically handle simple fixes such as adding unit tests, typehints, and fixing leftover TODOs. You can go about your normal workflow (creating or merging PRs) and Sweep will automatically create PRs that clean up after you!
Here's a demo:https://www.youtube.com/watch?v=dUN9Lx3vlv0
Here's our source code (licensed under ELv2 so it's commercially viable). https://github.com/sweepai/sweep. You can deploy it yourself or use our hosted version.
We do a couple of things differently from other projects.
As far as we know, Sweep is the only project that actually runs your code and fixes it. We setup a sandbox that runs pytest, pylint, black, or any other test suite you'd like.
Sweep has way better retrieval. We use the Python AST, CST, lexical (keyword search), and semantic search to properly fetch the code. This takes a while, but it's alright because we run asynchronously from your workflow. https://docs.sweep.dev/blogs/ai-code-planning
Sweep allows you to comment on PRs to make any small tweaks to the original change from the bot.
Thank you for the support, and we're looking forward to answering any questions you have!
7
u/[deleted] Oct 18 '23
Just so I understand, you're essentially just passing people's code into ChatGPT but with some extra text asking ChatGPT to handle things like typehints and then you return the code back to the user?