diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2023-10-13 22:28:22 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2023-10-13 22:28:22 +0200 |
| commit | a48a52c67253d564e8e8621a46733b2e1037be32 (patch) | |
| tree | ac934517d9648da9b1dd3185fcc9837fee4c4c87 | |
| parent | 4aa98dca11faf2a49852cc3e0051cfc1970abaa3 (diff) | |
DOC: Update installation docs
| -rw-r--r-- | CONTRIBUTING.rst | 21 | ||||
| -rw-r--r-- | doc/conf.py | 1 | ||||
| -rw-r--r-- | doc/installation.rst | 100 | ||||
| -rw-r--r-- | examples/README.rst | 2 |
4 files changed, 64 insertions, 60 deletions
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 9d1ffd0..18a24c1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -39,7 +39,7 @@ You should of course also show what happens when you run your code, e.g. :: Running my script, I got this error: ``` - $ python3 my_script.py + $ python my_script.py Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514 Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818 Traceback (most recent call last): @@ -58,7 +58,7 @@ You should also mention the operating system and host API you are using If your problem is related to a certain hardware device, you should provide the list of devices as reported by :: - python3 -m sounddevice + python -m sounddevice If your problem has to do with the version of the PortAudio library you are using, you should provide the output of this script:: @@ -73,7 +73,7 @@ you can use the ``<details>`` HTML tag to show some content only on demand:: <details> ``` - $ python3 -m sounddevice + $ python -m sounddevice 0 Built-in Line Input, Core Audio (2 in, 0 out) > 1 Built-in Digital Input, Core Audio (2 in, 0 out) < 2 Built-in Output, Core Audio (0 in, 2 out) @@ -92,7 +92,7 @@ newest development version (a.k.a. "master") from Github_:: git clone --recursive https://github.com/spatialaudio/python-sounddevice.git cd python-sounddevice - python3 -m pip install -e . + python -m pip install -e . .. _PyPI: https://pypi.org/project/sounddevice/ .. _Github: https://github.com/spatialaudio/python-sounddevice/ @@ -118,12 +118,19 @@ If you make changes to the documentation, you can locally re-create the HTML pages using Sphinx_. You can install it and a few other necessary packages with:: - python3 -m pip install -r doc/requirements.txt + python -m pip install -r doc/requirements.txt To (re-)build the HTML files, use:: - python3 setup.py build_sphinx + python -m sphinx doc _build -The generated files will be available in the directory ``build/sphinx/html/``. +The generated files will be available in the directory ``_build/``. + +If you additionally install sphinx-autobuild_, +you can run Sphinx automatically on any changes +and conveniently auto-reload the changed pages in your browser:: + + python -m sphinx_autobuild doc _build --open-browser .. _Sphinx: https://www.sphinx-doc.org/ +.. _sphinx-autobuild: https://github.com/executablebooks/sphinx-autobuild diff --git a/doc/conf.py b/doc/conf.py index 0c35fe9..b07438b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -56,6 +56,7 @@ except Exception: today = '<unknown date>' default_role = 'any' +highlight_language = 'none' nitpicky = True diff --git a/doc/installation.rst b/doc/installation.rst index 48f9bc2..623eede 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -2,22 +2,58 @@ Installation ============ First of all, you'll need Python_. -Any version where CFFI_ is supported should work. -If you don't have Python installed yet, you should get one of the -distributions which already include CFFI and NumPy_ (and many other useful -things), e.g. Anaconda_ or WinPython_. +There are many distributions of Python available, +anyone where CFFI_ is supported should work. -.. only:: html +You can get the latest ``sounddevice`` release from PyPI_ (using ``pip``). +But first, it is recommended to create a virtual environment +(e.g. using `python3 -m venv`__ or `conda create`__). +After activating the environment, the ``sounddevice`` module can be installed with:: + + python -m pip install sounddevice + +__ https://docs.python.org/3/library/venv.html +__ https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-environments + +If you have already installed an old version of the module in the environment, +you can use the ``--upgrade`` flag to get the newest release. +To un-install, use:: + + python -m pip uninstall sounddevice + +If you want to try the very latest development version of the ``sounddevice`` module, +have a look at the section about :doc:`CONTRIBUTING`. + +If you install the ``sounddevice`` module with ``pip`` on macOS or Windows, +the PortAudio_ library (with ASIO support on Windows) will be installed +automagically. +On other platforms, you might have to install PortAudio with your package +manager (the package might be called ``libportaudio2`` or similar). + +.. note:: + + If you install PortAudio with a package manager (including ``conda``), + it will override the version installed with ``pip``. + +The NumPy_ library is only needed if you want to play back and record NumPy arrays. +The classes `sounddevice.RawStream`, `sounddevice.RawInputStream` and +`sounddevice.RawOutputStream` use plain Python buffer objects and don't need +NumPy at all. +If needed -- and not installed already -- NumPy can be installed like this:: + + python -m pip install numpy - .. image:: https://anaconda.org/conda-forge/python-sounddevice/badges/version.svg - :target: https://anaconda.org/conda-forge/python-sounddevice -If you are using the ``conda`` package manager (e.g. with Anaconda_ or Miniconda_ for -Linux/macOS/Windows), you can install the ``sounddevice`` module from the -``conda-forge`` channel:: +Alternative Packages +-------------------- + +If you are using the ``conda`` package manager (e.g. with miniforge_), +you can install the ``sounddevice`` module from the ``conda-forge`` channel:: conda install -c conda-forge python-sounddevice +You can of course also use ``mamba`` if ``conda`` is too slow. + .. note:: The PortAudio package on ``conda-forge`` doesn't have ASIO support, @@ -36,52 +72,12 @@ There are also packages for several other package managers: If you are using Windows, you can alternatively install one of the packages provided at https://www.lfd.uci.edu/~gohlke/pythonlibs/#sounddevice. -The PortAudio_ library (with ASIO support) is included in the package and +The PortAudio library (with ASIO support) is included in the package and you can get the rest of the dependencies on the same page. -Note that some of the aforementioned packages may be out-of-date. -You can always get the newest ``sounddevice`` release from PyPI_ -(using ``pip``). -If you want to try the latest development version, have a look at the section -about :doc:`CONTRIBUTING`. - -To install the latest release from PyPI, use:: - - python3 -m pip install sounddevice - -Depending on your Python installation, -you may have to use ``python`` instead of ``python3``. -If you have installed the module already, you can use the ``--upgrade`` flag to -get the newest release. - -To un-install, use:: - - python3 -m pip uninstall sounddevice - -If you install the ``sounddevice`` module with ``pip`` on macOS or Windows, -the PortAudio_ library (with ASIO support on Windows) will be installed -automagically. -On other platforms, you might have to install PortAudio with your package -manager (the package might be called ``libportaudio2`` or similar). - -You might also have to install CFFI_ (from a package called ``python3-cffi`` or -similar). - -NumPy_ is only needed if you want to play back and record NumPy arrays. -The classes `sounddevice.RawStream`, `sounddevice.RawInputStream` and -`sounddevice.RawOutputStream` use plain Python buffer objects and don't need -NumPy at all. -If you need NumPy, you should install it with your package manager (from a -package named ``python3-numpy`` or similar) or use a Python distribution that -already includes NumPy (see above). -You can also install NumPy with ``pip``, but depending on your platform, this -might require a compiler and several additional libraries. - .. _PortAudio: http://www.portaudio.com/ .. _NumPy: https://numpy.org/ .. _Python: https://www.python.org/ -.. _Anaconda: https://www.anaconda.com/download#downloads -.. _Miniconda: https://docs.conda.io/miniconda.html -.. _WinPython: https://winpython.github.io/ +.. _miniforge: https://github.com/conda-forge/miniforge .. _CFFI: https://cffi.readthedocs.io/ .. _PyPI: https://pypi.org/project/sounddevice/ diff --git a/examples/README.rst b/examples/README.rst index 1a26446..991367d 100644 --- a/examples/README.rst +++ b/examples/README.rst @@ -8,4 +8,4 @@ use the ``--help`` argument. For example:: - python3 play_file.py --help + python play_file.py --help |
