-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sync_w_python2_version
- Loading branch information
Showing
97 changed files
with
1,756 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: build-pyorbit | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
|
||
|
||
apple-silicon: | ||
runs-on: macos-14 | ||
steps: | ||
- name: Install packages | ||
run: | | ||
brew reinstall pkg-config fftw | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build | ||
run: | | ||
.github/workflows/pip-build.sh | ||
- name: Test | ||
run: | | ||
.github/workflows/pip-tests.sh | ||
- name: Print Versions | ||
run: | | ||
.github/workflows/pip-versions.sh | ||
|
||
centos-stream: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: quay.io/centos/centos:stream9 | ||
steps: | ||
- name: Install packages | ||
run: | | ||
dnf group install -y "Development Tools" | ||
dnf install -y python3-devel fftw3-devel | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build | ||
run: | | ||
.github/workflows/pip-build.sh | ||
- name: Test | ||
run: | | ||
.github/workflows/pip-tests.sh | ||
- name: Print Versions | ||
run: | | ||
.github/workflows/pip-versions.sh | ||
ubuntu: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:latest | ||
steps: | ||
- name: Install packages | ||
run: | | ||
apt-get update -y | ||
apt-get install -y build-essential python3 libfftw3-dev python3-venv libpython3-dev pkg-config git | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build | ||
run: | | ||
.github/workflows/pip-build.sh | ||
- name: Test | ||
run: | | ||
.github/workflows/pip-tests.sh | ||
- name: Print Versions | ||
run: | | ||
.github/workflows/pip-versions.sh | ||
conda: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:latest | ||
steps: | ||
- name: Install Conda | ||
run: | | ||
apt update -y | ||
apt install -y curl gpg git build-essential | ||
curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg | ||
install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg | ||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list | ||
apt update -y | ||
apt install -y conda | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build | ||
run: | | ||
.github/workflows/conda-build.sh | ||
- name: Test | ||
run: | | ||
.github/workflows/conda-tests.sh | ||
- name: Print Versions | ||
run: | | ||
.github/workflows/conda-versions.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
. /opt/conda/etc/profile.d/conda.sh | ||
conda env create -n po3 --file environment.yml | ||
conda activate po3 | ||
pip install -U meson-python setuptools setuptools-scm | ||
pip install --no-build-isolation --editable . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. /opt/conda/etc/profile.d/conda.sh | ||
conda activate po3 | ||
cd examples/SNS_Linac/pyorbit3_linac_model/ | ||
python pyorbit3_sns_sts_linac_mebt_hebt2.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
. /opt/conda/etc/profile.d/conda.sh | ||
conda activate po3 | ||
python -V | ||
conda -V | ||
pip -V | ||
gcc -v | ||
python -m setuptools_scm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
python3 -m venv .po3 | ||
. .po3/bin/activate | ||
pip install -U pip | ||
pip install -r requirements.txt | ||
pip install -U setuptools | ||
pip install --no-build-isolation --editable . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
. .po3/bin/activate | ||
cd examples/SNS_Linac/pyorbit3_linac_model/ | ||
python pyorbit3_sns_sts_linac_mebt_hebt2.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
. .po3/bin/activate | ||
python -V | ||
pip -V | ||
gcc -v | ||
python -m setuptools_scm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# PyOrbit3 with meson | ||
|
||
This uses meson-python to build orbit package. | ||
|
||
There is no **setup.py** file, instead we have **meson.build**. | ||
**pyproject.toml** is changed to use meson. | ||
|
||
This is experimental setup that is work in progress. | ||
The pure python part is built with hierarchical **meson.build** files in **py/**. | ||
The C++ setup is combined in one file **src/meson.build**. | ||
|
||
### Main modifications in C++ code | ||
1. **src/libmain/** is not used, still there for reference but will be gone soon. | ||
2. **src/core/** contains one C++ file per module inside _orbit.core_ | ||
3. The files **wrap_XXXX.cc** were modified to correctly reference modules | ||
```cpp | ||
// line | ||
PyObject* mod = PyImport_ImportModule("_bunch"); | ||
// replaced with | ||
PyObject* mod = PyImport_ImportModule("orbit.core.bunch"); | ||
``` | ||
|
||
|
||
|
||
# Setup | ||
|
||
## 0. Required software | ||
|
||
One needs compilers, python and libfftw (and potentially mpi). | ||
See [PyORBIT3](https://github.com/PyORBIT-Collaboration/PyORBIT3) for external | ||
requirements. | ||
|
||
|
||
## 1. Preparing environment | ||
|
||
First step is to clone the source code from meson branch: | ||
|
||
```bash | ||
git clone -b meson https://github.com/azukov/PyORBIT3.git | ||
``` | ||
|
||
Initialize new virtual environment and install packages | ||
|
||
``` | ||
python -m venv .mes | ||
source .mes/bin/activate | ||
pip install -U pip | ||
pip install -r requirements | ||
``` | ||
Edit **meson.build** and set correct paths/flags for python/fftw3 headers and libraries | ||
|
||
## 2. Build | ||
|
||
To install orbit package in development mode run following: | ||
```bash | ||
pip install --no-build-isolation --editable . | ||
``` | ||
No rebuild is necessary, just edit **py/** or **src/** and meson will rebuild as needed when import happens. | ||
|
||
|
||
## 3. Run examples | ||
|
||
Special examples used for meson testing | ||
|
||
```bash | ||
cd examples/meson | ||
python imports_test.py | ||
python uspas_test.py | ||
``` | ||
|
||
SNS linac example | ||
```bash | ||
cd examples/SNS_Linac/pyorbit3_linac_model/ | ||
python pyorbit3_sns_linac_mebt_hebt2.py | ||
``` |
Oops, something went wrong.