# Vendored mplstereonet

A copy of the `mplstereonet` package, carrying one deliberate local change. Like
the other packages here it is a **fallback**: `qgSurf/__init__.py` appends
`external/` to `sys.path`, so an installed mplstereonet wins and this copy is
reached only when there is none. See the caveat at the bottom, which matters
more here than elsewhere.

    version  0.6.3
    source   https://pypi.org/project/mplstereonet/
    upstream https://github.com/joferkington/mplstereonet
    checked  2026-08-25 against a pristine 0.6.3 sdist

Do not trust `__init__.py` for the version: it reads `__version__ = '0.6-dev'`,
and so does upstream 0.6.3 - it was simply never bumped. The 0.6.3 identification
here comes from comparing the files, not from that string. `LICENSE`,
`MANIFEST.in` and `README.rst` are kept alongside; every other file is identical
to upstream except the one below.

## The one local change

In `stereonet_axes.py`, `StereonetAxes.cla` was renamed to `clear`:

    -    def cla(self):
    -        """Identical to Axes.cla (This docstring is overwritten)."""
    -        Axes.cla(self)
    +    def clear(self):
    +        Axes.clear(self)

    -    cla.__doc__ = Axes.cla.__doc__
    +    clear.__doc__ = Axes.clear.__doc__

matplotlib renamed the Axes method that subclasses are meant to override from
`cla` to `clear`.

**This is not load-bearing today.** matplotlib still carries a shim - it sets
`_subclass_uses_cla` when a subclass overrides `cla`, and calls it from
`clear()`. Checked on matplotlib 3.10.9: the unpatched 0.6.3 draws a stereonet
with no deprecation warning at all, and geogst's stereonet notebooks pass in CI
on matplotlib 3.11 against an unpatched 0.6.3 from PyPI. The change is insurance
against the shim going away, not a repair of something broken.

**It is not upstream.** As of 2026-03 the master branch still defines `cla`. The
change is ours alone, so it survives only as long as it is carried here.

## Maintenance status

Releases are stale, the repository is not. The last release is 0.6.3, from
2023-11-25. The GitHub repository, however, was pushed to on 2026-03-04, is not
archived, and is still merging pull requests. So the project is not abandoned in
the way the PyPI history alone suggests, and the `clear` fix above is small
enough to be worth offering upstream rather than carried indefinitely.

## The caveat that matters

`sys.path.append` puts `external/` last, so **when mplstereonet is installed in
the QGIS Python environment, that copy is used and this patch is bypassed**. The
fix therefore guards only the fallback path - the rarer one. If matplotlib ever
drops the `_subclass_uses_cla` shim, what breaks is the installed copy, and the
patched copy here will not prevent it.

Anyone acting on this should decide deliberately between: making the fix apply to
whichever mplstereonet is loaded, giving this copy priority for this package
alone, or getting the change upstream so the question stops mattering. Simply
keeping the patch here addresses the case least likely to occur.

## Re-checking

Fetch the 0.6.3 sdist and compare the package directory against this one. The
only differences should be the three extra files named above and the `clear`
change in `stereonet_axes.py`.

Last checked: 2026-08-25.
