Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry #32

Merged
merged 12 commits into from
Jun 20, 2024
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
23 changes: 0 additions & 23 deletions .github/workflows/lint.yaml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint and Auto-Fix Code

on:
push:
pull_request:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9' # Specify the Python version you need

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: '1.8.3'

- name: Cache Poetry dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry
~/.virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
run: poetry install

- name: Run pre-commit
run: poetry run pre-commit run --all-files
36 changes: 25 additions & 11 deletions .github/workflows/pytest-actions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# GitHub Actions Configuration for integrated testing using pytest
name: Test osipi

on: [push]
Expand All @@ -15,28 +14,43 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
architecture: x64

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: '1.8.3' # Specify the Poetry version you need

- name: Cache Poetry dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry
~/.virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Update lock file
run: poetry lock --no-update

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Install osipi
run: |
python -m pip install -e .[docs]
python -m pip install -e .[tests]
run: poetry install

- name: Test with pytest
run: |
python -m pip install pytest pytest-cov
pytest --junitxml=junit/test-results.xml --cov=dbdicom tests/
run: poetry run pytest --junitxml=junit/test-results.xml --cov=dbdicom tests/

- name: Upload coverage to Codecov
if: runner.os == 'Windows'
uses: codecov/codecov-action@v3
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ dist
pytest_cache
src/osipi/__pycache__
tests/__pycache__
.coverage
junit
docs/build
docs/source/generated
docs/source/sg_execution_times.rst
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ repos:
rev: v6.1.2 # Use the latest version
hooks:
- id: rstcheck
entry: rstcheck --ignore-messages="(Hyperlink target .* is not referenced.|No directive entry for
.*|Unknown directive type .*|Duplicate explicit target name.*)"
args: [
"--ignore-roles", "ref",
]
args: ["--ignore-directives=autosummary,autofunction,minigallery,image-sg","--ignore-messages=(Hyperlink target *|Duplicate explicit target name*)"]
additional_dependencies: [sphinx]
5 changes: 5 additions & 0 deletions .rstcheck.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[rstcheck]
ignore-directives =
autosummary,
image-sg,
minigallery
101 changes: 101 additions & 0 deletions docs/build/html/_sphinx_design_static/design-tabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// @ts-check

// Extra JS capability for selected tabs to be synced
// The selection is stored in local storage so that it persists across page loads.

/**
* @type {Record<string, HTMLElement[]>}
*/
let sd_id_to_elements = {};
const storageKeyPrefix = "sphinx-design-tab-id-";

/**
* Create a key for a tab element.
* @param {HTMLElement} el - The tab element.
* @returns {[string, string, string] | null} - The key.
*
*/
function create_key(el) {
let syncId = el.getAttribute("data-sync-id");
let syncGroup = el.getAttribute("data-sync-group");
if (!syncId || !syncGroup) return null;
return [syncGroup, syncId, syncGroup + "--" + syncId];
}

/**
* Initialize the tab selection.
*
*/
function ready() {
// Find all tabs with sync data

/** @type {string[]} */
let groups = [];

document.querySelectorAll(".sd-tab-label").forEach((label) => {
if (label instanceof HTMLElement) {
let data = create_key(label);
if (data) {
let [group, id, key] = data;

// add click event listener
// @ts-ignore
label.onclick = onSDLabelClick;

// store map of key to elements
if (!sd_id_to_elements[key]) {
sd_id_to_elements[key] = [];
}
sd_id_to_elements[key].push(label);

if (groups.indexOf(group) === -1) {
groups.push(group);
// Check if a specific tab has been selected via URL parameter
const tabParam = new URLSearchParams(window.location.search).get(
group
);
if (tabParam) {
console.log(
"sphinx-design: Selecting tab id for group '" +
group +
"' from URL parameter: " +
tabParam
);
window.sessionStorage.setItem(storageKeyPrefix + group, tabParam);
}
}

// Check is a specific tab has been selected previously
let previousId = window.sessionStorage.getItem(
storageKeyPrefix + group
);
if (previousId === id) {
// console.log(
// "sphinx-design: Selecting tab from session storage: " + id
// );
// @ts-ignore
label.previousElementSibling.checked = true;
}
}
}
});
}

/**
* Activate other tabs with the same sync id.
*
* @this {HTMLElement} - The element that was clicked.
*/
function onSDLabelClick() {
let data = create_key(this);
if (!data) return;
let [group, id, key] = data;
for (const label of sd_id_to_elements[key]) {
if (label === this) continue;
// @ts-ignore
label.previousElementSibling.checked = true;
}
window.sessionStorage.setItem(storageKeyPrefix + group, id);
}

document.addEventListener("DOMContentLoaded", ready, false);

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions docs/examples/aif/plot_aif_parker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""======================================
"""
======================================
The Parker AIF - a play with variables
======================================
The Parker AIF - a play with variables ====================================== Simulating a Parker
AIF with different settings.
Simulating a Parker AIF with different settings.
"""

Expand Down
Binary file removed docs/source/generated/.DS_Store
Binary file not shown.
16 changes: 0 additions & 16 deletions docs/source/generated/api/osipi.aif_georgiou.rst

This file was deleted.

16 changes: 0 additions & 16 deletions docs/source/generated/api/osipi.aif_parker.rst

This file was deleted.

16 changes: 0 additions & 16 deletions docs/source/generated/api/osipi.aif_weinmann.rst

This file was deleted.

16 changes: 0 additions & 16 deletions docs/source/generated/api/osipi.extended_tofts.rst

This file was deleted.

16 changes: 0 additions & 16 deletions docs/source/generated/api/osipi.tofts.rst

This file was deleted.

Empty file.
38 changes: 0 additions & 38 deletions docs/source/generated/backreferences/osipi.aif_parker.examples

This file was deleted.

Empty file.
Loading
Loading