Skip to content

Commit c7f7cdb

Browse files
authored
Merge branch 'main' into chore-upload-sonarcloud-json
2 parents 28b05bc + 0886013 commit c7f7cdb

File tree

5 files changed

+71
-204
lines changed

5 files changed

+71
-204
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ guide](https://acts-project.github.io/building_acts.html). If you find a bug,
3434
have a feature request, or want to contribute to ACTS, have a look at the
3535
[contribution guidelines](CONTRIBUTING.md).
3636

37+
### Python bindings
38+
39+
ACTS is also available as a Python package via `pip install pyacts`. See the
40+
[Python bindings documentation](https://acts-project.github.io/python_bindings.html)
41+
for details.
42+
3743
## Versioning and public API
3844

3945
Release versions follow [semantic versioning](https://semver.org/spec/v2.0.0.html)

docs/Doxyfile.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ WARN_LOGFILE =
774774
INPUT = index.md \
775775
groups \
776776
pages \
777-
examples \
778777
namespaces.dox \
779778
experimental.md \
780779
../Core/include \

docs/DoxygenLayout.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121

2222
<tab type="user" url="@ref versioning" visible="yes" title="Versioning and public API"/>
2323

24-
<tab type="usergroup" title="Examples" url="[none]">
25-
<tab type="user" url="@ref python_bindings" visible="yes" title="Python bindings"/>
26-
</tab>
27-
2824
<tab type="topics" visible="yes" title="" intro=""/>
2925

3026

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,67 @@
1-
@page python_bindings Python Bindings for Examples
1+
@defgroup python_bindings Python Bindings
2+
@brief Python bindings for the ACTS tracking toolkit, available via PyPI or built from source.
23

3-
The examples part of ACTS ships with python bindings using the `pybind11`
4-
library. Building these bindings can be enabled via
5-
`-DACTS_BUILD_EXAMPLES_PYTHON_BINDINGS=ON`, and requires a python installation
6-
including the development files to be installed. You can then build the special
7-
target `ActsPythonBindings` to build everything that can be accessed in python.
4+
# Installation from PyPI
85

9-
The build will create a setup script in `$BUILD/this_acts_withdeps.sh` which
10-
modifies `$PYTHONPATH` so that you can import the `acts` module in python.
6+
The easiest way to get the ACTS Python bindings is via [PyPI](https://pypi.org/project/pyacts/):
117

12-
Here is a minimal example of a python script using the example bindings, which
13-
sets up the particle propagation and runs a few events.
8+
```console
9+
pip install pyacts
10+
```
11+
12+
A nightly development build is also available from [TestPyPI](https://test.pypi.org/project/pyacts/):
13+
14+
```console
15+
pip install -i https://test.pypi.org/simple pyacts
16+
```
17+
18+
The `pyacts` distribution includes bindings for the core library, Fatras, and
19+
the Examples framework.
20+
21+
> [!warning]
22+
> The PyPI package does not include all optional plugins (e.g. DD4hep/ODD, Geant4, ROOT).
23+
> To use those, build from source with the relevant CMake options enabled.
24+
25+
> [!note]
26+
> Even though the name of the PyPI package is `pyacts`, the python module must be imported
27+
> as `import acts`.
28+
29+
# Building from source
30+
31+
To use the full Python bindings including optional components such as DD4hep/ODD, Geant4, ROOT, build ACTS from
32+
source with `ACTS_BUILD_PYTHON_BINDINGS=ON`.
33+
34+
```console
35+
cmake -B <build> -S <source> -DACTS_BUILD_PYTHON_BINDINGS=ON
36+
```
37+
38+
Bindings for additional components (plugins, Examples framework) are built automatically if
39+
they are enabled.
40+
41+
```console
42+
cmake -B <build> -S <source> -DACTS_BUILD_PYTHON_BINDINGS=ON -DACTS_BUILD_EXAMPLES=ON
43+
```
44+
45+
Building requires a Python installation including the development headers.
46+
You can then build the special target `ActsPythonBindings` to build everything
47+
that can be accessed from Python:
48+
49+
```console
50+
cmake --build <build> -- ActsPythonBindings
51+
```
52+
53+
The build creates a setup script `$BUILD/this_acts_withdeps.sh` which modifies
54+
`$PYTHONPATH` so that you can import the `acts` module in Python.
55+
56+
> [!warning]
57+
> The old flag `ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS` is **deprecated**.
58+
> Use `ACTS_BUILD_PYTHON_BINDINGS` (together with `ACTS_BUILD_EXAMPLES` if
59+
> needed) instead.
60+
61+
# Minimal example
62+
63+
Here is a minimal example of a Python script using the bindings, which sets up
64+
particle propagation and runs a few events.
1465

1566
@snippet{trimleft} examples/test_generic.py Basic propagation example with GenericDetector
1667

@@ -23,16 +74,16 @@ They can be found in `$REPO_ROOT/Examples/Scripts/Python`. Make sure you have ru
2374
source $BUILD/this_acts_withdeps.sh
2475
```
2576

26-
to make sure python can find the `acts` module.
77+
to make sure Python can find the `acts` module.
2778

2879
## Python based unit tests
2980

3081
A number of unit tests based on the `pytest` library are shipped with the
3182
repository. They are located under `$REPO_ROOT/Examples/Python/tests`, and
32-
intend to cover the public API of the python bindings. A set of tests also
33-
executed the standalone example scripts.
83+
intend to cover the public API of the Python bindings. A set of tests also
84+
execute the standalone example scripts.
3485

35-
To run these python based tests, `pytest` and a few other dependencies need
86+
To run these Python based tests, `pytest` and a few other dependencies need
3687
to be installed. They can be installed via `pip install -r
3788
Examples/Python/tests/requirements.txt` from the repository root. You can
3889
then simply run `pytest` from the repository root.

docs/pages/examples/python_bindings.md

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)