Skip to content

Commit e92c1ff

Browse files
Merge pull request #125 from ken-lauer/bld_pypi
BLD/CI: specify and test against pip (PyPI) dependencies
2 parents d618372 + 3896911 commit e92c1ff

File tree

10 files changed

+93
-35
lines changed

10 files changed

+93
-35
lines changed

.github/actions/conda-setup/action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ inputs:
1313
description: "Conda environment name to create"
1414
required: false
1515
default: "beamphysics-dev"
16-
extras:
17-
description: "Package extras to install"
18-
required: true
19-
default: "dev"
2016
runs:
2117
using: "composite"
2218
steps:
@@ -54,7 +50,3 @@ runs:
5450
mamba install -n ${{ inputs.env_name }} python=${{ inputs.python-version }}
5551
fi
5652
if: steps.cache.outputs.cache-hit != 'true'
57-
- name: Setup the environment
58-
shell: bash -l {0}
59-
run: |
60-
python -m pip install .[${{ inputs.extras }}]

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
name: "Build docs"
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222
with:
2323
fetch-depth: 0
2424
- uses: ./.github/actions/conda-setup

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
lint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v6
1212
with:
1313
fetch-depth: 1
1414

.github/workflows/pypi_upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 0
1717
- name: Set up Python 3.9

.github/workflows/tests-pip.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: pypi - tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
release:
7+
types:
8+
- published
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17+
name: Test Suite
18+
steps:
19+
- uses: actions/checkout@v6
20+
with:
21+
fetch-depth: 0
22+
- uses: actions/setup-python@v6
23+
with:
24+
python-version: "${{ matrix.python-version }}"
25+
- name: Install openPMD-beamphysics (pypi deps)
26+
shell: bash -l -e -o pipefail {0}
27+
run: |
28+
python -m pip install .[dev]
29+
- name: Test environment conda package list
30+
shell: bash -l {0}
31+
run: |
32+
conda list
33+
- name: Run unit tests
34+
shell: bash -l -e -o pipefail {0}
35+
run: |
36+
echo -e '## Test results\n\n```' >> "$GITHUB_STEP_SUMMARY"
37+
pytest -v 2>&1 | tee -a "$GITHUB_STEP_SUMMARY"
38+
echo '```' >> "$GITHUB_STEP_SUMMARY"

.github/workflows/tests.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run tests
1+
name: conda - tests
22

