lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ANN: "pip install lilypond"


From: Jean Abou Samra
Subject: Re: ANN: "pip install lilypond"
Date: Mon, 22 May 2023 22:53:45 +0200
User-agent: Evolution 3.48.1 (3.48.1-1.fc38)

Le lundi 22 mai 2023 à 20:00 +0200, Jean Abou Samra a écrit :

Hi,

As I was annoyed by the code needed to automatically download LilyPond in the “extending-lilypond” guide, I created a “lilypond” project on PyPI...

https://pypi.org/project/lilypond

... and uploaded wheels to it using a tiny script which lives at ...

https://gitlab.com/jeanas/lilypond-wheels

Ok, if that was all Chinese to you, what this basically means is that just like there is a LilyPond package in Linux distros, on Homebrew, MacPorts, Chocolatey, and so on, there is now also a Python package, making it convenient to use LilyPond in Python scripts. It's used like this:

import subprocess
import lilypond

subprocess.run([lilypond.executable(), "file.ly"])

It can be installed with pip, the standard tool for installing Python packages. The whole point is that this doesn't just install a wrapper that looks for LilyPond on the system. It really comes with its own copy of LilyPond. That means you can just add "lilypond" as a dependency to your pyproject.toml, tox.ini, requirements.txt, or wherever your other Python dependencies are, and Bob's your uncle, without requiring your users to install LilyPond separately from your Python module. You can pin the LilyPond version by writing the requirement as “lilypond==2.24.1”, or do basically anything you can do with plain Python packages.

I'll try to remember to update it with each LilyPond release.

Note that I have not tested the macOS and Windows wheels, I'd be interested to know whether they are working...



Well...

Mere minutes after I sent this email, I discovered that there was already a project that I had missed, doing something almost but not quite similar,

https://pypi.org/project/lilyponddist

The “not quite” part is that it does not bundle LilyPond, it downloads it (always the same version) the first time the module is imported.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]