Skip to content

Commit

Permalink
Readme update, minor deprecation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scnerd committed Jan 8, 2025
1 parent 0db1b8f commit f5cf758
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ or install all tools using
pip install spl_transpiler[cli,runtime]
````

You can also use the TUI directly using `uvx` or `pipx`:

```bash
uvx spl_transpiler
```

# Usage

```python
Expand Down
4 changes: 2 additions & 2 deletions src/format_python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ pub fn format_python_code(code: impl ToString) -> Result<String> {
// from black import format_str, FileMode
// res = format_str("some python code", mode=FileMode())
let result: Result<String> = Python::with_gil(|py| {
let black = PyModule::import_bound(py, "black").map_err(|_| BlackNotInstalled())?;
let black = PyModule::import(py, "black").map_err(|_| BlackNotInstalled())?;
let mode = black.getattr("FileMode")?.call0()?;
let args = (code.to_string(),);
let kwargs = [("mode", mode)].into_py_dict_bound(py);
let kwargs = [("mode", mode)].into_py_dict(py)?;
let formatted = black.getattr("format_str")?.call(args, Some(&kwargs))?;
// TODO: ::from_object_bound is about to be deprecated, renamed to ::from_object in 0.23.0
// let py_s: Bound<PyString> = formatted.to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn spl_transpiler(m: &Bound<'_, PyModule>) -> PyResult<()> {

m.add_class::<spl::macros::MacroCall>()?;

let ast_m = PyModule::new_bound(m.py(), "ast")?;
let ast_m = PyModule::new(m.py(), "ast")?;
spl::python::ast(&ast_m)?;
m.add_submodule(&ast_m)?;
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
Expand Down

0 comments on commit f5cf758

Please sign in to comment.