Skip to content

Commit

Permalink
Build with mkdocs instead of sphinx (#143)
Browse files Browse the repository at this point in the history
Moved `quaternion` to `src/quaternion` to work around bad behavior by RTD

Moved `test` directory to more standard `tests`

Simplified versioning with post-commit amending hook
  • Loading branch information
moble authored Sep 2, 2020
1 parent c4518e2 commit ba75ce9
Show file tree
Hide file tree
Showing 16 changed files with 201 additions and 126 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: build

on: [push, pull_request]
name: tests

on:
push:
paths-ignore:
- 'LICENSE'
- 'MANIFEST.in'
- 'README.md'
- 'docs/**'
- 'mkdocs.yml'
- '.readthedocs.yml'
pull_request:
types: [opened, reopened, ready_for_review, review_requested]

jobs:
build_wheels:
Expand All @@ -16,7 +26,7 @@ jobs:
CIBW_SKIP: cp27-* cp35-* pp27-* pp36-*
CIBW_BEFORE_BUILD: python -c "print(('#'*140+'\n')*10)" && pip install "numpy>=1.13"
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_COMMAND: "pytest {project}/test"
CIBW_TEST_COMMAND: "pytest {project}/tests"

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ quaternion.zip
MANIFEST
_version.py
pip_manylinux1_cache
.envs
notes
9 changes: 5 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
version: 2

mkdocs:
configuration: mkdocs.yml

python:
version: 3.8
system_packages: true
install:
- method: pip
path: .
extra_requirements:
- docs

# The only extra format to build is PDF
formats: [pdf]
- method: setuptools
path: .
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<a href="https://zenodo.org/badge/latestdoi/27896013"><img src="https://zenodo.org/badge/27896013.svg" alt="DOI"></a>
<a href="https://anaconda.org/conda-forge/quaternion"><img align="right" style="margin: 0px 2px" alt="Available from conda on Linux, MacOS, and Windows" src="https://img.shields.io/conda/pn/conda-forge/quaternion.svg"></a>
<a href="https://github.com/moble/quaternion/blob/master/LICENSE"><img align="right" style="margin: 0px 2px" alt="MIT license" src="https://img.shields.io/github/license/moble/quaternion.svg"></a>
[![Test Status](https://github.com/moble/quaternion/workflows/tests/badge.svg)](https://github.com/moble/quaternion/actions)
[![Documentation Status](https://readthedocs.org/projects/quaternion/badge/?version=latest)](https://quaternion.readthedocs.io/en/latest/?badge=latest)
[![PyPI Version](https://img.shields.io/pypi/v/numpy-quaternion?color=)](https://pypi.org/project/numpy-quaternion/)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/quaternion.svg?color=)](https://anaconda.org/conda-forge/quaternion)
[![MIT License](https://img.shields.io/github/license/moble/quaternion.svg)](https://github.com/moble/quaternion/blob/master/LICENSE)
[![DOI](https://zenodo.org/badge/27896013.svg)](https://zenodo.org/badge/latestdoi/27896013)


# Quaternions in numpy

Expand All @@ -13,6 +17,9 @@ with help from Mark Wiebe), but has been rewritten with ideas from
to work with both python 2.x and 3.x (and to fix a few bugs), and
*greatly* expands the applications of quaternions.

See also the pure-python package
[quaternionic](https://github.com/moble/quaternionic).

## Quickstart

```sh
Expand Down Expand Up @@ -75,8 +82,8 @@ python), you can install this package simply as
conda install -c conda-forge quaternion
```

If you prefer to use `pip` (whether or not you use `conda`), you can
instead do
If you prefer to use `pip` (which can be run from within a `conda`
environment), you can instead do

```sh
python -m pip install numpy
Expand All @@ -103,13 +110,11 @@ Finally, there's also the fully manual option of just downloading the
code, changing to the code directory, and running

```sh
python setup.py install
pip install .
```

This should work regardless of the installation method, as long as you
have a compiler hanging around. However, note that you will need to
have at least `numpy` installed *before* this can compile (because
this package uses a header file provided by `numpy`).
have a compiler hanging around.


## Basic usage
Expand Down
21 changes: 21 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
site_name: quaternion

repo_url: https://github.com/moble/quaternion

plugins:
- search
- mktheapidocs:
modules:
quaternion:
section: "Package API:"
source_repo: "https://github.com/moble/quaternion"

theme:
name: 'readthedocs'

extra_javascript:
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js

markdown_extensions:
- pymdownx.arithmatex:
generic: true
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ junit_family="xunit2"
addopts = "-v --tb=short --doctest-glob='' --cov=quaternion --cov-branch --cov-report xml"

[build-system]
requires = ["setuptools", "wheel", "numpy>=1.13"]
requires = ["setuptools!=50.0", "wheel", "numpy>=1.13"]
build-backend = "setuptools.build_meta"

17 changes: 12 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import numpy as np


# Set this first for easier replacement
version = "2020.9.2.16.39.41"

if "win" in platform.lower() and not "darwin" in platform.lower():
extra_compile_args = ["/O2"]
else:
Expand Down Expand Up @@ -43,6 +46,7 @@
setup_metadata = dict(
name="numpy-quaternion", # Uploaded to pypi under this name
packages=["quaternion"], # This is the actual package name, as used in python
package_dir = {'': 'src'}, # Remove `src/` from the package name
url="https://github.com/moble/quaternion",
author="Michael Boyle",
author_email="mob22@cornell.edu",
Expand All @@ -63,13 +67,16 @@
"numba",
],
"docs": [
"sphinx==1.8.4",
"sphinx_rtd_theme",
"numpydoc==0.8.0",
"recommonmark==0.5.0",
"mkdocs",
"mktheapidocs[plugin]",
"pymdown-extensions",
],
"testing": [
"pytest",
"pytest-cov",
]
},
version="2021.0.0-alpha.0",
version=version,
)


Expand Down
Loading

0 comments on commit ba75ce9

Please sign in to comment.