NiklasRosenstein / slap

Slap is a CLI to assist in the process for developing and releasing Python packages.
https://niklasrosenstein.github.io/slap/
Other
18 stars 11 forks source link
app cli flit python python-poetry release-automation setuptools

Slap

Slap is a command-line tool to simplify common workflows in the development of Python projects independent of the PEP 517 build backend being used, capable of managing single- and multi-project repositories.

Installation

I recommend installing Slap using Pipx. (Requires Python 3.10 or higher)

$ pipx install slap-cli

Note: Currently Slap relies on an alpha version of poetry-core (^1.1.0a6). If you install it into the same environment as Poetry itself, you may also need to use an alpha version of Poetry (e.g. 1.2.0a2).

If you use Slap in GitHub Actions, try one of the actions provided by Slap directly:

Documentation

You can find the documentation for Slap here: https://niklasrosenstein.github.io/slap/

Check out the Getting started guide.

Feature Matrix

Feature Poetry Documentation
Manage structured changelog entries slap changelog
Show project details slap info
Build and publish to PyPI using Twine ✅ (single project only) slap publish
Create a new release (bump version numbersr) ❌ (sub-par support) slap release
Run a command configured in pyproject.toml slap run
Run tests configured in pyproject.toml slap test
Manage Python virtualenv's ✅ (but out-of-worktree) slap venv
Generate a dependencies report slap report dependencies
Project dependencies lock file
Feature / Build backend Flit Poetry Setuptools Documentation
Add dependency slap add
Sanity check project configuration slap check
Bootstrap project files slap init
Install projects using Pip or uv slap install
Symlink projects (editable installs) slap link
Bump interdependencies in mono-repository ✅ (not tested regularly) ✅ (partial) slap release

Legend: ✅ explicitly supported, ❌ explicitly not supported, (blank) not relevant or currently not supported

Issues / Suggestions / Contributions

Slap is currently very opinionated by the fact that I built it as my personal workflow tool, but I welcome suggestions and contributions, and I am hopeful it will be useful to a wider audience than myself.

Please report any issues you encounter via GitHub Issues. Feel free to use the GitHub Discussions forum to ask questions or make suggestions on new features (e.g. if you would like a new build backend to be supported?). Lastly, feel free to submit pull requests to the GitHub Repository.

FAQ

Why "Slap"?

Finding a good, catchy name that also types easily in the terminal and is not already widely used isn't easy, ok?

What makes this different to the Poetry CLI?

Some people might find this similar to tools like Poetry, and while there is some overlap in functionality, Slap is not a build backend and is more targeted towards library development. In fact, most of my projects use Poetry as the build backend but I never even once interact with the Poetry CLI throughout the lifetime of the project.

The most notable differences to Poetry are

How can I use the shiny new uv installer with Slap?

You can configure Slap to use uv to create virtual environments:

$ slap config --venv-type uv

When Slap detects a virtual environment that was created with uv (note: actually, create with uv by Slap itself), it will use uv to install packages into the virtual environment. Alternatively, you can pass the --installer uv option to slap install.