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
17 changes: 17 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 3f79959
_src_path: gh:scipp/copier_template
description: 'Python package to read McStas data and export as python objects in different
formats or as other files.


'
max_python: '3.12'
min_python: '3.10'
namespace_package: ''
nightly_deps: scipp,scippnexus,mcstasscript
orgname: mccode-dev
prettyname: McStasToX
projectname: mcstastox
related_projects: Scipp,ScippNexus
year: 2025
13 changes: 11 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
# Note: We are not listing package-ecosystem: "github-actions". This causes
# noise in all template instances. Instead dependabot.yml in scipp/copier_template
# triggers updates of github-actions in the *template*. We then use `copier update`
# in template instances.
- package-ecosystem: "pip"
directory: "/requirements"
schedule:
interval: "weekly"
target-branch: "main"
allow:
- dependency-name: "scipp"
dependency-type: "direct"
- dependency-name: "mcstasscript"
dependency-type: "direct"
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches:
- main
- release
pull_request:

jobs:
# formatting:
# name: Formatting and static analysis
# runs-on: 'ubuntu-24.04'
# outputs:
# min_python: ${{ steps.vars.outputs.min_python }}
# min_tox_env: ${{ steps.vars.outputs.min_tox_env }}
# steps:
# - uses: actions/checkout@v4
# - name: Get Python version for other CI jobs
# id: vars
# run: |
# echo "min_python=$(< .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT"
# echo "min_tox_env=py$(sed 's/\.//g' < .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT"
# - uses: actions/setup-python@v5
# with:
# python-version-file: '.github/workflows/python-version-ci'
# - uses: pre-commit/[email protected]
# with:
# extra_args: --all-files
# - uses: pre-commit-ci/[email protected]
# if: always()
# with:
# msg: Apply automatic formatting

# tests:
# name: Tests
# needs: formatting
# strategy:
# matrix:
# os: ['ubuntu-24.04']
# python:
# - version: '${{needs.formatting.outputs.min_python}}'
# tox-env: '${{needs.formatting.outputs.min_tox_env}}'
# uses: ./.github/workflows/test.yml
# with:
# os-variant: ${{ matrix.os }}
# python-version: ${{ matrix.python.version }}
# tox-env: ${{ matrix.python.tox-env }}
# secrets: inherit

docs:
# needs: tests
uses: ./.github/workflows/docs.yml
with:
publish: false
linkcheck: ${{ github.ref == 'refs/heads/main' }}
branch: ${{ github.head_ref == '' && github.ref_name || github.head_ref }}
secrets: inherit
100 changes: 100 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Docs

on:
workflow_dispatch:
inputs:
publish:
default: false
type: boolean
version:
default: ''
required: false
type: string
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
workflow_call:
inputs:
publish:
default: false
type: boolean
version:
default: ''
required: false
type: string
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
linkcheck:
description: 'Run the link checker. If not set the link checker will not be run.'
default: false
required: false
type: boolean

env:
VERSION: ${{ inputs.version }}

jobs:
docs:
name: Build documentation
runs-on: 'ubuntu-24.04'
env:
ESS_PROTECTED_FILESTORE_USERNAME: ${{ secrets.ESS_PROTECTED_FILESTORE_USERNAME }}
ESS_PROTECTED_FILESTORE_PASSWORD: ${{ secrets.ESS_PROTECTED_FILESTORE_PASSWORD }}
DOCSWORKDIR: ".tox/docs"
steps:
# - run: sudo apt install --yes graphviz pandoc
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch == '' && github.ref_name || inputs.branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0 # history required so cmake can determine version
- uses: actions/setup-python@v5
with:
python-version-file: '.github/workflows/python-version-ci'
- uses: mamba-org/setup-micromamba@v2
with:
init-shell: bash
environment-name: mcstas
create-args: >-
python=3.10

