Skip to content

Commit b30e0da

Browse files
authored
Docs improvements (#66)
* moving from rst to md * switching docs to mkdocs * fix linting in examples * working on usage * fixing mkdocs site * rename examples to make more sense, formatting * more customisation * try deploy step * fix ci
1 parent 9b0edd0 commit b30e0da

27 files changed

+1462
-1796
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,8 @@ jobs:
9999
env:
100100
TWINE_USERNAME: __token__
101101
TWINE_PASSWORD: ${{ secrets.pypi_token }}
102+
103+
- name: publish docs
104+
run: make publish-docs
105+
env:
106+
NETLIFY: ${{ secrets.netlify_token }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ env36/
55
env37/
66
*.py[cod]
77
*.egg-info/
8-
build/
98
dist/
109
.cache/
1110
.mypy_cache/
@@ -14,6 +13,8 @@ test.py
1413
htmlcov/
1514
benchmarks/*.json
1615
docs/_build/
16+
/docs/.*.md
1717
docs/examples/*.html
1818
old-version/
1919
*.swp
20+
/site/

HISTORY.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## v0.6.0 (2020-07-29)
2+
* improve `__pretty__` to work better with pydantic classes, #52
3+
* improve the way statement ranges are calculated, #58
4+
* drastically improve import time, #50
5+
* pretty printing for non-standard dicts, #60
6+
* better statement finding for multi-line statements, #61
7+
* colors in windows, #57
8+
* fix `debug(type(dict(...)))`, #62
9+
10+
## v0.5.1 (2019-10-09)
11+
* fix python tag in `setup.cfg`, #46
12+
13+
## v0.5.0 (2019-01-03)
14+
* support `MultiDict`, #34
15+
* support `__pretty__` method, #36
16+
17+
## v0.4.0 (2018-12-29)
18+
* remove use of `warnings`, include in output, #30
19+
* fix rendering errors #31
20+
* better str and bytes wrapping #32
21+
* add `len` everywhere possible, part of #16
22+
23+
## v0.3.0 (2017-10-11)
24+
* allow `async/await` arguments
25+
* fix subscript
26+
* fix weird named tuples eg. `mock > call_args`
27+
* add `timer`
28+
29+
## v0.2.0 (2017-09-14)
30+
* improve output
31+
* numerous bug fixes

HISTORY.rst

Lines changed: 0 additions & 42 deletions
This file was deleted.

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE
2+
include README.md
3+
include HISTORY.md

Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@ clean:
5555

5656
.PHONY: docs
5757
docs:
58-
make -C docs html
58+
flake8 --max-line-length=80 docs/examples/
59+
python docs/build/main.py
60+
mkdocs build
5961

60-
.PHONY: publish
61-
publish: docs
62-
cd docs/_build/ && cp -r html site && zip -r site.zip site
63-
@curl -i -H "Content-Type: application/zip" -H "Authorization: Bearer ${NETLIFY}" \
64-
--data-binary "@docs/_build/site.zip" https://api.netlify.com/api/v1/sites/python-devtools.netlify.com/deploys
65-
@echo " "
62+
.PHONY: docs-serve
63+
docs-serve:
64+
python docs/build/main.py
65+
mkdocs serve
66+
67+
.PHONY: publish-docs
68+
publish-docs: docs
69+
zip -r site.zip site
70+
@curl -H "Content-Type: application/zip" -H "Authorization: Bearer ${NETLIFY}" \
71+
--data-binary "@site.zip" https://api.netlify.com/api/v1/sites/python-devtools.netlify.com/deploys

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# python devtools
2+
3+
[![CI](https://github.com/samuelcolvin/python-devtools/workflows/CI/badge.svg?event=push)](https://github.com/samuelcolvin/python-devtools/actions?query=event%3Apush+branch%3Amaster+workflow%3ACI)
4+
[![Coverage](https://codecov.io/gh/samuelcolvin/python-devtools/branch/master/graph/badge.svg)](https://codecov.io/gh/samuelcolvin/python-devtools)
5+
[![pypi](https://img.shields.io/pypi/v/python-devtools.svg)](https://pypi.python.org/pypi/python-devtools)
6+
[![versions](https://img.shields.io/pypi/pyversions/python-devtools.svg)](https://github.com/samuelcolvin/python-devtools)
7+
[![license](https://img.shields.io/github/license/samuelcolvin/python-devtools.svg)](https://github.com/samuelcolvin/python-devtools/blob/master/LICENSE)
8+
9+
**Python's missing debug print command and other development tools.**
10+
11+
For more information, see [documentation](https://python-devtools.helpmanual.io/).
12+
13+
## Install
14+
15+
Just
16+
17+
```bash
18+
pip install devtools[pygments]
19+
```
20+
21+
`pygments` is not required but if it's installed, output will be highlighted and easier to read.
22+
23+
`devtools` has no other required dependencies except python 3.6, 3.7, or 3.8.
24+
If you've got python 3.6+ and `pip` installed, you're good to go.
25+
26+
## Usage
27+
28+
```py
29+
from devtools import debug
30+
31+
whatever = [1, 2, 3]
32+
debug(whatever)
33+
```
34+
35+
Outputs:
36+
37+
```py
38+
test.py:4 <module>:
39+
whatever: [1, 2, 3] (list)
40+
```
41+
42+
43+
That's only the tip of the iceberg, for example:
44+
45+
```py
46+
import numpy as np
47+
48+
data = {
49+
'foo': np.array(range(20)),
50+
'bar': {'apple', 'banana', 'carrot', 'grapefruit'},
51+
'spam': [{'a': i, 'b': (i for i in range(3))} for i in range(3)],
52+
'sentence': 'this is just a boring sentence.\n' * 4
53+
}
54+
55+
debug(data)
56+
```
57+
58+
outputs:
59+
60+
![python-devtools demo](https://raw.githubusercontent.com/samuelcolvin/python-devtools/master/demo.py.png)
61+
62+
## Usage without Import
63+
64+
modify `/usr/lib/python3.8/sitecustomize.py` making `debug` available in any python 3.8 code
65+
66+
```py
67+
# add devtools debug to builtins
68+
try:
69+
from devtools import debug
70+
except ImportError:
71+
pass
72+
else:
73+
__builtins__['debug'] = debug
74+
```

README.rst

Lines changed: 0 additions & 77 deletions
This file was deleted.

docs/Makefile

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)