Maintain your installed packages from a source file
Project description
paclare - A minimalist declarative package manager
Why paclare ?
Intro
Many package managers end up cluttering your environment. Stuff you don't need anymore is installed and you can't remember why you installed it.
Conversely, when setting up a new machine, you may not remember all you need to install to have a similar setup as on the previous one.
You may also suffer from fragmented configuration : apt, flatpak, pip, it's difficult to have a one size fits all solution.
Paclare, contraction of Package deClare, aims to solve these issues.
A config file to rule them all
For each package manager you use, you put the packages you need in a config.toml file.
[apt]
packages = [
"emacs", # You can add a comment if you want
"vim", # Please don't install this one
"flatpak", # Package manager for portable gui apps
]
[flatpak]
packages = [
"org.mozilla.firefox",
]
Here is what paclare will do :
- If a package is not installed yet, paclare will install it
- If a package is installed but not on the list, paclare will uninstall it
- Paclare supports some of the most popular package managers out of the box
- If paclare's does not support your package manager natively, you can add it yourself in the toml file (read-on for a detailed explanation).
Why not nix ?
Other declarative package managers exist, like nix or guix, they are far more powerful but also far more complex.
Getting started
Installation
Paclare is a python package, it requires python3.12 or later.
Currently, paclare has been packaged on the pypi index, so you can install it through pip, pipx, or uv.
I recommend uv, as it is becoming the defacto modern python package manager.
pip install paclare
pipx install paclare
uv tool install paclare
Setting up your config : paclare init
Let's assume that you use package managers already supported by paclare. You can initialize your config with the following command :
mkdir ~/.config/paclare # Or symlink to your dotfiles repo
paclare init ~/.config/paclare/paclare.toml
This file will only contain your explicitely installed packages. Dependencies should not appear there.
Check what you have installed : paclare list
paclare list
This command will read your config file, detect the package managers you have enabled there, and for each one of them list the explicitely installed packages.
Installing new packages : paclare sync
paclare sync
This command will read your config file, detect the package managers and the associated packages.
It will then compare these lists to what is actually installed on your machine. The missing packages will be installed, the leftovers uninstalled.
Adding a new package manager
Paclare won't support every package manager out of the box, but you can add your own.
You must provide three variables in your toml config :
[mypackagemgr]
list_cmd = "mypackagemgr --list-user-installed-packages"
install_cmd = "mypackagemgr install"
uninstall_cmd = "mypackagemgr uninstall"
packages = [
"pkg1",
"pkg2"
]
The commands specified here will be interpreted by your machine's default shell, /bin/sh.
This means you can use your pipes, cut, sed, and pals to help you here.
You can check out the commands used for the built-in package managers here
You can also override paclare's commands for built-in package managers by defining these variables.
Contributing
Contributions are of course welcome, especially to add new package managers to the supported list.
New features and PRs will be considered, but I intend to keep paclare as minimal as possible.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paclare-0.1.0.tar.gz.
File metadata
- Download URL: paclare-0.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9673da5cb80f547b07c5e8e2bf858fc29fbf37f65dc78d05fe94d7087a1d8a1b
|
|
| MD5 |
4f24cb3a6dd0a248156ee908fbd225c0
|
|
| BLAKE2b-256 |
a36b087329516b78df5a0217519a330d5aba59beb5bc3abd86f524385e0c511e
|
File details
Details for the file paclare-0.1.0-py3-none-any.whl.
File metadata
- Download URL: paclare-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb95990184941dda90a8b9b72bf39aa21a5f6e446a023875b38c44e1b4e72885
|
|
| MD5 |
fee6b7de5f0d413ab4eceec0046002a5
|
|
| BLAKE2b-256 |
d247f9d32cb1dc5023f2621bda0f06ccb971f3456a666034efacebd073cc6451
|