Skip to content

Commit

Permalink
Plugins: poetry -> uv
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Nov 26, 2024
1 parent 4e0782f commit 220ab0c
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 73 deletions.
5 changes: 3 additions & 2 deletions docs/configuration/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ _Experimental setting_: behavior and api is subject to change until stable.
Omit sending {kbd}`enter` to key commands. Equivalent to having
a [`time.sleep`](time.sleep) before and after [`send_keys`](libtmux.Pane.send_keys).

This is especially useful for expensive commands where the terminal needs some breathing room (virtualenv, poetry, pipenv, sourcing a configuration, launching a tui app, etc).
This is especially useful for expensive commands where the terminal needs some breathing room (virtualenv, poetry, pipenv, uv, sourcing a configuration, launching a tui app, etc).

````{tab} Virtualenv
Expand Down Expand Up @@ -740,7 +740,7 @@ the workspace file / project root.

:::

If you use [pipenv][pipenv] / [poetry][poetry], you can use a script like this to ensure
If you use [pipenv] / [poetry] / [uv], you can use a script like this to ensure
your packages are installed:

````{tab} YAML
Expand Down Expand Up @@ -784,6 +784,7 @@ windows:

[pipenv]: https://docs.pipenv.org/
[poetry]: https://python-poetry.org/
[uv]: https://github.com/astral-sh/uv

## Kung fu

Expand Down
30 changes: 13 additions & 17 deletions docs/plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ your tmuxp workspace file.
````

[poetry]: https://python-poetry.org/

## Developing a Plugin

tmuxp expects all plugins to be class within a python submodule named
`plugin` that is within a python module that is installed in the local
python environment. A plugin interface is provided by tmuxp to inherit.

[poetry][poetry] is the chosen python package manager for tmuxp. It is highly
[uv] is the chosen python package manager for tmuxp. It is highly
suggested to use it when developing plugins; however, `pip` will work
just as well. Only one of the configuration files is needed for the packaging
tool that the package developer decides to use.
Expand All @@ -49,37 +47,33 @@ python_module
├── tmuxp_plugin_my_plugin_module
│   ├── __init__.py
│   └── plugin.py
├── pyproject.toml # Poetry's module configuration file
└── setup.py # pip's module configuration file
└── pyproject.toml # Python project configuration file

```

When publishing plugins to pypi, tmuxp advocates for standardized naming:
`tmuxp-plugin-{your-plugin-name}` to allow for easier searching. To create a
module configuration file with poetry, run `poetry init` in the module
module configuration file with uv, run `uv virtualenv` in the module
directory. The resulting file looks something like this:

```toml

[tool.poetry]
[project]
name = "tmuxp-plugin-my-tmuxp-plugin"
version = "0.0.2"
description = "An example tmuxp plugin."
authors = ["Author Name <author.name@<domain>.com>"]

[tool.poetry.dependencies]
python = "^3.6"
tmuxp = "^1.6.0"

[tool.poetry.dev-dependencies]
requires-python = ">=3.8,<4.0"
dependencies = [
"tmuxp^=1.7.0"
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

requires = ["hatchling"]
build-backend = "hatchling.build"
```

The {}`plugin.py` file could contain something like the following:
The `plugin.py` file could contain something like the following:

```python

Expand Down Expand Up @@ -147,3 +141,5 @@ plugins:
```{eval-rst}
.. automethod:: tmuxp.plugin.TmuxpPlugin.reattach
```

[uv]: https://github.com/astral-sh/uv
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "tmuxp_test_plugin_awf"
version = "0.0.2"
description = "A tmuxp plugin to test after_window_finished part of the tmuxp plugin system"
authors = ["Joseph Flinn <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
tmuxp = "^1.7.0"

[tool.poetry.dev-dependencies]
requires-python = ">=3.8,<4.0"
dependencies = [
"tmuxp^=1.7.0"
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "tmuxp_test_plugin_bs"
version = "0.0.2"
description = "A tmuxp plugin to test before_script part of the tmuxp plugin system"
authors = ["Joseph Flinn <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
tmuxp = "^1.7.0"

[tool.poetry.dev-dependencies]
requires-python = ">=3.8,<4.0"
dependencies = [
"tmuxp^=1.7.0"
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "tmuxp_test_plugin_bwb"
version = "0.0.2"
description = "A tmuxp plugin to test before_workspace_build part of the tmuxp plugin system"
authors = ["Joseph Flinn <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
tmuxp = "^1.7.0"

[tool.poetry.dev-dependencies]
requires-python = ">=3.8,<4.0"
dependencies = [
"tmuxp^=1.7.0"
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "tmuxp_test_plugin_fail"
version = "0.1.0"
description = "A test plugin designed to fail to test the cli"
authors = ["Joseph Flinn <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
tmuxp = "^1.7.0"

[tool.poetry.dev-dependencies]
requires-python = ">=3.8,<4.0"
dependencies = [
"tmuxp^=1.7.0"
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "tmuxp_test_plugin_owc"
version = "0.0.2"
description = "A tmuxp plugin to test on_window_create part of the tmuxp plugin system"
authors = ["Joseph Flinn <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
tmuxp = "^1.7.0"

[tool.poetry.dev-dependencies]
requires-python = ">=3.8,<4.0"
dependencies = [
"tmuxp^=1.7.0"
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "tmuxp_test_plugin_r"
version = "0.0.2"
description = "A tmuxp plugin to test reattach part of the tmuxp plugin system"
authors = ["Joseph Flinn <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
tmuxp = "^1.7.0"

[tool.poetry.dev-dependencies]
requires-python = ">=3.8,<4.0"
dependencies = [
"tmuxp^=1.7.0"
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

0 comments on commit 220ab0c

Please sign in to comment.