# Manually building the docs.
# We(I) couldn't figure out how we do it with `tox` yet...
- run: mkdir -p ${DOCSWORKDIR}
# - run: python -m pip install -r requirements/ci.txt
- run: |
which python
python -m pip install --upgrade pip
python -m pip install -r requirements/docs.txt
micromamba install -c conda-forge mcstas=3.5 -y
shell: micromamba-shell {0}
- run: |
mcstas --version
python -m sphinx -j2 -v -b html -d ${DOCSWORKDIR}/docs_doctrees docs html
python -m sphinx -j2 -v -b doctest -d ${DOCSWORKDIR}/docs_doctrees docs html
# tox -e releasedocs -- "${VERSION}"
find html -type f -name "*.ipynb" -not -path "html/_sources/*" -delete
shell: micromamba-shell {0}
# Cleaned up the docs.
# - run: tox -e docs
# if: ${{ inputs.version == '' }}
- run: tox -e linkcheck
if: ${{ inputs.linkcheck }}
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: docs_html
path: html/
- run: echo "::notice::https://remote-unzip.deno.dev/${{ github.repository }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}"

- uses: JamesIves/[email protected]
if: ${{ inputs.publish }}
with:
branch: gh-pages
folder: html
single-commit: true
1 change: 1 addition & 0 deletions .github/workflows/python-version-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test

on:
workflow_dispatch:
inputs:
os-variant:
default: 'ubuntu-24.04'
type: string
python-version:
type: string
tox-env:
default: 'test'
type: string
pip-recipe:
default: 'requirements/ci.txt'
type: string
coverage-report:
default: false
type: boolean
checkout_ref:
default: ''
type: string
workflow_call:
inputs:
os-variant:
default: 'ubuntu-24.04'
type: string
python-version:
type: string
tox-env:
default: 'test'
type: string
pip-recipe:
default: 'requirements/ci.txt'
type: string
coverage-report:
default: false
type: boolean
checkout_ref:
default: ''
type: string

jobs:
package-test:
runs-on: ${{ inputs.os-variant }}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: python -m pip install --upgrade pip
- run: python -m pip install .
- run: python tests/package_test.py
name: Run package tests

test:
runs-on: ${{ inputs.os-variant }}
env:
ESS_PROTECTED_FILESTORE_USERNAME: ${{ secrets.ESS_PROTECTED_FILESTORE_USERNAME }}
ESS_PROTECTED_FILESTORE_PASSWORD: ${{ secrets.ESS_PROTECTED_FILESTORE_PASSWORD }}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: python -m pip install --upgrade pip
- run: python -m pip install -r ${{ inputs.pip-recipe }}
- run: tox -e ${{ inputs.tox-env }}
- uses: actions/upload-artifact@v4
if: ${{ inputs.coverage-report }}
with:
name: CoverageReport
path: coverage_html/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ docs/generated/
*.c
*.instr
*.out
*.dSYM
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Welcome to the developer side of McStasToX!
Contributions are always welcome.
This includes reporting bugs or other issues, submitting pull requests, requesting new features, etc.