33
on:
44
pull_request:
@@ -13,23 +13,26 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python-version: ["3.9", "3.10", "3.11", "3.12"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1717

1818
name: Test Suite
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v6
2121
with:
2222
fetch-depth: 0
2323
- uses: ./.github/actions/conda-setup
2424
with:
2525
python-version: ${{ matrix.python-version }}
26-
extras: "dev"
26+
- name: Install openPMD-beamphysics (conda deps)
27+
shell: bash -l -e -o pipefail {0}
28+
run: |
29+
python -m pip install --no-deps .
2730
- name: Test environment conda package list
2831
shell: bash -l {0}
2932
run: |
3033
conda list
3134
- name: Run unit tests
32-
shell: bash -l {0}
35+
shell: bash -l -e -o pipefail {0}
3336
run: |
3437
echo -e '## Test results\n\n```' >> "$GITHUB_STEP_SUMMARY"
3538
pytest -v 2>&1 | tee -a "$GITHUB_STEP_SUMMARY"

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# openPMD-beamphysics
22

3-
**`Documentation`** |
4-
------------------- |
5-
[![Documentation](https://img.shields.io/badge/beamphysics-documentation-blue.svg)](https://christophermayes.github.io/openPMD-beamphysics/) |
3+
| **`Documentation`** |
4+
| -------------------------------------------------------------------------------------------------------------------------------------------- |
5+
| [![Documentation](https://img.shields.io/badge/beamphysics-documentation-blue.svg)](https://christophermayes.github.io/openPMD-beamphysics/) |
66

77
Tools for analyzing and viewing particle data in the openPMD standard, extension beamphysics.
88

9-
https://github.com/openPMD/openPMD-standard/blob/upcoming-2.0.0/EXT_BeamPhysics.md
9+
<https://github.com/openPMD/openPMD-standard/blob/upcoming-2.0.0/EXT_BeamPhysics.md>
1010

11-
Installing openpmd-beamphysics
12-
==============================
11+
# Installing openpmd-beamphysics
1312

1413
Installing `openpmd-beamphysics` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with:
1514

@@ -27,3 +26,30 @@ It is possible to list all of the versions of `openpmd-beamphysics` available on
2726

2827
```
2928
conda search openpmd-beamphysics --channel conda-forge
29+
```
30+
31+
## Development environment
32+
33+
A conda environment file is provided in this repository and may be used for a
34+
development environment.
35+
36+
To create a new conda environment using this file, do the following:
37+
38+
```bash
39+
git clone https://github.com/ChristopherMayes/openPMD-beamphysics
40+
cd openPMD-beamphysics
41+
conda env create -n pmd_beamphysics-dev -f environment.yml
42+
conda activate beamphysics-dev
43+
python -m pip install --no-deps -e .
44+
```
45+
46+
Alternatively, with a virtualenv and pip:
47+
48+
```bash
49+
git clone https://github.com/ChristopherMayes/openPMD-beamphysics
50+
cd openPMD-beamphysics
51+
52+
python -m venv beamphysics-venv
53+
source pmd_beamphysics-venv/bin/activate
54+
python -m pip install -e .
55+
```

environment.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ dependencies:
1414
- pytest-benchmark
1515
- pytest-cov
1616
- jupyterlab>=3
17-
- pygments
17+
# Documentation
1818
- mkdocs
1919
- mkdocstrings
2020
- mkdocs-material
2121
- mkdocs-jupyter
2222
- mkdocstrings-python
23+
- pygments
2324
- pip
24-
- pip:
25-
- mkdocstrings-python

mkdocs.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,3 @@ plugins:
112112
show_submodules: false
113113
group_by_category: true
114114
unwrap_annotated: true
115-
import:
116-
- https://docs.python.org/3/objects.inv
117-
- https://docs.h5py.org/en/stable/objects.inv

pyproject.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ classifiers = [
1111
"Topic :: Scientific/Engineering",
1212
]
1313
dependencies = [
14-
# All core dependencies must be sourced from conda (conda-forge).
15-
# See ``environment.yml`` for further information.
14+
"numpy",
15+
"scipy>=1.0.0",
16+
"matplotlib",
17+
"h5py",
18+
"python-dateutil",
1619
]
1720
description = "Tools for analyzing and viewing particle data in the openPMD standard, extension beamphysics."
1821
dynamic = ["version"]
@@ -22,10 +25,10 @@ readme = { file = "README.md", content-type = "text/markdown" }
2225
requires-python = ">=3.9"
2326

2427
[project.optional-dependencies]
25-
dev = ["pytest", "pytest-cov"]
28+
dev = ["pytest", "pytest-cov", "pytest-benchmark"]
2629
doc = [
27-
"mkdocs==1.5.2",
28-
"mkdocs-jupyter==0.24.6",
30+
"mkdocs",
31+
"mkdocs-jupyter",
2932
"mkdocs-macros-plugin",
3033
"mkdocs-material",
3134
"mkdocstrings",
@@ -49,8 +52,8 @@ file = "LICENSE"
4952

5053
[tool.pytest.ini_options]
5154
addopts = "--cov=pmd_beamphysics/"
52-
log_cli_level = "info"
53-
log_level = "debug"
55+
log_cli_level = "INFO"
56+
log_level = "DEBUG"
5457
testpaths = ["tests"]
5558

5659
[tool.setuptools_scm]

0 commit comments

Comments
 (0)