Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WARNING: Do not edit this file manually.
# Any changes will be overwritten by Copier.
_commit: v0.0.5
_commit: v0.4.2
_src_path: gh:easyscience/templates
app_docs_url: https://easyscience.github.io/dynamics-app
app_doi: 10.5281/zenodo.18163581
Expand Down
11 changes: 6 additions & 5 deletions .github/actions/publish-to-pypi/action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: 'Publish to PyPI'
description: 'Publish a built distribution to PyPI using pypa/gh-action-pypi-publish'
description: 'Publish dist/ to PyPI via Trusted Publishing (OIDC)'
inputs:
password:
description: 'PyPI API token (or password) for authentication'
required: true
packages_dir:
description: 'Directory containing the built packages to upload'
required: false
default: 'dist'

runs:
using: 'composite'
steps:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ inputs.password }}
packages-dir: ${{ inputs.packages_dir }}
7 changes: 2 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,8 @@ jobs:
- name: Pre-build site step
run: pixi run python -c "import easydynamics"

# Convert Python scripts in the docs/docs/tutorials/ directory to Jupyter
# notebooks.
# This step also strips any existing output from the notebooks and
# prepares them for documentation.
- name: Convert tutorial scripts to notebooks
# Prepare the Jupyter notebooks for documentation (strip output, etc.).
- name: Prepare notebooks
run: pixi run notebook-prepare

# Execute all Jupyter notebooks to generate output cells (plots, tables, etc.).
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
pypi-publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- name: Check-out repository
uses: actions/checkout@v5
Expand All @@ -23,10 +27,18 @@ jobs:
- name: Set up pixi
uses: ./.github/actions/setup-pixi

# Build the Python package (to dist/ folder)
- name: Create Python package
run: pixi run default-build

# Publish the package to PyPI (from dist/ folder)
# Instead of publishing with personal access token, we use
# GitHub Actions OIDC to get a short-lived token from PyPI.
# New publisher must be previously configured in PyPI at
# https://pypi.org/manage/project/easydynamics/settings/publishing/
# Use the following data:
# Owner: easyscience
# Repository name: dynamics-lib
# Workflow name: pypi-publish.yml
- name: Publish to PyPI
uses: ./.github/actions/publish-to-pypi
with:
password: ${{ secrets.PYPI_PASSWORD }}
8 changes: 8 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ jobs:
continue-on-error: true
shell: bash
run: pixi run nonpy-format-check
# Check formatting of Jupyter Notebooks in the tutorials folder
- name: Prepare notebooks and check formatting
id: check_notebooks_formatting
continue-on-error: true
shell: bash
run: |
pixi run notebook-prepare
pixi run notebook-format-check

# Add summary
- name: Add quality checks summary
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tutorial-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
shell: bash
run: pixi run script-tests

- name: Convert tutorial scripts to notebooks
- name: Prepare notebooks
shell: bash
run: pixi run notebook-prepare

Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ __pycache__/
.venv/
.coverage

# PyInstaller
dist/
build/
*.spec

# MkDocs
docs/site/

Expand Down
47 changes: 22 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,54 @@
repos:
- repo: local
hooks:
# -----------------
# Pre-commit checks
# -----------------
# -------------
# Manual checks
# -------------
- id: pixi-pyproject-check
name: pixi run pyproject-check
entry: pixi run pyproject-check
language: system
pass_filenames: false
stages: [pre-commit]
stages: [manual]

- id: pixi-py-lint-check-staged
name: pixi run py-lint-check-staged
entry: pixi run py-lint-check-pre
- id: pixi-py-lint-check
name: pixi run py-lint-check
entry: pixi run py-lint-check
language: system
pass_filenames: false
stages: [pre-commit]
stages: [manual]

- id: pixi-py-format-check-staged
name: pixi run py-format-check-staged
entry: pixi run py-format-check-pre
- id: pixi-py-format-check
name: pixi run py-format-check
entry: pixi run py-format-check
language: system
pass_filenames: false
stages: [pre-commit]
stages: [manual]

- id: pixi-nonpy-format-check-modified
name: pixi run nonpy-format-check-modified
entry: pixi run nonpy-format-check-modified
- id: pixi-nonpy-format-check
name: pixi run nonpy-format-check
entry: pixi run nonpy-format-check
language: system
pass_filenames: false
stages: [pre-commit]
stages: [manual]

- id: pixi-docs-format-check
name: pixi run docs-format-check
entry: pixi run docs-format-check
language: system
pass_filenames: false
stages: [pre-commit]
stages: [manual]

# ----------------
# Pre-push checks
# ----------------
- id: pixi-nonpy-format-check
name: pixi run nonpy-format-check
entry: pixi run nonpy-format-check
- id: pixi-notebook-format-check
name: pixi run notebook-format-check
entry: pixi run notebook-format-check
language: system
pass_filenames: false
stages: [pre-push]
stages: [manual]

- id: pixi-unit-tests
name: pixi run unit-tests
entry: pixi run unit-tests
language: system
pass_filenames: false
stages: [pre-push]
stages: [manual]
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<p>
<picture>
<!-- light mode logo -->
<source media='(prefers-color-scheme: light)' srcset='https://raw.githubusercontent.com/easyscience/dynamics-lib/refs/heads/master/docs/docs/assets/images/logo_light.svg'>
<source media='(prefers-color-scheme: light)' srcset='https://raw.githubusercontent.com/easyscience/assets-branding/refs/heads/master/easydynamics/logos/light.svg'>
<!-- dark mode logo -->
<source media='(prefers-color-scheme: dark)' srcset='https://raw.githubusercontent.com/easyscience/dynamics-lib/refs/heads/master/docs/docs/assets/images/logo_dark.svg'>
<source media='(prefers-color-scheme: dark)' srcset='https://raw.githubusercontent.com/easyscience/assets-branding/refs/heads/master/easydynamics/logos/dark.svg'>
<!-- default logo == light mode logo -->
<img src='https://raw.githubusercontent.com/easyscience/dynamics-lib/refs/heads/master/docs/docs/assets/images/logo_light.svg' alt='EasyDynamics'>
<img src='https://raw.githubusercontent.com/easyscience/assets-branding/refs/heads/master/easydynamics/logos/light.svg' alt='EasyDynamics'>
</picture>
</p>

