Skip to content

Align package structure with scientific-python template #16

New issue

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

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

Already on GitHub? # to your account

Merged
merged 55 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9cbb630
draft
Alexboiboi Apr 13, 2025
dead26c
style: pre-commit fixes
pre-commit-ci[bot] Apr 13, 2025
b9d4584
improve dataset handling and package data inclusion
Alexboiboi Apr 13, 2025
248943d
pre-commit run
Alexboiboi Apr 13, 2025
fe11363
Merge branch 'use-scientific-python-pypackage-base' of https://github…
Alexboiboi Apr 13, 2025
bca6daa
style: pre-commit fixes
pre-commit-ci[bot] Apr 13, 2025
4b245a2
readd deps
Alexboiboi Apr 13, 2025
c73d941
readd doc examples
Alexboiboi Apr 13, 2025
e3f489e
style: pre-commit fixes
pre-commit-ci[bot] Apr 13, 2025
eed217f
readd myst_nb
Alexboiboi Apr 13, 2025
80fc5b1
Merge branch 'use-scientific-python-pypackage-base' of https://github…
Alexboiboi Apr 13, 2025
15280a9
style: pre-commit fixes
pre-commit-ci[bot] Apr 13, 2025
2084ef1
add myst_nb
Alexboiboi Apr 13, 2025
2efa4cc
Merge branch 'use-scientific-python-pypackage-base' of https://github…
Alexboiboi Apr 13, 2025
066748a
remove uv.lock
Alexboiboi Apr 13, 2025
f839e31
fix linting errors
Alexboiboi Apr 13, 2025
f7d96ff
typing
Alexboiboi Apr 13, 2025
2610a9e
style: pre-commit fixes
pre-commit-ci[bot] Apr 13, 2025
c5c7d2e
remove mypy checks for now
Alexboiboi Apr 18, 2025
3e85eab
avoid W005 — Wheel contains common toplevel name in library
Alexboiboi Apr 18, 2025
16b134b
style: pre-commit fixes
pre-commit-ci[bot] Apr 18, 2025
144d81d
add hatch configs
Alexboiboi Apr 18, 2025
ce87784
update
Alexboiboi Apr 18, 2025
9c78fd5
add myst extensions
Alexboiboi Apr 18, 2025
7cdf1f3
update docs deps
Alexboiboi Apr 18, 2025
f8e6f76
style: pre-commit fixes
pre-commit-ci[bot] Apr 18, 2025
4c562f9
ignore jupyter notebook files
Alexboiboi Apr 18, 2025
1daa641
fix get_dataset
Alexboiboi Apr 18, 2025
9b9f7d2
fix linting
Alexboiboi Apr 18, 2025
da1aad5
test
Alexboiboi Apr 18, 2025
b6b431e
test
Alexboiboi Apr 18, 2025
80d4411
test
Alexboiboi Apr 18, 2025
006df1e
test dummpy version.py
Alexboiboi Apr 18, 2025
397ceb8
remove version.py
Alexboiboi Apr 18, 2025
c85b7b1
update
Alexboiboi Apr 18, 2025
9233797
update
Alexboiboi Apr 18, 2025
918bd17
update
Alexboiboi Apr 18, 2025
5f9022a
update
Alexboiboi Apr 18, 2025
e4549a4
update
Alexboiboi Apr 18, 2025
0237e04
test
Alexboiboi Apr 18, 2025
1725ec8
add openblas scipy on pypy
Alexboiboi Apr 18, 2025
f295f8b
openblas only for mypy
Alexboiboi Apr 18, 2025
4d9c4f8
Update CHANGELOG.md
Alexboiboi Apr 18, 2025
196af46
Update CHANGELOG.md
Alexboiboi Apr 18, 2025
b7c6240
style: pre-commit fixes
pre-commit-ci[bot] Apr 18, 2025
e9a75e7
Update CHANGELOG.md
Alexboiboi Apr 18, 2025
0565ddb
style: pre-commit fixes
pre-commit-ci[bot] Apr 18, 2025
29e92d2
use uv installer for hatch
Alexboiboi Apr 20, 2025
186dfcb
Merge branch 'use-scientific-python-pypackage-base' of https://github…
Alexboiboi Apr 20, 2025
20d859b
set min python version to 3.11
Alexboiboi Apr 20, 2025
c080a55
style: pre-commit fixes
pre-commit-ci[bot] Apr 20, 2025
ab9a555
uv upgrade
Alexboiboi Apr 20, 2025
3f58ffb
pypy-3.11
Alexboiboi Apr 20, 2025
212a8e6
linting
Alexboiboi Apr 20, 2025
03bcd7f
use macos-latest
Alexboiboi Apr 20, 2025
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
40 changes: 0 additions & 40 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-32-g5e4b0c5
_src_path: gh:scientific-python/cookie
backend: hatch
email: alexabois+magpylib@gmail.com
full_name: Alexandre Boisselet
license: BSD
org: magpylib
project_name: magpylib-material-response
project_short_description: Python package extending the Magpylib library by providing
magnetic field analysis for soft materials and demagnetization of hard magnets.
url: https://github.com/magpylib/magpylib-material-response
vcs: true
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

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 -v -e .[dev]
```

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 -v -e .[dev]
```

# 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-material-response
```

# 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
```
46 changes: 0 additions & 46 deletions .github/ISSUE_TEMPLATES/bug_report.md

This file was deleted.

16 changes: 0 additions & 16 deletions .github/ISSUE_TEMPLATES/documentation-improvements.md

This file was deleted.

24 changes: 0 additions & 24 deletions .github/ISSUE_TEMPLATES/feature_request.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.2.3
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
Loading