If you need help with using McStasToX or contributing to it, have a look at the GitHub [discussions](https://github.com/mccode-dev/McStasToX/discussions) and start a new [Q&A discussion](https://github.com/mccode-dev/McStasToX/discussions/categories/q-a) if you can't find what you are looking for.
If you need help with using McStasToX or contributing to it, have a look at the GitHub [discussions](https://github.com/mccode-dev/mcstastox/discussions) and start a new [Q&A discussion](https://github.com/mccode-dev/mcstastox/discussions/categories/q-a) if you can't find what you are looking for.

For bug reports and other problems, please open an [issue](https://github.com/mccode-dev/McStasToX/issues/new) in GitHub.
For bug reports and other problems, please open an [issue](https://github.com/mccode-dev/mcstastox/issues/new) in GitHub.

You are welcome to submit pull requests at any time.
But to avoid having to make large modifications during review or even have your PR rejected, please first open an issue first to discuss your idea!

Check out the subsections of the [Developer documentation](https://mccode-dev.github.io/McStasToX/developer/index.html) for details on how McStasToX is developed.
Check out the subsections of the [Developer documentation](https://mccode-dev.github.io/mcstastox/developer/index.html) for details on how McStasToX is developed.

## Code of conduct

This project is a community effort, and everyone is welcome to contribute.
Everyone within the community is expected to abide by our [code of conduct](https://github.com/mccode-dev/McStasToX/blob/main/CODE_OF_CONDUCT.md).
Everyone within the community is expected to abide by our [code of conduct](https://github.com/mccode-dev/mcstastox/blob/main/CODE_OF_CONDUCT.md).
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
[![PyPI badge](http://img.shields.io/pypi/v/McStasToX.svg)](https://pypi.python.org/pypi/McStasToX)
[![Anaconda-Server Badge](https://anaconda.org/mccode-dev/McStasToX/badges/version.svg)](https://anaconda.org/mccode-dev/McStasToX)
[![PyPI badge](http://img.shields.io/pypi/v/mcstastox.svg)](https://pypi.python.org/pypi/mcstastox)
[![Anaconda-Server Badge](https://anaconda.org/mccode-dev/mcstastox/badges/version.svg)](https://anaconda.org/mccode-dev/mcstastox)
[![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](LICENSE)

# McStasToX
Expand Down Expand Up @@ -34,7 +34,7 @@ pip install mcstastox
> Note that still an early version of the package is on pip, but the API is not stable yet.

```sh
python -m pip install McStasToX
python -m pip install mcstastox
```

## Basic use
Expand Down
2 changes: 1 addition & 1 deletion docs/_templates/doc_version.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!-- This will display the version of the docs -->
Current McStasToX version: {{ version }} (<a href="https://github.com/mccode-dev/McStasToX/releases">older versions</a>).
Current McStasToX version: {{ version }} (<a href="https://github.com/mccode-dev/mcstastox/releases">older versions</a>).
4 changes: 2 additions & 2 deletions docs/about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ To cite a specific version of McStasToX, select the desired version on Zenodo to

## Older versions of the documentation

Older versions of the documentation pages can be found under the assets of each [release](https://github.com/mccode-dev/McStasToX/releases).
Older versions of the documentation pages can be found under the assets of each [release](https://github.com/mccode-dev/mcstastox/releases).
Simply download the archive, unzip and view locally in a web browser.

## Source code and development

McStasToX is hosted and developed [on GitHub](https://github.com/mccode-dev/McStasToX).
McStasToX is hosted and developed [on GitHub](https://github.com/mccode-dev/mcstastox).
2 changes: 1 addition & 1 deletion docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Classes

```{eval-rst}
.. currentmodule:: McStasToX
.. currentmodule:: mcstastox

.. autosummary::
:toctree: ../generated/classes
Expand Down
13 changes: 8 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
#

try:
release = get_version("McStasToX")
release = get_version("mcstastox")
version = ".".join(release.split('.')[:3]) # CalVer
except PackageNotFoundError:
logger.info(
Expand Down Expand Up @@ -151,19 +151,19 @@
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/mccode-dev/McStasToX",
"url": "https://github.com/mccode-dev/mcstastox",
"icon": "fa-brands fa-github",
"type": "fontawesome",
},
{
"name": "PyPI",
"url": "https://pypi.org/project/McStasToX/",
"url": "https://pypi.org/project/mcstastox/",
"icon": "fa-brands fa-python",
"type": "fontawesome",
},
{
"name": "Conda",
"url": "https://anaconda.org/mccode-dev/McStasToX",
"url": "https://anaconda.org/mccode-dev/mcstastox",
"icon": "fa-custom fa-anaconda",
"type": "fontawesome",
},
Expand Down Expand Up @@ -192,7 +192,7 @@
# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'McStasToXdoc'
htmlhelp_basename = 'mcstastoxdoc'

# -- Options for Matplotlib in notebooks ----------------------------------

Expand Down Expand Up @@ -241,4 +241,7 @@ def do_not_plot(*args, **kwargs):
linkcheck_ignore = [
# Specific lines in Github blobs cannot be found by linkcheck.
r'https?://github\.com/.*?/blob/[a-f0-9]+/.+?#',
# Linkcheck seems to be denied access by some DOI resolvers.
# Since DOIs are supposed to be permanent, we don't need to check them.'
r'https://doi\.org/',
]
Loading
Loading