{"id":13576763,"url":"https://github.com/bsilverthorn/maccarone","last_synced_at":"2026-01-14T09:50:21.029Z","repository":{"id":167414498,"uuid":"643035818","full_name":"bsilverthorn/maccarone","owner":"bsilverthorn","description":"AI-managed code blocks in Python ⏪⏩","archived":false,"fork":false,"pushed_at":"2023-10-05T04:17:54.000Z","size":109,"stargazers_count":468,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-12-14T10:18:40.726Z","etag":null,"topics":["generative-ai","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsilverthorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-19T23:38:20.000Z","updated_at":"2025-08-18T14:24:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd91d856-94d7-4968-b068-5e12ebc820b8","html_url":"https://github.com/bsilverthorn/maccarone","commit_stats":null,"previous_names":["bsilverthorn/maccarone"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/bsilverthorn/maccarone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsilverthorn%2Fmaccarone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsilverthorn%2Fmaccarone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsilverthorn%2Fmaccarone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsilverthorn%2Fmaccarone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsilverthorn","download_url":"https://codeload.github.com/bsilverthorn/maccarone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsilverthorn%2Fmaccarone/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generative-ai","python"],"created_at":"2024-08-01T15:01:13.720Z","updated_at":"2026-01-14T09:50:21.014Z","avatar_url":"https://github.com/bsilverthorn.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Maccarone: AI-managed code blocks in Python ⏪⏩\n===============================================\n\n[![PyPI version](https://badge.fury.io/py/maccarone.svg)](https://badge.fury.io/py/maccarone)\n\nMaccarone lets you [_delegate_](https://silverthorn.blog/posts/2023-08-llm-assisted-programming-maccarone/) sections of your Python program to AI ownership.\n\nHere's what it looks like in [the VS Code extension](https://marketplace.visualstudio.com/items?itemName=maccarone.maccarone):\n\n![screencap-20230629](https://github.com/bsilverthorn/maccarone/assets/92956/c1549168-28ad-49ef-bcff-dd232838220c)\n\nExample\n-------\n\nYou might write some code like this:\n\n```python\ndef main(path: str):\n    #\u003c\u003cfilenames = a list of filenames under path\u003e\u003e\n\n    for fn in filenames:\n        #\u003c\u003csize = size of fn in bytes\u003e\u003e\n\n        print(fn, size)\n\n#\u003c\u003cuse argparse and call main\u003e\u003e\n```\n\nMaccarone then fills in the sections you've delegated:\n\n```python\ndef main(path: str):\n    #\u003c\u003cfilenames = list of filenames under path; no dirs\u003e\u003e\n    import os\n    filenames = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]\n    #\u003c\u003c/\u003e\u003e\n\n    for fn in filenames:\n        #\u003c\u003csize = size of fn in bytes\u003e\u003e\n        size = os.path.getsize(os.path.join(path, fn))\n        #\u003c\u003c/\u003e\u003e\n        print(fn, size)\n\n#\u003c\u003cuse argparse and call main\u003e\u003e\nimport argparse\nparser = argparse.ArgumentParser()\nparser.add_argument(\"path\", type=str)\nargs = parser.parse_args()\nmain(args.path)\n#\u003c\u003c/\u003e\u003e\n```\n\nMake a change in your code, like adding an `extension` parameter to `main`, and Maccarone keeps its sections up to date:\n\n```python\ndef main(path: str, extension: str | None = None):\n    #\u003c\u003cfilenames = list of filenames under path; no dirs\u003e\u003e\n    …\n    if extension:\n        filenames = [f for f in filenames if f.endswith(extension)]\n    #\u003c\u003c/\u003e\u003e\n    …\n\n#\u003c\u003cuse argparse and call main\u003e\u003e\n…\nparser.add_argument(\"--extension\", type=str, default=None)\nargs = parser.parse_args()\nmain(args.path, args.extension)\n#\u003c\u003c/\u003e\u003e\n```\n\nQuickstart\n----------\n\n### Prerequisites\n\n- Python 3.8+\n- OpenAI API key with GPT-4 (`export OPENAI_API_KEY`)\n\n### Easy Mode - VS Code Extension\n\nEasy mode is the free extension from [the VS Code marketplace](https://marketplace.visualstudio.com/items?itemName=maccarone.maccarone).\n\nInstall it in VS Code and you're done (if you have the prerequisites above).\n\n### Other Option - Command Line\n\nIf you don't use VS Code, you can still install Maccarone directly from PyPI:\n\n- `pip install maccarone`\n\nThen run `maccarone` to generate code and update your source file:\n\n```console\n$ maccarone --rewrite examples/file_sizes.py\n```\n\nUsage notes\n-----------\n\n### Running `maccarone` on a directory\n\nMaccarone can rewrite all files in a directory:\n\n```console\n$ maccarone --rewrite --suffix .py examples/\n```\n\nBe careful! You should probably run this only on files in source control, for example.\n\nRelated work\n------------\n\n- https://github.com/bsilverthorn/vernac\n\nFAQs\n----\n\n### It needs my OpenAI API key?\n\nMaccarone prompts GPT-4 to write code. It will make OpenAI API calls using your key and you **will be charged** by OpenAI.\n\nAPI calls are made every time Maccarone preprocesses a new version of a source file.\n\nThe number of tokens consumed is proportional to the size of your completed code. You cannot accurately predict that number in advance. A small source module might cost $0.01–0.10 to preprocess.\n\n### What prevents my program from behaving differently after each preprocessing run?\n\nThe strength of your faith in GPT-4.\n\n### What about non-English languages?\n\nThey are likely to work, but less likely than English.\n\n### What does \"maccarone\" mean?\n\nhttps://en.wikipedia.org/wiki/Macaronic_language\n\n### Is this project active?\n\nYes and no. It was created to evaluate a specific flavor of LLM-assisted programming. It feels feature-complete for that purpose.\n\nPRs and bug reports are welcome, however, and there may be future maintenance releases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsilverthorn%2Fmaccarone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsilverthorn%2Fmaccarone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsilverthorn%2Fmaccarone/lists"}