Skip to content

Commit 3e68174

Browse files
committed
Merge branch 'master' of https://github.com/najuzilu/sphinxcontrib-prettyproof into add-manifest
2 parents d12cba1 + dfe1376 commit 3e68174

37 files changed

+276
-199
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ dist/
1212
.coverage
1313
coverage.*
1414
coverage.xml
15+
.tox/

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ repos:
99
- id: check-yaml
1010
- id: end-of-file-fixer
1111
- id: trailing-whitespace
12-
- id: flake8
12+
13+
- repo: https://gitlab.com/pycqa/flake8
14+
rev: 3.7.9
15+
hooks:
16+
- id: flake8
1317

1418
- repo: https://github.com/psf/black
1519
rev: 20.8b1

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# sphinxcontrib-prettyproof
22

3-
[![Documentation Status](https://readthedocs.org/projects/sphinxcontrib-prettyproof/badge/?version=latest)](https://sphinxcontrib-prettyproof.readthedocs.io/en/latest/?badge=latest)
3+
[![Documentation Status][rtd-badge]][rtd-link]
4+
[![Github-CI][github-ci]][github-link]
5+
[![Coverage Status][codecov-badge]][codecov-link]
46

57
**A proof extension for Sphinx**.
68

@@ -29,3 +31,16 @@ extensions = ["sphinxcontrib.prettyproof"]
2931
## Documentation
3032

3133
See the [Sphinxcontrib Pretty Proof documentation](https://sphinxcontrib-prettyproof.readthedocs.io/en/latest/) for more information.
34+
35+
36+
## Contributing
37+
38+
We welcome all contributions! See the [EBP Contributing Guide](https://executablebooks.org/en/latest/contributing.html) for general details, and below for guidance specific to sphinxcontrib-prettyproof.
39+
40+
41+
[rtd-badge]: https://readthedocs.org/projects/sphinxcontrib-prettyproof/badge/?version=latest
42+
[rtd-link]: https://sphinxcontrib-prettyproof.readthedocs.io/en/latest/?badge=latest
43+
[github-ci]: https://github.com/najuzilu/sphinxcontrib-prettyproof/workflows/continuous-integration/badge.svg?branch=master
44+
[github-link]: https://github.com/najuzilu/sphinxcontrib-prettyproof
45+
[codecov-badge]: https://codecov.io/gh/najuzilu/sphinxcontrib-prettyproof/branch/master/graph/badge.svg
46+
[codecov-link]: https://codecov.io/gh/najuzilu/sphinxcontrib-prettyproof

docs/source/index.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@
55
66
install
77
syntax
8+
contribute
9+
testing
810
zreferences
911
```
1012

11-
[![Documentation Status](https://readthedocs.org/projects/sphinxcontrib-prettyproof/badge/?version=latest)](https://sphinxcontrib-prettyproof.readthedocs.io/en/latest/?badge=latest)
13+
[![Documentation Status][rtd-badge]][rtd-link]
14+
[![Github-CI][github-ci]][github-link]
15+
[![Coverage Status][codecov-badge]][codecov-link]
1216

1317
**A proof extension for Sphinx**.
1418

1519
This package contains a [Sphinx](http://www.sphinx-doc.org/en/master/) extension
1620
for producing proof, theorem, axiom, lemma, definition, criterion, remark, conjecture,
1721
corollary, algorithm, exercise, example, property, observation and proposition directives.
1822

23+
1924
```{warning}
2025
sphinxcontrib-prettyproof `0.0.2` is in a development stage and may change rapidly.
2126
```
@@ -58,3 +63,11 @@ extensions = ["sphinxcontrib.prettyproof"]
5863
```
5964

6065
you may then build using `make html` and the extension will be used by your `Sphinx` project.
66+
67+
68+
[rtd-badge]: https://readthedocs.org/projects/sphinxcontrib-prettyproof/badge/?version=latest
69+
[rtd-link]: https://sphinxcontrib-prettyproof.readthedocs.io/en/latest/?badge=latest
70+
[github-ci]: https://github.com/najuzilu/sphinxcontrib-prettyproof/workflows/continuous-integration/badge.svg?branch=master
71+
[github-link]: https://github.com/najuzilu/sphinxcontrib-prettyproof
72+
[codecov-badge]: https://codecov.io/gh/najuzilu/sphinxcontrib-prettyproof/branch/master/graph/badge.svg
73+
[codecov-link]: https://codecov.io/gh/najuzilu/sphinxcontrib-prettyproof

docs/source/install.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,14 @@ then run:
1818
```bash
1919
python setup.py install
2020
```
21+
22+
## Package development
23+
24+
To install `sphinxcontrib-prettyproof` for package development:
25+
26+
```bash
27+
git clone https://github.com/najuzilu/sphinxcontrib-prettyproof
28+
cd sphinxcontrib-prettyproof
29+
git checkout master
30+
pip install -e .[all]
31+
```

docs/source/syntax.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ This documentation utilized the [Markedly Structured Text (MyST)](https://myst-p
88

99
A proof directive can be included using the `proof:proof` pattern. Unlike the other directives provided through this extension, a proof directive does not include any parameters nor does it require any arguments. A proof directive can easily be referenced through [targets](https://myst-parser.readthedocs.io/en/latest/using/syntax.html#targets-and-cross-referencing).
1010

11+
The following option is supported:
12+
13+
* `class` : text
14+
15+
Value of the proof’s class attribute which can be used to add custom CSS or JavaScript.
16+
1117

1218
**Example**
1319

docs/source/testing.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Testing
2+
3+
For code tests, `sphinxcontrib-prettyproof` uses [pytest](https://docs.pytest.org/).
4+
5+
Run the tests with the following command:
6+
7+
```shell
8+
>> cd sphinxcontrib-prettyproof
9+
>> pip install -e .[testing]
10+
>> pytest
11+
```
12+
13+
To run the tests in multiple isolated environments, you can also run [tox](https://tox.readthedocs.io/)
14+
15+
```shell
16+
>> cd sphinxcontrib-prettyproof
17+
>> tox
18+
```
19+
20+
To test the build of documentation run
21+
22+
```shell
23+
>> cd sphinxcontrib-prettyproof
24+
>> tox docs-update
25+
```
26+
27+
or
28+
29+
```shell
30+
>> cd sphinxcontrib-prettyproof/docs
31+
>> make clean
32+
>> make html
33+
```
34+
35+
## Unit Testing
36+
37+
We use [pytest](https://docs.pytest.org/en/latest/) for testing, [pytest-regression](https://pytest-regressions.readthedocs.io/en/latest/) to regenerate expected outcomes of test and [pytest-cov](https://pytest-cov.readthedocs.io/en/latest/) for checking coverage.
38+
39+
To run tests with coverage and an html coverage report:
40+
41+
```bash
42+
pytest -v --cov=sphinxcontrib --cov-report=html
43+
```
44+
45+
## Writing Tests
46+
47+
The module `sphinx.testing` is used to run sphinx builds for tests, in a temporary directory.
48+
49+
If creating a new source folder for test files, folder name should start with `test-`.
50+
Your folder should reside inside the `tests/books` directory, which has been set as the root directory for tests.
51+
52+
The tests should start with:
53+
54+
```python
55+
@pytest.mark.sphinx('html', testroot="mybook")
56+
```
57+
In the above declaration, `html` builder is used. And `mybook` is the source folder which was created with the name `test-mybook` inside `tests/books` folder.
58+
59+
Sphinx Application API is available as a parameter to all the test functions:
60+
61+
```python
62+
@pytest.mark.sphinx('html', testroot="mybook")
63+
def mytest(app):
64+
```
65+
66+
## Code Style
67+
68+
Code is formatted using [black](https://github.com/ambv/black) and code style is tested using [flake8](http://flake8.pycqa.org) with style configuration set in `.flake8`.
69+
70+
Installing using `[code style]` will make the [pre-commit](https://pre-commit.com/) package available which will make sure the style is met before your commits are submitted. In addition, it will reformat for any lint errors.
71+
72+
To install `pre-commit` run the following
73+
74+
```bash
75+
cd sphinxcontrib-prettyproof
76+
pre-commit install
77+
```
78+
79+
`black` and `flake8` can be run separately:
80+
81+
```shell
82+
>>> black .
83+
>>> flake8 .
84+
```

setup.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,27 @@
1717

1818
URL = f"https://github.com/najuzilu/sphinxcontrib-prettyproof/archive/{VERSION}.tar.gz"
1919

20+
# Define all extras
21+
extras = {
22+
"code_style": ["flake8<3.8.0,>=3.7.0", "black", "pre-commit==1.17.0"],
23+
"testing": [
24+
"coverage",
25+
"pytest>=3.6,<4",
26+
"pytest-cov",
27+
"pytest-regressions",
28+
"beautifulsoup4",
29+
"myst-parser",
30+
],
31+
"rtd": [
32+
"sphinx>=3.0",
33+
"sphinx-book-theme",
34+
"sphinxcontrib-bibtex",
35+
"myst-parser",
36+
],
37+
}
38+
39+
extras["all"] = set(ii for jj in extras.values() for ii in jj)
40+
2041
setup(
2142
name="sphinxcontrib-prettyproof",
2243
version=VERSION,
@@ -35,25 +56,7 @@
3556
license="BSD",
3657
packages=find_packages(),
3758
install_requires=["docutils>=0.15", "sphinx", "sphinx-book-theme"],
38-
extras_require={
39-
"code_style": ["flake8<3.8.0,>=3.7.0", "black", "pre-commit==1.17.0"],
40-
"testing": [
41-
"coverage",
42-
"pytest>=3.6,<4",
43-
"pytest-cov",
44-
"pytest-regressions",
45-
"sphinxcontrib.prettyproof",
46-
"beautifulsoup4",
47-
"myst_parser",
48-
],
49-
"rtd": [
50-
"sphinx>=3.0",
51-
"sphinx-book-theme",
52-
"sphinxcontrib-bibtex",
53-
"sphinxcontrib.prettyproof",
54-
"myst-parser",
55-
],
56-
},
59+
extras_require=extras,
5760
package_data={"sphinxcontrib": ["_static/*"]},
5861
include_package_data=True,
5962
namespace_packages=["sphinxcontrib"],

0 commit comments

Comments
 (0)