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

Update tooling #53

Merged
merged 9 commits into from
Feb 16, 2023
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
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[run]
omit=matplotlib_scalebar/_version.py
omit=
matplotlib_scalebar/_version.py
matplotlib_scalebar/test_*.py
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
matplotlib-version: [latest, dev]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
Expand All @@ -36,17 +36,15 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip codecov
pip install --upgrade -e .
pip install -r requirements-test.txt
python -m pip install --upgrade pip hatch codecov

- name: Install matplotlib dev
if: matrix.matplotlib-version == 'dev'
run: |
pip install --upgrade git+https://github.com/matplotlib/matplotlib

- name: Test
run: pytest
run: hatch run test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
matplotlib_scalebar/_version.py

# Created by https://www.gitignore.io/api/code,python,pycharm,eclipse
# Edit at https://www.gitignore.io/?templates=code,python,pycharm,eclipse
Expand Down
13 changes: 8 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
repos:
- repo: https://github.com/psf/black
rev: stable
rev: 23.1.0
hooks:
- id: black
language_version: python3.7
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
rev: v4.4.0
hooks:
- id: requirements-txt-fixer
- id: check-yaml
- id: check-yaml
- id: check-toml
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.245'
hooks:
- id: ruff
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
![CI](https://github.com/ppinard/matplotlib-scalebar/workflows/CI/badge.svg)
![PyPI](https://img.shields.io/pypi/v/matplotlib-scalebar)

---

**Documentation**: See below

**Source Code**: https://github.com/ppinard/matplotlib-scalebar

---

Provides a new artist for [matplotlib](https://matplotlib.org) to display a scale bar, aka micron bar.
It is particularly useful when displaying calibrated images plotted using
`plt.imshow(...)`.
Expand All @@ -23,7 +31,10 @@ For development installation from the git repository:

```bash
git clone [email protected]:ppinard/matplotlib-scalebar.git
pip install -e matplotlib-scalebar
cd matplotlib-scalebar
pip install hatch
hatch env create
hatch run test
```

## Getting started
Expand Down
3 changes: 1 addition & 2 deletions doc/example_angular.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from matplotlib_scalebar.scalebar import ScaleBar, ANGULAR

delta = 0.025
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-(X ** 2) - Y ** 2)
Z1 = np.exp(-(X**2) - Y**2)
Z2 = np.exp(-((X - 1) ** 2) - (Y - 1) ** 2)
Z = (Z1 - Z2) * 2

Expand Down
3 changes: 2 additions & 1 deletion doc/splashscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

ax.imshow(im, "gray")

# According to Wikipedia, "the bean shaped grain in the bottom left corner is about 50 μm long."
# According to Wikipedia,
# "the bean shaped grain in the bottom left corner is about 50 μm long."
scalebar = ScaleBar(
50 / 144, "um", location="lower right", width_fraction=0.02, border_pad=1, pad=0.5
)
Expand Down
5 changes: 1 addition & 4 deletions matplotlib_scalebar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
from ._version import get_versions

__version__ = get_versions()["version"]
del get_versions
from ._version import __version__
Loading