FuncLoom
The Python functionizer: turn long scripts, snippets and notebooks into verified functions and modular packages.
pip install funcloom
funcloom modularize analysis.ipynb --output analysis_pkga package with config, step functions, a Pipeline class and main.pyfuncloom modularize project/ --output project_pkga whole folder converted, with an orchestratorfuncloom refine script.py --output refinedlong functions split and long lines wrapped, in a copyfuncloom check srcfindings against the function-size, docstring and annotation profileWhat it does
Notebooks to packages
Cells become steps; FuncLoom writes a package with configuration, step functions, a Pipeline class and main.py.
Long functions split
Functions over the size limit are split into helpers with explicit inputs and outputs, including loop, if and with bodies.
Verified, not guessed
Generated code must compile, keep the original statements and resolve its names; otherwise FuncLoom refuses and says why.
Originals untouched
Output always goes to a new folder; nothing is overwritten.
Readable names
Snippets get questions about unclear names and mathematical or domain variables, never silent guesses.
Works with your tools
CLI, Python API, VS Code extension and a pre-commit hook; no AI model or network needed.
Who it is for
Data scientists
turn an exploratory notebook into code a team can test and ship.
Developers
break up long scripts and functions without changing behaviour.
Students
hand in coursework as clean, structured modules.
Teams
standardise function size, docstrings and structure across a codebase.
Questions
How do I convert a Jupyter notebook into a Python package?
Run funcloom modularize notebook.ipynb --output my_pkg. FuncLoom writes config, step functions, a Pipeline class and main.py, and checks that the package reproduces the notebook's statements.
Can it split a long Python function automatically?
Yes: funcloom refine script.py --output refined splits functions over the limit (default 50 lines) into verified helpers.
Does it change my original files?
No. Output always goes to a new, empty folder.
Does it run my code?
No. FuncLoom analyses the syntax tree and never imports or executes your code.
Is it free?
Yes, MIT-licensed and on PyPI.
One family of tools
FuncLoom
the functionizer: scripts and notebooks to functions and packages
RefacTrail
the refactorizer: linter, formatter and verified refactoring
FlowBlueprint
the architect: code to architecture diagrams