Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hydrocomputing/magpylib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f907fa5
Choose a base ref
...
head repository: magpylib/magpylib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f5e375e
Choose a head ref
Loading
Showing 383 changed files with 42,510 additions and 10,077 deletions.
2 changes: 2 additions & 0 deletions .binder/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
libgl1-mesa-dev
xvfb
8 changes: 8 additions & 0 deletions .binder/labconfig/default_setting_overrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@jupyterlab/docmanager-extension:plugin": {
"defaultViewers": {
"markdown": "Jupytext Notebook",
"myst": "Jupytext Notebook"
}
}
}
6 changes: 6 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Stop everything if one command fails
set -e

# See https://github.com/mwouts/jupytext/issues/803#issuecomment-982170660
mkdir -p ${HOME}/.jupyter/labconfig
cp .binder/labconfig/* ${HOME}/.jupyter/labconfig
1 change: 1 addition & 0 deletions .binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.[docs]
10 changes: 10 additions & 0 deletions .binder/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -x
export DISPLAY=:99.0
export PYVISTA_OFF_SCREEN=true
export PYVISTA_USE_IPYVTK=true
which Xvfb
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
set +x
exec "$@"
61 changes: 0 additions & 61 deletions .circleci/config.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 2025.01.22-34-g133af09
_src_path: gh:scientific-python/cookie
backend: hatch
email: magpylib@gmail.com
full_name: Michael Ortner
license: BSD
org: magpylib
project_name: magpylib
project_short_description: Python package for computation of magnetic fields of magnets,
currents and moments.
url: https://github.com/magpylib/magpylib
vcs: true
3 changes: 3 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
89 changes: 89 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed
description of best practices for developing scientific packages.

[spc-dev-intro]: https://learn.scientific-python.org/development/

# Quick development

The fastest way to start with development is to use nox. If you don't have nox,
you can use `pipx run nox` to run it without installing, or `pipx install nox`.
If you don't have pipx (pip for applications), then you can install with
`pip install pipx` (the only case were installing an application with regular
pip is reasonable). If you use macOS, then pipx and nox are both in brew, use
`brew install pipx nox`.

To use, run `nox`. This will lint and test using every installed version of
Python on your system, skipping ones that are not installed. You can also run
specific jobs:

```console
$ nox -s lint # Lint only
$ nox -s tests # Python tests
$ nox -s docs # Build and serve the docs
$ nox -s build # Make an SDist and wheel
```

Nox handles everything for you, including setting up an temporary virtual
environment for each run.

# Setting up a development environment manually

You can set up a development environment by running:

```bash
python3 -m venv .venv
source ./.venv/bin/activate
pip install --group dev -e .
```

If you have the
[Python Launcher for Unix](https://github.com/brettcannon/python-launcher), you
can instead do:

```bash
py -m venv .venv
py -m install --group dev -e .
```

# Pre-commit

You should prepare pre-commit, which will help you by checking that commits pass
required checks:

```bash
pip install pre-commit # or brew install pre-commit on macOS
pre-commit install # Will install a pre-commit hook into the git repo
```

You can also/alternatively run `pre-commit run` (changes only) or
`pre-commit run --all-files` to check even without installing the hook.

# Testing

Use pytest to run the unit checks:

```bash
pytest
```

# Coverage

Use pytest-cov to generate coverage reports:

```bash
pytest --cov=magpylib
```

# Building docs

You can build and serve the docs using:

```bash
nox -s docs
```

You can build the docs only with:

```bash
nox -s docs --non-interactive
```
41 changes: 0 additions & 41 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

4 changes: 0 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"
5 changes: 5 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
exclude:
authors:
- dependabot
- pre-commit-ci
60 changes: 60 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CD

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# Many color libraries just need this to be set to any value, but at least
# one distinguishes color depth, where "3" -> "256-bit color".
FORCE_COLOR: 3

jobs:
dist:
name: Distribution build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v2

publish:
needs: [dist]
name: Publish to PyPI
environment: pypi
permissions:
id-token: write
attestations: write
contents: read
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@v2.3.0
with:
subject-path: "dist/*"

- uses: pypa/gh-action-pypi-publish@release/v1
with:
# Remember to tell (test-)pypi about this repo before publishing
# Remove this line to publish to PyPI
repository-url: https://test.pypi.org/legacy/
Loading