Skip to main content
Sync your packages with your dotfiles (and vice versa)
======================================================

When we use a package manager (be it apt, pip, npm,…), we want to sync
the list of installed packages in requirement files. We then declare a
mapping that links a package manager to its requirements file:

.. code:: python

REQUIREMENTS_ROOT_DIR = "~/dotfiles/"
REQUIREMENTS_FILES = {
"apt": {
"file": "apt.txt", # => ~/dotfiles/apt.txt
"pacman": "apt-get",
"install": "install -y --force-yes",
"uninstall": "remove",
},
# and so on for pip, pip3, gem, npm, docker and guix.
}

and we call

.. code:: example

syp --pm apt foo bar

to add the two packages "foo" and "bar" in ``~/dotfiles/apt.txt`` and at
the same time, to check if this list has been edited manually (with
packages added or removed) and act accordingly (we make diffs against
the cache at ``~/.syp/apt.txt``).

See the Settings section below.

Tested on python 2.7 and 3.4.

Usage
-----

The basic usage is to check all of the package managers, and install and
remove what's necessary:

Example:

.. code:: example

syp

can output:

.. raw:: html

<img src="http://i.imgur.com/NXiddZB.png" </img>

We set the package manager with ``--pm`` and **give one or many packages
to install**:

.. code:: example

syp --pm pip syp foo bar

will append "syp", "foo" and "bar" at the bottom of
``~/dotfiles/pip.txt`` (if they are not there yet), check if pip.txt was
manually edited, and suggest a list of packages to install and remove.

So a suggested alias is

.. code:: example

alias sypip="syp --pm pip "

If no package manager is specified, **we use apt by default** (see
Settings below).

To **remove packages**, use ``--rm``:

.. code:: example

syp --pm pip foo --rm

We can **add a message** with ``-m``. It will be appended on the same
line:

.. code:: example

syp --pm pip foo -m "foo is a cool package"

We can **edit the list** of packages for that package manager before the
operations with ``-e`` (``--editor``):

.. code:: example

syp --pm pip foo --rm -e

Settings
========

The default settings come with a configuration for ``apt``, ``pip``,
``pip3``, ``gem``, ``npm``, ``docker`` and ``guix``.

The user settings, stored at ``~/.syp/settings.py``, is a regular python
file that will be ``exec``'ed on startup. So, if you want to add or
overide a package manager settings, edit the ``REQUIREMENTS_FILES``
dictionnary accordingly. Only the key "file" is required:

.. code:: python

REQUIREMENTS_FILES['apt'] = {
"file": "requirements-apt.txt", # required. appended to REQUIREMENTS_ROOT_DIR
"pacman": "aptitude", # by default, same as the package manager name, here 'apt'
"install": "install -y", # 'install' by default
"uninstall": "remove", # 'uninstall' by default.
}

See also

.. code:: python

#: The base directory where lies the configuration files.
REQUIREMENTS_ROOT_DIR = "~/dotfiles/"

#: System package manager, as a default.
SYSTEM_PACMAN = "apt-get"

Develop
=======

.. code:: example

pip install -e .

Todos and ideas
===============

- auto commit
- auto-recognize a virtualenv ?
- allow for more than a requirement file for one package manager.
- ask all and apply
- more tests

Bust most of all... use `Guix <https://gnu.org/software/guix/>`__ !

Metadata

Release files for syp 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for syp 0.1.7
File Size Uploaded Provenance Actions
syp-0.1.7.tar.gz 8.4 kB Without provenance Details for syp-0.1.7.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for syp 0.1.7
File Interpreter ABI Platform Actions
syp-0.1.7-py2.7.egg Legacy Egg format - - Details for syp-0.1.7-py2.7.egg
syp-0.1.7-py2-none-any.whl Python 2 none any Details for syp-0.1.7-py2-none-any.whl

Total release size: 49.8 kB

Release files / syp-0.1.7.tar.gz

Download URL syp-0.1.7.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
169a63daa35e8ea44a0bdbf4a2930a3c20f845554ca1d92847d9c7d010074623
BLAKE2b-256 checksum
How to use checksums
b35216f9035e3313378493fb41bc38687248e4c4f33e51b15b7e2bb76140f202
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / syp-0.1.7-py2.7.egg

Download URL syp-0.1.7-py2.7.egg
Size 23.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
394ad2c464c2b9b8e672caf705863ed8b05ddad9494630794c0de9cd0e79189f
BLAKE2b-256 checksum
How to use checksums
a919a2ce22f7b7bf177a0bec7c85942ce26dd3f2c91986d13e5e1f674c6e0111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / syp-0.1.7-py2-none-any.whl

Download URL syp-0.1.7-py2-none-any.whl
Size 17.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
1a2cf274622c35922577fd0e47498578029b6a98f29449365b1f412e2a52ca7b
BLAKE2b-256 checksum
How to use checksums
964e02b7b9781394d55da8e598706faef4dd2c66ac6aab1996a2e27513f56c06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for syp 0.1.7

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page