Skip to content

Commit 27d7cd6

Browse files
authored
Merge pull request #25 from iterorganization/release/2.0.0
Notes for release 2.0.0 =============== Breaking change ------------------- The package name was changed from ``imaspy`` to ``imas`` while porting the code to GitHub https://github.com/iterorganization/IMAS-Python. This shall only affect the import statements in your code. New features and improvements ------------------------------------ - Add `imas.util.to_xarray` to convert a full IDS or only specific paths herein to a Xarray ``Dataset``. See `Convert IMAS-Python IDSs directly to Xarray Datasets` in the documentation for more details. - Implements automatic DD version conversion on `imas.db_entry.DBEntry.get` (conversion during `imas.db_entry.DBEntry.put` is not supported as this is rarely needed and easily worked around). - Enable lazy loading when reading data from a netCDF file. - Minor performance improvement loading data from a netCDF file. - Replace versioneer by setuptools-scm to determine the version of the code. - Use `saxonche` https://pypi.org/project/saxonche/ instead of the JAR for XSL transforms (when building versions of the DD). - Updating the README, CONTRIBUTING guidelines and documentation after making the code open access.
2 parents 08b3c6b + 0ecccbf commit 27d7cd6

File tree

220 files changed

+3742
-6278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+3742
-6278
lines changed

.git_archival.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
imaspy/_version.py export-subst
1+
.git_archival.txt export-subst

.github/workflows/linting.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: linting-and-code-formatting
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-22.04
12+
13+
steps:
14+
- name: Checkout IMAS-Python sources
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
# until saxonche is available in 3.13
21+
# https://saxonica.plan.io/issues/6561
22+
python-version: "<3.13"
23+
24+
- name: Display Python version
25+
run: python -c "import sys; print(sys.version)"
26+
27+
- name: Install the code linting and formatting tools
28+
run: pip install --upgrade 'black >=24,<25' flake8
29+
30+
- name: Check formatting of code with black
31+
run: black --check imas
32+
33+
- name: Check linting with flake8
34+
run: flake8 imas

.github/workflows/publish.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: build-wheel-and-publish-test-pypi
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
# until saxonche is available in 3.13
20+
# https://saxonica.plan.io/issues/6561
21+
python-version: "<3.13"
22+
- name: Install pypa/build
23+
run: >-
24+
python3 -m pip install pip setuptools wheel build
25+
- name: Build a binary wheel and a source tarball
26+
run: python3 -m build .
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: python-package-distributions
31+
path: dist/
32+
33+
publish-to-pypi:
34+
name: Publish IMAS-Python distribution to PyPI
35+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
36+
needs:
37+
- build
38+
runs-on: ubuntu-22.04
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/imas-python
42+
permissions:
43+
id-token: write # IMPORTANT: mandatory for trusted publishing
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
- name: Publish distribution to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
53+
publish-to-testpypi:
54+
name: Publish IMAS-Python distribution to TestPyPI
55+
if: github.ref=='refs/heads/develop' # only publish to TestPyPI on develop pushes
56+
needs:
57+
- build
58+
runs-on: ubuntu-22.04
59+
environment:
60+
name: testpypi
61+
url: https://test.pypi.org/p/imas-python
62+
permissions:
63+
id-token: write # IMPORTANT: mandatory for trusted publishing
64+
steps:
65+
- name: Download all the dists
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: python-package-distributions
69+
path: dist/
70+
- name: Publish distribution to TestPyPI
71+
uses: pypa/gh-action-pypi-publish@unstable/v1
72+
with:
73+
repository-url: https://test.pypi.org/legacy/
74+
verbose: true
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Test using pytest
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-22.04
11+
strategy:
12+
matrix:
13+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] # Test on multiple Python versions
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
21+
uses: actions/setup-python@v4
22+
with:
23+
# until saxonche is available in 3.13
24+
# https://saxonica.plan.io/issues/6561
25+
python-version: ${{ matrix.python-version }}
26+
- name: Display Python version
27+
run: python -c "import sys; print(sys.version)"
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m venv venv
32+
source venv/bin/activate
33+
pip install --upgrade pip setuptools wheel
34+
pip install .[test]
35+
36+
- name: Run tests
37+
run: |
38+
source venv/bin/activate
39+
python -m pytest -n=auto --cov=imas --cov-report=term-missing --cov-report=xml:coverage.xml --cov-report=html:htmlcov --junit-xml=junit.xml
40+
41+
- name: Upload coverage report ${{ matrix.python-version }}
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: coverage-report-${{ matrix.python-version }}
45+
path: htmlcov
46+
47+
- name: Upload test report ${{ matrix.python-version }}
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: test-report-${{ matrix.python-version }}
51+
path: junit.xml
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: verify-sphinx-doc-generation
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-22.04
11+
12+
steps:
13+
- name: Checkout IMAS-Python sources
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
with:
20+
# until saxonche is available in 3.13
21+
# https://saxonica.plan.io/issues/6561
22+
python-version: "<3.13"
23+
24+
- name: Display Python version
25+
run: python -c "import sys; print(sys.version)"
26+
27+
28+
- name: Set up Python virtual environment
29+
run: |
30+
python -m venv venv
31+
source venv/bin/activate
32+
33+
- name: Install build dependencies
34+
run: |
35+
pip install --upgrade pip setuptools wheel build
36+
37+
- name: Build package
38+
run: |
39+
rm -rf dist
40+
python -m build .
41+
42+
- name: Install package and dependencies
43+
run: |
44+
pip install "$(readlink -f dist/*.whl)[docs,netcdf]"
45+
46+
- name: Debug dependencies
47+
run: |
48+
pip freeze
49+
50+
- name: Build Sphinx documentation
51+
run: |
52+
export SPHINXOPTS='-W -n --keep-going'
53+
make -C docs clean html

