parsing
A small CLI of libcst-powered Python source transforms.
Install
uv sync
Or as a tool:
uv tool install .
Commands
qualify
Rewrites from X import a, b into import X and qualifies the resulting references.
parsing qualify path/to/file.py -m os.path=op
parsing qualify path/to/file.py --all --in-place
parsing qualify path/to/file.py --interactive # pick imports via fzf
| Flag | Description |
|---|---|
-m, --module name[=alias] |
Module to qualify; repeatable. |
-a, --all |
Collapse every from X import a, b, ... with 2+ names. |
-i, --in-place |
Write changes back to the file. |
-I, --interactive |
Pick imports via fzf, then prompt for a nickname per selection. |
split-strings
Splits standalone single-line triple-quoted string statements (docstrings, block-comment-style strings) onto multiple lines. Only standalone string-expression statements are rewritten — x = """foo""" is left alone, since splitting it would change the string value.
parsing split-strings path/to/file.py --in-place
| Flag | Description |
|---|---|
-i, --in-place |
Write changes back to the file. |
Neovim integration
Drop the snippet below into your Neovim config (e.g. ~/.config/nvim/lua/parsing.lua, then require("parsing") from init.lua). It binds <leader>p to run parsing qualify -Ii on the current buffer inside a floating terminal so fzf and the nickname prompts work normally. The buffer is reloaded from disk when the command exits.
local M = {}
function M.run()
local file = vim.api.nvim_buf_get_name(0)
if file == "" or vim.bo.buftype ~= "" then
vim.notify("parsing: current buffer is not a file", vim.log.levels.WARN)
return
end
vim.cmd("silent! write")
local ui = vim.api.nvim_list_uis()[1]
local width = math.floor(ui.width * 0.8)
local height = math.floor(ui.height * 0.8)
local buf = vim.api.nvim_create_buf(false, true)
local win = vim.api.nvim_open_win(buf, true, {
relative = "editor",
width = width,
height = height,
col = math.floor((ui.width - width) / 2),
row = math.floor((ui.height - height) / 2),
style = "minimal",
border = "rounded",
title = " parsing qualify -Ii ",
title_pos = "center",
})
vim.fn.jobstart({ "parsing", "qualify", "-Ii", file }, {
term = true,
on_exit = function(_, code)
if vim.api.nvim_win_is_valid(win) then
vim.api.nvim_win_close(win, true)
end
if code == 0 then
vim.cmd("checktime")
else
vim.notify("parsing exited with code " .. code, vim.log.levels.WARN)
end
end,
})
vim.cmd("startinsert")
end
vim.keymap.set("n", "<leader>p", M.run, { desc = "parsing: interactive qualify imports" })
return M
Requires parsing and fzf on PATH, and Neovim 0.10+ for jobstart({ term = true }) (on older versions swap that call for vim.fn.termopen).
Metadata
Release files for parsing-lsp 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| parsing_lsp-1.0.0.tar.gz | 18.5 kB | Without provenance | Details for parsing_lsp-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| parsing_lsp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for parsing_lsp-1.0.0-py3-none-any.whl |
Total release size: 26.3 kB
Release files / parsing_lsp-1.0.0.tar.gz
| Download URL | parsing_lsp-1.0.0.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c6a4370ad83ab83d1817411419db216eb89c49d0c64a9d2cb8abe72a4daadd4
|
|
BLAKE2b-256 checksum How to use checksums |
d5a254aa216db197a666f54a54ba7c8e4c0f580efae84c21d139ab2745d220e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.3
|
Release files / parsing_lsp-1.0.0-py3-none-any.whl
| Download URL | parsing_lsp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d01a2fc19c81a0a2ad305a56fd9b257ec0eb94bba164e292051406d06093bce
|
|
BLAKE2b-256 checksum How to use checksums |
3a04e7d389f0bae15dcc2b7b350d8780adc23a7e0a06e73b4aa4a936a6bb0e00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.3
|
Security for parsing-lsp 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.