groovy
A small Python library created to help developers protect their applications from Server Side Request Forgery (SSRF) attacks.
What it is and what it does
Groovy is a Python-to-JavaScript transpiler designed to convert Python functions into equivalent JavaScript code that runs client-side. It was built for use in Gradio, enabling developers to write Python functions that execute in the browser as fast JavaScript without rewriting in a different language. The transpiler takes a conservative approach: it supports a subset of Python syntax (basic arithmetic, control flow, list comprehensions, and some standard library functions) and requires type hints on function parameters to avoid ambiguity. When it encounters unsupported syntax or cannot resolve types, it raises a TranspilationError with line numbers and the problematic code, making it straightforward to identify what needs to be rewritten.
The package has no runtime dependencies and installs cleanly. It prioritizes clear error messages over attempting to transpile everything, so you'll know immediately if a function can't be converted rather than getting silent failures or incorrect JavaScript. The transpiled output is not optimized or minimized, but it aims to produce JavaScript that returns identical values to the original Python when given the same inputs, even if the internal implementation differs slightly (for example, Python tuples become JavaScript arrays).
Use it for:
- Convert Python utility functions to run in Gradio web interfaces without duplicating logic in JavaScript.
- Transpile simple Python data-processing functions for client-side execution in web applications.
- Quickly identify which Python functions can be safely moved to the browser by attempting transpilation and reading error messages.
- Prototype client-side computation workflows where Python developers want to avoid learning JavaScript syntax.
- Build web applications where Python business logic needs to execute in the browser for performance or offline capability.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Transpiles Python functions to JavaScript, converting Python code to client-side JavaScript equivalents with clear error reporting for unsupported syntax.
Yes, if you are building Gradio applications or need to run simple Python functions client-side in JavaScript. The low install friction, no dependencies, and clear error reporting make it straightforward to evaluate whether your code is transpilable. However, the aging maintenance status (532 days since release, last commit 2026-01-19) means you should verify that it still works with your target Python version and that any bugs you encounter will be addressed. Not suitable for complex Python code or projects requiring active maintenance.
Install
groovy on PyPI
pip
pip install groovyuv
uv add groovypoetry
poetry add groovyInstalling groovy
Before you install
Low install friction with no runtime dependencies. Maintenance status is aging—last commit was 2026-01-19 and the package is 532 days past its initial release—so expect slower response to issues or updates.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for most commercial and open-source projects.
Quickstart
pip install groovy
from groovy import transpile
def sum_range(n: int):
total = 0
for i in range(n):
total = total + i
return total
js_code = transpile(sum_range)
print(js_code)
Requires Python >3.9. Functions must include type hints on parameters; ambiguous types without hints will raise TranspilationError.
Verify before relying
- Whether transpiled JavaScript output is semantically identical to Python for all supported operations beyond simple arithmetic and control flow.
- Performance characteristics of transpiled JavaScript compared to native Python or hand-written JavaScript.
- Scope and completeness of Gradio-specific class support beyond the gr.Component example shown.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 532 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,567,233/month — #2,070 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: groovy-0.1.2-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pscriptPScript compiles a Python subset to JavaScript,…
unclear · top 15,000 on PyPI
Js2PyJs2Py translates and executes JavaScript code…
permissive · top 5,000 on PyPI
gradioGradio builds web interfaces for machine…
permissive · top 5,000 on PyPI
Js2Py-3.13Js2Py translates and executes JavaScript code…
permissive · top 15,000 on PyPI
telepathtelepath serializes Python objects to…
permissive · top 5,000 on PyPI
CoffeeScriptCompiles CoffeeScript code to JavaScript from…
permissive · top 15,000 on PyPI
tree-sitter-groovyProvides a Groovy language grammar for…
permissive · top 5,000 on PyPI
gradio-clientCalls any Gradio app as a Python API with a…
permissive · top 5,000 on PyPI
dukpyDukPy is a JavaScript interpreter for Python…
permissive · top 15,000 on PyPI
streamlit-javascriptExecutes arbitrary JavaScript code from within…
permissive · top 15,000 on PyPI