.gitignore

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,16 @@ ENV/
9191
*.swo
9292

9393
# SCM setuptools
94-
imaspy/version.py
95-
96-
# Saxon symlink or downloaded file
97-
saxon*.jar
94+
imas/_version.py
9895

9996
# IMAS DD
10097
data-dictionary
101-
access-layer
102-
containers/arch/imaspy/
98+
containers/arch/imas/
10399
containers/arch/data-dictionary/
104-
containers/arch/access-layer/
105-
imaspy/assets/IDSDef.zip
100+
imas/assets/IDSDef.zip
106101

107102
# IDS files
108-
*.ids
103+
# *.ids
109104

110105
# ASV folder
111106
/.asv

.readthedocs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "3.11"
7+
jobs:
8+
post_checkout:
9+
- git fetch --unshallow || true
10+
11+
python:
12+
install:
13+
- method: pip
14+
path: .
15+
extra_requirements:
16+
- docs
17+
- netcdf
18+
- h5py
19+
20+
sphinx:
21+
builder: html
22+
configuration: docs/source/conf.py
23+
fail_on_warning: false

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
# Contributing guidelines
22

3-
We welcome any kind of contribution to `imas-python`,
3+
We welcome any kind of contribution to `IMAS-Python`,
44
from a simple comment, a question or even a full fledged pull
55
request.
66
Please first make sure you read and follow the
77
[Code of Conduct](CODE_OF_CONDUCT.md).
88

99
## You think you found a bug in the code, or have a question in its use
10-
1. use the [issue search](https://github.com/iterorganization/imas-python/issues)
10+
1. use the [issue search](https://github.com/iterorganization/IMAS-Python/issues)
1111
to check if someone already created a similar issue;
12-
3. if not, make a **new issue** to describe your problem or question.
12+
2. if not, make a **new issue** to describe your problem or question.
1313
In the case of a bug suspiscion, please try to give all the relevant
1414
information to allow reproducing the error or identifying
15-
its root cause (version of the imas-python, OS and relevant
15+
its root cause (version of the IMAS-Python, OS and relevant
1616
dependencies, snippet of code);
17-
4. apply relevant labels to the issue.
17+
3. apply relevant labels to the issue.
1818

1919
## You want to make or ask some change to the code
20-
1. use the [issue search](https://github.com/iterorganization/imas-python/issues)
20+
1. use the [issue search](https://github.com/iterorganization/IMAS-Python/issues)
2121
to check if someone already proposed a similar idea/change;
22-
3. if not, create a **new issue** to describe what change you would like to see
22+
2. if not, create a **new issue** to describe what change you would like to see
2323
implemented and specify it if you intend to work on it yourself or if some help
2424
will be needed;
25-
4. wait until some kind of consensus is reached about your idea being relevant,
25+
3. wait until some kind of consensus is reached about your idea being relevant,
2626
at which time the issue will be assigned (to you or someone else who can work on
2727
this topic);
28-
5. if you do the development yourself, fork the repository to your own Github
28+
4. if you do the development yourself, fork the repository to your own Github
2929
profile and create your own feature branch off of the latest develop commit.
3030
Make sure to regularly sync your branch with the latest commits from `develop`
3131
(find instructions
3232
[here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork));
33-
6. when your development is ready, create a pull request (find instructions
33+
5. when your development is ready, create a pull request (find instructions
3434
[here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)).
3535

3636

MANIFEST.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
include imaspy/assets/IDSDef.zip
2-
include imaspy/assets/IDSDef2MDSpreTree.xsl
3-
include imaspy/assets/ITER_134173_106_equilibrium.ids
4-
include imaspy/assets/ITER_134173_106_core_profiles.ids
5-
include imaspy/assets/equilibrium.ids
6-
include imaspy/assets/core_profiles.ids
1+
include imas/assets/IDSDef.zip
2+
include imas/assets/IDSDef2MDSpreTree.xsl
3+
include imas/assets/ITER_134173_106_equilibrium.ids
4+
include imas/assets/ITER_134173_106_core_profiles.ids
5+
include imas/assets/equilibrium.ids
6+
include imas/assets/core_profiles.ids

0 commit comments

Comments
 (0)