**EasyDynamics** is a scientific software for plotting and fitting qens
and ins powder data.
**EasyDynamics** is a scientific software for plotting and fitting QENS
and INS powder data.

<!-- HOME REPOSITORY SECTION -->

**EasyDynamics** is available both as a Python library and as a
cross-platform desktop application.
Expand Down
23 changes: 18 additions & 5 deletions docs/docs/assets/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,27 @@ Adjust the margins and paddings to fit the defaults in MkDocs Material and do no
width: 100% !important;
display: flex !important;
}

.jp-Notebook {
padding: 0 !important;
margin-top: -3em !important;

/* Ensure notebook content stretches across the page */
width: 100% !important;
max-width: 100% !important;

/* mkdocs-material + some notebook HTML end up as flex */
align-items: stretch !important;
}

.jp-Notebook .jp-Cell {
/* Key: flex children often need min-width: 0 to prevent weird shrink */
width: 100% !important;
max-width: 100% !important;
min-width: 0 !important;

/* Removes jupyter cell paddings */
padding-left: 0 !important;
}

/* Removes jupyter cell prefixes, like In[123]: */
Expand All @@ -234,11 +252,6 @@ Adjust the margins and paddings to fit the defaults in MkDocs Material and do no
display: none !important;
}

/* Removes jupyter cell paddings */
.jp-Cell {
padding-left: 0 !important;
}

/* Removes jupyter output cell padding to align with input cell text */
.jp-RenderedText {
padding-left: 0.85em !important;
Expand Down
34 changes: 7 additions & 27 deletions docs/docs/installation-and-setup/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ icon: material/cog-box
**Python 3.11** through **3.12**.

To install and set up EasyDynamics, we recommend using
[**Pixi**](https://prefix.dev), a modern package manager for Windows,
macOS, and Linux.
[**Pixi**](https://pixi.prefix.dev), a modern package manager for
Windows, macOS, and Linux.

!!! note "Main benefits of using Pixi"

Expand Down Expand Up @@ -46,16 +46,9 @@ This section describes the simplest way to set up EasyDynamics using
```txt
pixi add python=3.12
```
- Add the GNU Scientific Library (GSL) dependency:
- Add EasyDynamics to the Pixi environment from PyPI:
```txt
pixi add gsl
```
- Add EasyDynamics with the `visualization` extras, which include
optional dependencies used for simplified visualization of charts and
tables. This can be especially useful for running the Jupyter Notebook
examples:
```txt
pixi add --pypi "easydynamics[visualization]"
pixi add --pypi easydynamics
```
- Add a Pixi task to run EasyDynamics commands easily:
```txt
Expand Down Expand Up @@ -160,20 +153,7 @@ simply delete and recreate the environment.
### Installing from PyPI { #from-pypi }

EasyDynamics is available on **PyPI (Python Package Index)** and can be
installed using `pip`.

We recommend installing the latest release of EasyDynamics with the
`visualization` extras, which include optional dependencies used for
simplified visualization of charts and tables. This can be especially
useful for running the Jupyter Notebook examples. To do so, use the
following command:

```txt
pip install 'easydynamics[visualization]'
```

If only the core functionality is needed, the library can be installed
simply with:
installed using `pip`. To do so, use the following command:

```txt
pip install easydynamics
Expand Down Expand Up @@ -216,10 +196,10 @@ example:
pip install git+https://github.com/easyscience/dynamics-lib@develop
```

To include extra dependencies (e.g., visualization):
To include extra dependencies (e.g., dev):

```txt
pip install 'easydynamics[visualization] @ git+https://github.com/easyscience/dynamics-lib@develop'
pip install 'easydynamics[dev] @ git+https://github.com/easyscience/dynamics-lib@develop'
```

## How to Run Tutorials
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ icon: material/information-slab-circle

## Description

**EasyDynamics** is a scientific software for plotting and fitting qens
and ins powder data.
**EasyDynamics** is a scientific software for plotting and fitting QENS
and INS powder data.

**EasyDynamics** is available both as a Python library and as a
cross-platform desktop application.
Expand Down
3 changes: 1 addition & 2 deletions docs/docs/tutorials/components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import scipp as sc\n",
"\n",
"from easydynamics.sample_model import DampedHarmonicOscillator\n",
"from easydynamics.sample_model import DeltaFunction\n",
Expand Down Expand Up @@ -105,8 +106,6 @@
"metadata": {},
"outputs": [],
"source": [
"import scipp as sc\n",
"\n",
"x1 = sc.linspace(dim='x', start=-2.0, stop=2.0, num=100, unit='meV')\n",
"x2 = sc.linspace(dim='x', start=-2.0 * 1e3, stop=2.0 * 1e3, num=101, unit='microeV')\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/tutorials/detailed_balance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"%matplotlib widget\n",
"import numpy as np\n",
"\n",
"from easydynamics.utils import _detailed_balance_factor as detailed_balance_factor"
"from easydynamics.utils import _detailed_balance_factor as detailed_balance_factor\n",
"\n",
"%matplotlib widget"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/tutorials/diffusion_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a50c67ec",
"id": "3",
"metadata": {},
"outputs": [],
"source": [
Expand Down
Loading
Loading