Skip to content

Commit d42db80

Browse files
committed
Update DEVGUIDE.rst
1 parent e4e1003 commit d42db80

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

docs/DEVGUIDE.rst

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Once you have a compiler installed run:
2828
2929
- ``make`` (and the accompanying `Makefile`_) is the designated tool to build,
3030
install, run tests and do pretty much anything that involves development.
31-
This also includes Windows, meaning that you can run `make command` similarly
32-
as if you were on UNIX (see `make.bat`_ and `winmake.py`_). Some useful
33-
commands are:
31+
This also includes Windows, meaning that you can run `make.bat command`
32+
similarly as if you were on UNIX (see `make.bat`_ and `winmake.py`_). Some
33+
useful commands are:
3434

3535
.. code-block:: bash
3636
@@ -49,15 +49,9 @@ Once you have a compiler installed run:
4949

5050
.. code-block:: bash
5151
52-
make test ARGS=psutil/tests/test_system.py::TestDiskAPIs::test_disk_usage
52+
make test ARGS=psutil/tests/test_system.py # UNIX
5353
54-
- If you're working on a new feature and you wish to compile & test it "on the
55-
fly" from a test script, this is a quick & dirty way to do it:
56-
57-
.. code-block:: bash
58-
59-
make test ARGS=test_script.py # on UNIX
60-
make test test_script.py # on Windows
54+
set ARGS=psutil/tests/test_system.py && make test # Windows
6155
6256
- Do not use ``sudo``. ``make install`` installs psutil as a limited user in
6357
"edit" / development mode, meaning you can edit psutil code on the fly while
@@ -67,18 +61,27 @@ Once you have a compiler installed run:
6761

6862
.. code-block:: bash
6963
70-
make test PYTHON=python3.5 # UNIX
71-
make test -p C:\python35\python.exe # Windows
64+
make test PYTHON=python3.8 # UNIX
65+
66+
set PYTHON=C:\Python38\python.exe && make test # Windows
7267
7368
Coding style
7469
------------
7570

76-
- Python code strictly follows `PEP-8`_ styling guide. In addition we use
77-
``black`` and ``ruff`` code formatters / linters. This is enforced by a GIT
78-
commit hook, installed via ``make install-git-hooks``, which will reject the
79-
commit if code is not compliant.
80-
- C code should follow `PEP-7`_ styling guides, but things are more relaxed.
81-
- Linters are enforced also for ``.rst`` and ``.toml`` files.
71+
All style and formatting checks are automatically enforced both **locally on
72+
each `git commit`** and **remotely via a GitHub Actions pipeline**.
73+
74+
- A **Git commit hook**, installed with `make install-git-hooks`, runs all
75+
formatters and linters before each commit. The commit is rejected if any
76+
check fails.
77+
- **Python** code follows the `PEP-8`_ style guide. We use `black` and `ruff`
78+
for formatting and linting.
79+
- **C** code generally follows the `PEP-7`_ style guide, with formatting
80+
enforced by `clang-format`.
81+
- **Other files** (`.rst`, `.toml`, `.md`, `.yml`) are also validated by
82+
dedicated command-line linters.
83+
- The **GitHub Actions pipeline** re-runs all these checks to ensure
84+
consistency (via ``make lint-all``).
8285

8386
Code organization
8487
-----------------
@@ -88,6 +91,7 @@ Code organization
8891
psutil/__init__.py # main psutil namespace ("import psutil")
8992
psutil/_ps{platform}.py # platform-specific python wrapper
9093
psutil/_psutil_{platform}.c # platform-specific C extension
94+
psutil/arch/{platform}/*.c # platform-specific C extension
9195
psutil/tests/test_process|system.py # main test suite
9296
psutil/tests/test_{platform}.py # platform-specific test suite
9397
@@ -100,7 +104,7 @@ Typically, this is what you do:
100104
- Write the platform specific implementation in ``psutil/_ps{platform}.py``
101105
(e.g. `psutil/_pslinux.py`_).
102106
- If the change requires C code, write the C implementation in
103-
``psutil/_psutil_{platform}.c`` (e.g. `psutil/_psutil_linux.c`_).
107+
``psutil/arch/{platform}/file.c`` (e.g. `psutil/arch/linux/cpu.c`).
104108
- Write a generic test in `psutil/tests/test_system.py`_ or
105109
`psutil/tests/test_process.py`_.
106110
- If possible, write a platform-specific test in

0 commit comments

Comments
 (0)