@@ -24,16 +24,24 @@ We try to stick to `PEP8 <https://www.python.org/dev/peps/pep-0008/>`__
2424as much as possible. Variables, functions, modules and packages should
2525be in lowercase with underscores. Class names in CamelCase.
2626
27- We use `Black <https://github.com/psf/black >`__ to format the code and `isort <https://pycqa.github.io/isort/ >`__ to sort the imports.
28- The format will be automatically checked when doing a pull request so it is
29- recommended to regularly run Black on the code.
30- Please format your code as follows prior to commiting.
27+ We use `pre-commit <https://pre-commit.com/ >`__ to manage code quality hooks,
28+ including `Black <https://github.com/psf/black >`__ for formatting and
29+ `isort <https://pycqa.github.io/isort/ >`__ for sorting imports.
30+ The hooks will be automatically checked during pull requests.
31+
32+ To set up the pre-commit hooks locally:
33+
34+ .. code-block :: shell
35+
36+ pip install pre-commit
37+ pre-commit install
38+
39+ Once installed, the hooks will run automatically on every commit.
40+ You can also run them manually on all files:
3141
3242.. code-block :: shell
3343
34- pip install black isort
35- black .
36- isort --profile black .
44+ pre-commit run --all-files
3745
3846 Documentation
3947~~~~~~~~~~~~~
@@ -51,79 +59,56 @@ We recommend the following steps for generating the documentation:
5159- Build and view the documentation locally with: ``make html ``
5260- Open in your browser: ``docs/_build/html/index.html ``
5361
54- Develop Locally
55- ~~~~~~~~~~~~~~~
56-
57- It can be convenient to develop and run tests locally. In contrast to only
62+ It can be convenient to develop and run tests locally. In contrast to only
5863using the package, you will then also need to compile the C++ extension for
59- that. On Mac and Linux, GCC is required, while Visual C++ 14.0 is necessary for
60- `windows <https://wiki.python.org/moin/WindowsCompilers >`__.
61-
62- 1. Get the source code. Use recursive close so that Eigen (a sub-module of this
63- repository) is also downloaded.
64-
65- .. code-block :: shell
64+ that.
6665
67- git clone --recursive git@github.com:LCAV/pyroomacoustics.git
66+ Requirements:
67+ - C++ compiler: GCC or Clang on Mac/Linux, Visual C++ 14.0+ on Windows.
68+ - **CMake ** (version 3.10 or higher).
69+ - **pre-commit **
6870
69- Alternatively, you can clone without the `--recursive ` flag and directly
70- install the Eigen library. For macOS, you can find installation instruction
71- here: https://stackoverflow.com/a/35658421. After installation you can
72- create a symbolic link as such:
73-
74- .. code-block :: shell
75-
76- ln -s PATH_TO_EIGEN pyroomacoustics/libroom_src/ext/eigen/Eigen
77-
78- 2. Install a few pre-requisites
79-
80- .. code-block :: shell
81-
82- pip install numpy Cython pybind11
83-
84- 3. Compile locally
71+ 1. Get the source code.
8572
8673 .. code-block :: shell
8774
88- python setup.py build_ext --inplace
89-
90- On recent Mac OS (Mojave), it is necessary in some cases to add a
91- higher deployment target
75+ git clone git@github.com:LCAV/pyroomacoustics.git
9276
93- .. code-block :: shell
77+ External dependencies (`Eigen `, `nanoflann `, `pybind11 `) are automatically
78+ downloaded during the build process using CMake's `FetchContent `.
9479
95- MACOSX_DEPLOYMENT_TARGET=10.9 python setup.py build_ext --inplace
80+ 2. Install in editable mode.
9681
97- 4. Update ``$PYTHONPATH `` so that python knows where to find the local package
82+ Editable mode is recommended for local development as it correctly links
83+ the source files and compiled extensions.
9884
9985 .. code-block :: shell
10086
101- # Linux/Mac
102- export PYTHONPATH=< path_to_pyroomacoustics> :$PYTHONPATH
87+ pip install -U -e .
10388
104- For windows, see `this question <https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows >`__
105- on stackoverflow.
89+ The build process uses CMake to compile the C++ extensions.
90+ The ``-U `` flag ensures that the package is upgraded to the latest version.
91+ Make sure to re-run this command when changing the C++ code.
10692
107- 5. Install the dependencies listed in `` requirements.txt ``
93+ On macOS, if necessary, you can set the deployment target:
10894
10995 .. code-block :: shell
11096
111- pip install -r requirements.txt
97+ MACOSX_DEPLOYMENT_TARGET=11.0 pip install -U -e .
11298
113- 6. Now fire up ``python `` or ``ipython `` and check that the package can be
114- imported
99+ 3. Verify the installation.
115100
116- .. code-block :: python
101+ .. code-block :: shell
117102
118- import pyroomacoustics as pra
103+ python -c " import pyroomacoustics as pra; print(pra.__version__) "
119104
120105 Unit Tests
121106~~~~~~~~~~
122107
123108As much as possible, for every new function added to the code base, add
124- a short test script in `` pyroomacoustics/ tests`` . The names of the
109+ a short test script in the top-level `` tests/ `` directory . The names of the
125110script and the functions running the test should be prefixed by
126- ``test_ ``. The tests are started by running ``nosetests `` at the root of
111+ ``test_ ``. The tests are started by running ``pytest `` at the root of
127112the package.
128113
129114How to make a clean pull request
@@ -167,18 +152,18 @@ How to deploy a new version to pypi
167152
1681531. git checkout pypi-release
1691542. git merge master
170- 3. Change version number in ``pyroomacoustics/version.py `` to new version number vX.Y.Z
171- 4. Edit ``CHANGELOG.rst `` as follows
155+ 3. Edit ``CHANGELOG.rst `` as follows
172156
173157 - Add new title ``X.Y.Z_ - YEAR-MONTH-DAY `` under ``Unreleased ``, add "Nothing yet" in the unreleased section.
174- - Edit appropriately the lists of links at the bottom of the file.
175- 5. git commit
176- 6. git tag vX.Y.Z
177- 7. git push origin vX.Y.Z
178- 8. git push
179- 9. git checkout master
180- 10. git merge pypi-release
181- 11. git push origin master
158+ - Edit appropriately the list of links at the bottom of the file.
159+ 4. git commit
160+ 5. Tag the new version (e.g., vX.Y.Z). Version strings are automatically
161+ generated from git tags using `setuptools_scm `.
162+ 6. git push origin vX.Y.Z
163+ 7. git push
164+ 8. git checkout master
165+ 9. git merge pypi-release
166+ 10. git push origin master
182167
183168Reference
184169---------
0 commit comments