Skip to content

Commit a125d3b

Browse files
Implement reading experimental data and parameters from Scipp CIF (#157)
* Draft a new repo structure for easydiffraction * Remove some unused files * Rename Job.py to job.py * Rename InterfaceFactory to WrapperFactory * Move cryspy.py to easydiffraction/calculators/cryspy/calculator.py * Rename CryspyV2 to CryspyWrapper * Rename CFML to Pycrysfml * Move pdffit2 to a dedicated subfolder * Rename InterfaceTemplate to WrapperBase * Remove cryspy V1 * Move download_from_repository to utils.py * Move cryspy_parser.py to easydiffraction/calculators/cryspy/parser.py * Move cifV2ToV1 from cif.py to cryspy/parser.py * Remove io/cif.py * Fix file headers * Move easydiffraction to src/easydiffraction * Move Interfaces/types.py to .../calculators/wrapper_types.py * Ruff fixes * Bump version to 0.1.8 for test-ipynb step to install the current package * Implement reading experimental data and parameters from Scipp CIF * Fix ruff issues * Fix scipp test * Fixes after discussion and review comments * Apply `ruff format` * Use versioningit to create the package version based on git tags * Update release-drafter. Use RESOLVED_VERSION * Adjust the length of comments to be < 72 * Reduce number of approved release labels * Fetch all tags in actions/checkout for versioningit to work * Add default tag if versioningit doesn't fine one * Get full history with tags to get the version number by versioningit * Try after merging master into develop * Add comments * fix pypi publish workflow to get version by versioningit
1 parent 153191b commit a125d3b

Some content is hidden

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

71 files changed

+3165
-4570
lines changed

.github/release-drafter.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1+
# This file is used to configure the Release Drafter GitHub Action
12
# https://github.com/marketplace/actions/release-drafter
2-
name-template: v$NEXT_PATCH_VERSION 🌈
3-
tag-template: v$NEXT_PATCH_VERSION
3+
4+
name-template: 'v$RESOLVED_VERSION 🌈'
5+
tag-template: 'v$RESOLVED_VERSION'
46
categories:
5-
- title: 🚀 Features
6-
labels:
7-
- feature
8-
- enhancement
9-
- title: 🐛 Bug Fixes
10-
labels:
11-
- fix
12-
- bugfix
13-
- bug
14-
- title: 🧰 Maintenance
15-
labels:
16-
- chore
17-
- documentation
7+
- title: '🚀 Features'
8+
labels: # Labels to use to categorize a pull request as a feature
9+
- 'enhancement'
10+
- title: '🐛 Bug Fixes'
11+
labels: # Labels to use to categorize a pull request as a bug fix
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
labels: # Labels to use to categorize a pull request as a maintenance task
15+
- 'chore'
16+
- 'documentation'
17+
- 'refactor'
1818
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
19+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
1920
version-resolver:
2021
major:
2122
labels:
22-
- major
23+
- 'major'
2324
minor:
2425
labels:
25-
- minor
26+
- 'enhancement'
2627
patch:
2728
labels:
28-
- patch
29+
- 'chore'
30+
- 'documentation'
31+
- 'refactor'
2932
default: patch
3033
template: |
3134
## Changes
35+
3236
$CHANGES

.github/workflows/delete-old-runs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# This workflow will delete old workflow runs based on the input parameters.
1+
# This workflow will delete old workflow runs based on the input
2+
# parameters.
23
# https://github.com/Mattraks/delete-workflow-runs
34

45
name: Delete old workflow runs

.github/workflows/ossar-analysis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Integrates a collection of open source static analysis tools with GitHub code scanning.
1+
# Integrates a collection of open source static analysis tools with
2+
# GitHub code scanning.
23
# https://github.com/github/ossar-action
34

45
name: Run security static analysis

.github/workflows/pypi-publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Builds a Python package and publish it to PyPI when a new tag is created.
1+
# Builds a Python package and publish it to PyPI when a new tag is
2+
# created.
23

34
name: Upload release to PyPI
45

@@ -19,6 +20,8 @@ jobs:
1920
steps:
2021
- name: Check-out repository
2122
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: '0' # full history with tags to get the version number by versioningit
2225

2326
- name: Set up Python
2427
uses: actions/setup-python@v5

.github/workflows/release-drafter.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Drafts your next Release notes as pull requests are merged into default branch
1+
# Drafts your next Release notes as pull requests are merged into
2+
# default branch
23

34
name: Update release draft
45

@@ -14,7 +15,7 @@ jobs:
1415

1516
steps:
1617
- uses: release-drafter/release-drafter@v6
17-
id: create_release
18+
id: create-release
1819
env:
1920
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021

@@ -31,7 +32,7 @@ jobs:
3132
env:
3233
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3334
with:
34-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the create_release step above
35+
upload_url: ${{ steps.create-release.outputs.upload_url }} # This pulls from the create-release step above
3536
asset_path: ./examples.zip
3637
asset_name: examples.zip
3738
asset_content_type: application/zip

.github/workflows/test-code.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
steps:
4545
- name: Checkout repository
4646
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: '0' # full history with tags to get the version number by versioningit
4749

4850
- name: Set up Python
4951
uses: actions/setup-python@v5
@@ -83,6 +85,8 @@ jobs:
8385
steps:
8486
- name: Checkout repository
8587
uses: actions/checkout@v4
88+
with:
89+
fetch-depth: '0' # full history with tags to get the version number by versioningit
8690

8791
- name: Set up Python ${{ matrix.python-version }}
8892
uses: actions/setup-python@v5

.github/workflows/test-ipynb.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
steps:
3535
- name: Checkout repository
3636
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: '0' # full history with tags to get the version number by versioningit
3739

3840
- name: Set up Python
3941
uses: actions/setup-python@v5
@@ -69,6 +71,8 @@ jobs:
6971
steps:
7072
- name: Check-out repository
7173
uses: actions/checkout@v4
74+
with:
75+
fetch-depth: '0' # full history with tags to get the version number by versioningit
7276

7377
- name: Set up Python environment
7478
uses: actions/setup-python@v5

.github/workflows/test-package.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
steps:
5252
- name: Checkout repository
5353
uses: actions/checkout@v4
54+
with:
55+
fetch-depth: '0' # full history with tags to get the version number by versioningit
5456

5557
- name: Set up Python ${{ matrix.python-version }}
5658
uses: actions/setup-python@v5
@@ -104,6 +106,10 @@ jobs:
104106
name: EasyDiffractionLib_py${{ matrix.python-version }}_${{ matrix.os }}_${{ runner.arch }}
105107
path: . # directory to extract downloaded zipped artifacts
106108

109+
# The local version must be higher than the PyPI version for pip to
110+
# prefer the local version. So, after a new release and a new tag,
111+
# remember to merge the master branch with the develop branch,
112+
# and then create a new feature branch from the develop branch.
107113
- name: Install Python package from previous job with 'dev' extras
108114
run: pip install 'easydiffraction[dev]' --find-links=dist
109115

@@ -117,7 +123,7 @@ jobs:
117123
shell: bash
118124
run: >
119125
pytest
120-
--nbmake examples
126+
--nbmake examples/
121127
--ignore-glob='examples/*emcee*'
122128
--nbmake-timeout=300
123129
--color=yes

.github/workflows/verify-pr-labels.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Verifies if a pull request has at least one label from a set of valid labels before it can be merged.
1+
# Verifies if a pull request has at least one label from a set of valid
2+
# labels before it can be merged.
23

34
name: Verify pull request labels
45

@@ -18,6 +19,6 @@ jobs:
1819
uses: jesusvasquez333/[email protected]
1920
with:
2021
github-token: ${{ secrets.GITHUB_TOKEN }}
21-
valid-labels: chore, fix, bugfix, bug, enhancement, feature, dependencies, documentation
22+
valid-labels: 'enhancement, bug, chore, documentation, refactor'
2223
pull-request-number: ${{ github.event.pull_request.number }}
2324
disable-reviews: false

DEVELOPMENT.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Development
22

3-
This is an example of a workflow that describes the development process.
3+
This is an example of a workflow that describes the development process.
44

55
* Clone EasyDiffractionLib repository
66
```console
@@ -27,18 +27,19 @@ This is an example of a workflow that describes the development process.
2727
```console
2828
python -m pip install --upgrade pip
2929
```
30-
* Install easydiffraction from root with `dev` extras for development
30+
* Install easydiffraction from root with `dev` extras for development
3131
```console
3232
pip install '.[dev]'
3333
```
3434
* Make changes in the code
3535
* Run Ruff - Python linter and code formatter (configuration is in pyproject.toml)
3636
```console
37-
ruff check . --fix
37+
ruff check --fix # Linting (overwriting files)
38+
ruff format # Formatting (overwriting files)
3839
```
3940
* Run python tests
4041
```console
41-
pytest tests/ --color=yes -n auto
42+
pytest tests/ --color=yes -n auto
4243
```
4344
* Clear all Jupyter notebooks output
4445
```console

docs/dev/diagrams/classes.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
* src
2+
* easydiffraction (as before)
3+
* calculators (as before)
4+
* cryspy
5+
* calculator.py (instead of calculators/cryspy.py)
6+
* class Cryspy (as before)
7+
* wrapper.py (instead of Interfaces/cryspyV2.py)
8+
* class CryspyWrapper (instead of CryspyV2)
9+
* pdffit2
10+
* calculator.py (instead of calculators/pdffit2.py)
11+
* class Pdffit2 (as before)
12+
* wrapper.py (instead of Interfaces/pdffit2.py)
13+
* class Pdffit2Wrapper (instead of Pdffit2)
14+
* pycrysfml
15+
* calculator.py (instead of calculators/CFML.py)
16+
* class Pycrysfml (instead of CFML)
17+
* wrapper.py (instead of Interfaces/CFML.py)
18+
* class PycrysfmlWrapper (instead of CFML)
19+
* \_\_init\_\_.py
20+
* calculator_base.py (no equivalent in old API? Do we need it?)
21+
* class CalculatorBase (no equivalent in old API? Do we need it?)
22+
* wrapper_factory.py ??? (instead of interface.py)
23+
* class WrapperFactory ??? (instead of InterfaceFactory)
24+
* wrapper_base.py (instead of Interfaces/interfaceTemplate.py)
25+
* class WrapperBase (instead of InterfaceTemplate)
26+
27+
28+
29+
30+
## Old structure
31+
32+
* easydiffraction - As before
33+
* calculators - As before
34+
* \_\_init\_\_.py - As before
35+
* CFML.py - Move to src/easydiffraction/calculators/pycrysfml/calculator.py
36+
* class CFML - Rename to Pycrysfml
37+
* cryspy.py - Move to src/easydiffraction/calculators/cryspy/calculator.py
38+
* class Cryspy - As before
39+
* GSASII.py - Remove
40+
* pdffit2.py - Move to src/easydiffraction/calculators/pdffit2/calculator.py
41+
* class Pdffit2 - As before
42+
* components - Temporarily as before
43+
* \_\_init\_\_.py
44+
* phase.py
45+
* polarization.py
46+
* site.py
47+
* elements - Temporarily as before
48+
* Backgrounds
49+
* \_\_init\_\_.py
50+
* Background.py
51+
* Factorial.py
52+
* Point.py
53+
* Experiments
54+
* \_\_init\_\_.py
55+
* Experiment.py
56+
* Pattern.py
57+
* \_\_init\_\_.py
58+
* Interfaces
59+
* \_\_init\_\_.py
60+
* CFML.py - Move to src/easydiffraction/calculators/pycrysfml/wrapper.py
61+
* class CFML - Rename to PycrysfmlWrapper
62+
* cryspy.py - Remove
63+
* cryspyV2.py - Move to src/easydiffraction/calculators/cryspy/wrapper.py
64+
* class CryspyV2 - Rename to CryspyWrapper
65+
* GSASII.py - Remove
66+
* interfaceTemplate.py - Move to src/easydiffraction/calculators/wrapper_base.py
67+
* class InterfaceTemplate - Rename to WrapperBase
68+
* pdffit2.py - Move to src/easydiffraction/calculators/pdffit2/wrapper.py
69+
* class Pdffit2 - Rename to Pdffit2Wrapper
70+
* types.py
71+
* io - Remove
72+
* \_\_init\_\_.py - Remove
73+
* cif.py - Remove
74+
* cif_reader.py - From EDB. Move to EasyCrystallography
75+
* cryspy_parser.py - Move to calculators/cryspy/...
76+
* download.py - Remove
77+
* def download_from_repository -> Move to easydiffraction/utils.py
78+
* helpers.py - Remove
79+
* Profiles - Temporarily as before
80+
* \_\_init\_\_.py
81+
* Analysis.py
82+
* common.py
83+
* Container.py
84+
* Experiment.py
85+
* JobType.py
86+
* P1D.py
87+
* Sample.py
88+
* \_\_init\_\_.py - As before
89+
* interfaces.py - Move to src/easydiffraction/calculators/wrapper_factory.py
90+
* class InterfaceFactory - Rename to WrapperFactory
91+
* Job.py - Rename to job.py
92+
* Jobs.py - Remove
93+
* main.py - As before
94+
* Runner.py - Remove
95+
* sample.py - Temporarily as before

0 commit comments

Comments
 (0)