Skip to content

Commit 5388945

Browse files
authored
Merge pull request #20 from max-models/version-0-1
Version 0.1
2 parents 8be4b82 + 9f67fe4 commit 5388945

33 files changed

+1208
-2588
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ipynb filter=strip-notebook-output
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
12+
...
13+
14+
**To Reproduce**
15+
16+
...
17+
18+
**Expected behavior**
19+
20+
...
21+
22+
**Proposed solution**
23+
24+
...
25+
26+
**Additional context**
27+
28+
...
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the feature**
11+
12+
...
13+
14+
15+
**Proposed implementation**
16+
17+
...
18+
19+
**Additional context**
20+
21+
...

.github/workflows/ci_pipeline.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
1-
name: Python CI
1+
name: Testing
22

33
on:
44
push:
55
branches:
66
- main
7+
- devel
78
pull_request:
89
branches:
910
- main
11+
- devel
1012

1113
jobs:
1214
test:
1315
runs-on: ubuntu-latest
14-
16+
# strategy:
17+
# matrix:
18+
# python-version: ['3.12']
1519
steps:
1620
- name: Check out the code
1721
uses: actions/checkout@v3
1822

19-
- name: Set up Python
20-
uses: actions/setup-python@v4
21-
with:
22-
python-version: '3.x' # Specify the Python version, e.g., '3.8'
23+
# - name: Set up Python
24+
# uses: actions/setup-python@v4
25+
# with:
26+
# python-version: ${{ matrix.python-version }}
2327

24-
- name: Install dependencies
28+
- name: Install python dependencies
2529
run: |
2630
python -m pip install --upgrade pip
27-
pip install .
31+
pip install ".[dev]"
2832
2933
- name: Run tests
3034
run: |
31-
pytest # or replace with your testing command
35+
coverage run -m pytest .
36+
coverage report --sort=cover
37+
38+
- name: Test tutorials
39+
run: |
40+
jupyter nbconvert --to notebook --execute tutorials/*.ipynb --output-dir=/tmp --ExecutePreprocessor.timeout=300

.github/workflows/docs.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["devel", "main"] # TODO: Set to main only after release
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build-and-deploy:
19+
runs-on: ubuntu-latest
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Install pandoc
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y pandoc
32+
33+
- name: Install Python dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install ".[docs]"
37+
38+
- name: Build Sphinx docs
39+
run: |
40+
cd docs
41+
make html
42+
43+
- name: Setup Pages
44+
uses: actions/configure-pages@v5
45+
46+
- name: Upload built docs
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: docs/build/html/
50+
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Python Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.10"
20+
21+
- name: Install build tools
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install build twine
25+
26+
- name: Build the package
27+
run: python -m build
28+
29+
- name: Publish to PyPI
30+
env:
31+
TWINE_USERNAME: __token__ # Use API token
32+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
33+
run: twine upload dist/*
34+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Static analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devel
8+
pull_request:
9+
branches:
10+
- main
11+
- devel
12+
13+
jobs:
14+
static-analysis:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout the code
18+
uses: actions/checkout@v4
19+
20+
- name: Download and run cloc
21+
run: |
22+
curl -s https://raw.githubusercontent.com/AlDanial/cloc/master/cloc > cloc
23+
chmod +x cloc
24+
./cloc --version
25+
./cloc $(git ls-files)
26+
27+
- name: Code formatting with black
28+
run: |
29+
pip install black
30+
pip install "black[jupyter]"
31+
black --check src/
32+
black --check tutorials/
33+
34+
- name: Code formatting with isort
35+
run: |
36+
pip install isort
37+
isort --check src/
38+
isort --check tutorials/
39+
40+
- name: Code formatting with prospector
41+
continue-on-error: true
42+
run: |
43+
pip install mypy
44+
mypy src/
45+
46+
- name: Code formatting with prospector
47+
continue-on-error: true
48+
run: |
49+
pip install prospector
50+
prospector src/
51+
52+
- name: Code formatting with ruff
53+
continue-on-error: true
54+
run: |
55+
pip install ruff
56+
ruff check src/
57+
58+
- name: Code formatting with pylint
59+
continue-on-error: true
60+
run: |
61+
pip install pylint
62+
pylint src/

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0 # Use the latest stable version
4+
hooks:
5+
- id: check-added-large-files # Prevent giant files from being committed.
6+
args: ["--maxkb=1000"]
7+
- id: check-merge-conflict # Check for files that contain merge conflict strings.
8+
- id: check-toml # Attempts to load all TOML files to verify syntax.
9+
- id: check-yaml # Attempts to load all yaml files to verify syntax.
10+
args: ["--unsafe"]
11+
12+
- repo: https://github.com/kynan/nbstripout
13+
rev: 0.8.1
14+
hooks:
15+
- id: nbstripout # remove jupyter notebook cell output

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# maxplotlib
22

3+
This is a wrapper for matplotlib so I can produce figures with consistent formatting. It also has some pretty nice additions such as using layers and exporting to tikz.
4+
5+
Related packages: [maxtikzlib](https://github.com/max-models/maxtikzlib) and [maxtexlib](https://github.com/max-models/maxtexlib).
6+
37
## Install
48

59
Create and activate python environment
@@ -16,8 +20,10 @@ Install the code and requirements with pip
1620
pip install -e .
1721
```
1822

19-
Run the code with
23+
Additional dependencies for developers can be installed with
2024

2125
```
22-
maxplotlib
23-
```
26+
pip install -e ".[dev]"
27+
```
28+
29+
Some examples can be found in `tutorials/`

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0 commit comments

Comments
 (0)