Skip to main content

getcsound

Install Csound 7 from Python, with no runtime dependencies.

getcsound is a small, pure-Python package that makes Csound available to other Python packages. A package using Csound can list getcsound as a dependency and call getcsound.ensure_csound(); if Csound is not already installed, the official Csound 7 installer is downloaded and run automatically.

getcsound does not depend on libcsound and does not import ctypes, so it is safe to use in pure-Python environments.

Installation

pip install getcsound

Usage

from getcsound import ensure_csound

installation = ensure_csound()
print(installation.libpath)
print(installation.plugindir)

# LIBCSOUNDPATH and OPCODE7DIR64 now point at the installation, so any
# Csound binding imported afterwards can find it.
import libcsound

Importing getcsound is side-effect free; installation only happens when ensure_csound() (or one of the install_csound_* functions) is called.

To locate an existing installation without installing anything and without changing the environment, use find_csound(). It returns a CsoundInstallation or None. Only the locations used by the official Csound 7 installers are searched; set LIBCSOUNDPATH to use an installation somewhere else.

The CsoundInstallation object exposes the paths and can produce the environment variables for the installation:

from getcsound import find_csound

installation = find_csound()
if installation is not None:
    print(installation.as_env())
    # {'LIBCSOUNDPATH': '/home/user/.local/csound/libcsound64.so',
    #  'OPCODE7DIR64': '/home/user/.local/lib/csound/7.0/plugins64'}

Platform notes

  • Linux: installs the portable Csound 7 build to ~/.local/csound when there is no interactive terminal, or runs the interactive installer when there is one.

  • macOS: installs the official Csound 7 .pkg with sudo. This needs an interactive terminal (to enter the password) or password-less sudo.

  • Windows: installs the machine-wide x86_64 package, which needs Administrator rights. Windows on ARM64 is not supported by the automatic installer. An interactive or already-elevated session is required.

On unsupported platforms, or when installation is disabled, the official one-line installers can still be used manually:

# Linux / macOS
curl -fsSL https://csound-plugins.github.io/getcsound.sh | bash
# Windows
irm https://csound-plugins.github.io/getcsound.ps1 | iex

Environment variables

LIBCSOUNDPATH

Absolute path to the Csound shared library to use. Checked first by find_csound(). If it is set to a missing file, ensure_csound() raises instead of installing another Csound.

OPCODE7DIR64

Csound plugin directory. Used when LIBCSOUNDPATH comes from the environment and set automatically after an installation.

GETCSOUND_INSTALL

Set to 0, false, no or off to disable automatic installation. LIBCSOUND_INSTALL is accepted as a compatibility alias.

Bundled installers

getcsound/data/getcsound.sh and getcsound/data/getcsound.ps1 are mirrors of the canonical installers in ~/dev/csound/installer/ (published at https://csound-plugins.github.io/). Do not edit the copies in this repository; update the canonical source and run scripts/sync-installers.sh.

Testing

Run the unit tests with:

pip install ".[test]"
python -m pytest

The integration test in tests/test_integration_libcsound.py installs Csound with getcsound, then imports libcsound with LIBCSOUND_INSTALL=0 and checks that it loads the same installation and renders a short score. It is skipped by default because it downloads and installs Csound; enable it with:

GETCSOUND_RUN_LIBCSOUND_INTEGRATION=1 python -m pytest \
    tests/test_integration_libcsound.py

The GitHub Actions workflow runs this test on Linux x86-64, macOS arm64 and Windows x86-64.

License

LGPL-2.1-or-later. See LICENSE.

The installation logic is derived from libcsound’s _install.py; it has been adapted to be standalone and free of ctypes.

Metadata

Release files for getcsound 0.1.0

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

Source distribution (sdist)

Source distribution for getcsound 0.1.0
File Size Uploaded Provenance Actions
getcsound-0.1.0.tar.gz 45.6 kB Without provenance Details for getcsound-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for getcsound 0.1.0
File Interpreter ABI Platform Actions
getcsound-0.1.0-py3-none-any.whl Python 3 none any Details for getcsound-0.1.0-py3-none-any.whl

Total release size: 84.9 kB

Release files / getcsound-0.1.0.tar.gz

Download URL getcsound-0.1.0.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
858327f716017b47e635b2da413e9eb83f0862197a81c1cb4ba3c8acc0fddbdd
BLAKE2b-256 checksum
How to use checksums
80d54d6be9bd88c7bed8e4d2cae2c28928eba54f7f375144b50d265c4d3bf489
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / getcsound-0.1.0-py3-none-any.whl

Download URL getcsound-0.1.0-py3-none-any.whl
Size 39.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0c662bd29f8d253e1a4b9f11bee937988ba9cf937b3a84ffcc2fa4178c0902d
BLAKE2b-256 checksum
How to use checksums
6d06f4d08de29b051db1cef20c68712c455d56cfea80125fb0448146512b31c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for getcsound 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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