Download and Installation

Dependencies

python-discid works with Python 3 >= 3.10.

The module discid cannot be imported without libdiscid >= 0.2.2 installed. If you want to use it as optional dependency, import the module only when needed or catch the OSError when libdiscid is not found.

Package Repositories (Linux)

If you are using Linux, you might find python-discid in a repository used by your package manager.

These packages are known:

Your package manager will also handle the libdiscid dependency automatically.

PyPI

The next-best option is to load the Package from pypi with pip:

pip install discid

You still have to install libdiscid.

Source Code

The code is available from GitHub as zip and tar.gz.

You can always get the latest code with git:

git clone https://github.com/metabrainz/python-discid.git

Installation

You can use python-discid already when you put the folder discid in the same location you run your script from or somewhere in your PYTHONPATH.

System-wide installation from local source can be done with pip:

python -m pip install .

Running tests

You can test your setup (including libdiscid) with pytest:

pytest

Some additional tests can be run that require the presence of a CD drive with an inserted audio CD. The exact audio CD does not matter, any valid audio CD should work. To run those tests set the environment variable PYTHON_DISCID_TEST_DEVICE to a non-empty value and run pytest:

PYTHON_DISCID_TEST_DEVICE=1 pytest

Libdiscid

If you don’t have a package manager that takes care of the libdiscid dependency, you have to download it manually.

You can find several builds and the source at https://musicbrainz.org/doc/libdiscid.

If no build for your platform is available, you have to build from source and install with:

cmake .
make
make install

If the last step doesn’t work for you, you might have to place the files discid.DLL, libdiscid.*.dylib or libdiscid.so.* (depending on your platform) in the same directory as you start your script from or somewhere in your PATH.