Skip to main content

Maintain your installed packages from a source file

Project description

paclare - A minimalist declarative package manager

codecov

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paclare-0.1.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paclare-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file paclare-0.1.1.tar.gz.

File metadata

  • Download URL: paclare-0.1.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for paclare-0.1.1.tar.gz
Algorithm Hash digest
SHA256 64dc19363597f4f4bc01ebb8f26970227d52e7ee8bfd3234854acba93ea4b6f6
MD5 e021cbc1174b02444639d71283a2f55a
BLAKE2b-256 aec2277136c7bd0708333b3b556a60eb3dee376e55e4b3b46ad60553158c6938

See more details on using hashes here.

File details

Details for the file paclare-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: paclare-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for paclare-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54463fcfbf1d421c6458dd5736176c582602a6f55c57e6918642602c947f1afc
MD5 c62bb07bdee6dd81448bec035c517e5f
BLAKE2b-256 7d445f5bb0942c0021fd93ec9cc0fcf3e124aa9a4a88baefded05d59ba6a3591

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page