Skip to content

Commit 0d235d3

Browse files
authored
Merge pull request stac-utils#27 from azavea/rde/fix/stac_io_docs
Doc updates and fixes in preparation for 0.3 release
2 parents 2f1b282 + 32fc3c4 commit 0d235d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4153
-1034
lines changed

.flake8

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[flake8]
2+
max-line-length = 100
3+
4+
## IGNORES
5+
6+
# E127: flake8 reporting incorrect continuation line indent errors
7+
# on multi-line and multi-level indents
8+
9+
# W503: flake8 reports this as incorrect, and scripts/format_code
10+
# changes code to it, so let format_code win.
11+
12+
ignore = E127,W503

.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ docs/_build/
1919

2020
.ipynb_checkpoints/
2121

22-
tutorials/pystac-example*
23-
tutorials/spacenet-stac/
24-
tutorials/spacenet-cog-stac/
25-
tutorials/data/
22+
docs/tutorials/pystac-example*
23+
docs/tutorials/spacenet-stac/
24+
docs/tutorials/spacenet-cog-stac/
25+
docs/tutorials/data/
26+
docs/quickstart_stac/

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ install:
1111
- pip install -r requirements-dev.txt
1212

1313
script:
14+
- .travis/style_checks
1415
- python -m unittest discover tests/
1516

1617
deploy:

.travis/style_checks

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [[ -n "${PYSTAC_DEBUG}" ]]; then
6+
set -x
7+
fi
8+
9+
SOURCE="${BASH_SOURCE[0]}"
10+
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
11+
TRAVIS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
12+
SRC_DIR="$( cd -P "$( dirname "TRAVIS_DIR" )" && pwd )"
13+
14+
function usage() {
15+
echo -n \
16+
"Usage: $(basename "$0")
17+
Test that code is compliant with yapf (code formatter) and flake8.
18+
"
19+
}
20+
21+
22+
if [ "${1:-}" = "--help" ]; then
23+
usage
24+
else
25+
echo $SRC_DIR
26+
27+
echo "Checking that library code is consistent with flake8..."
28+
flake8 "$SRC_DIR/pystac"
29+
30+
echo "Checking that test code is consistent with flake8..."
31+
flake8 "$SRC_DIR/tests"
32+
33+
# Exit code of 1 if yapf has a non-empty diff
34+
# (ie. scripts/format_code needs to be run)
35+
echo "Checking that code is consistent with yapf..."
36+
if !(yapf -dpr "$SRC_DIR/pystac" > /dev/null &&
37+
yapf -dpr "$SRC_DIR/tests" > /dev/null); then
38+
echo "Code has not been formatted by yapf."
39+
exit 1
40+
fi
41+
fi

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changelog
22

3-
## [v0.1.0] - 2019-01-13
3+
## [v0.3.0] - 2019-10-31
44

5-
Initial Release
5+
Initial release.

README.md

+43-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The table below shows the corresponding versions between pystac and STAC:
3535

3636
| pystac | STAC |
3737
| ------ | ---- |
38-
| 0.2.x | 0.8.x |
38+
| 0.3.x | 0.8.x |
3939

4040
## Documentation
4141

@@ -49,18 +49,57 @@ To ensure development libraries are installed, install everything in `requiremen
4949
> pip install -r requirements-dev.txt
5050
```
5151

52+
### Unit Tests
53+
5254
Unit tests are in the `tests` folder. To run unit tests, use `unittest`:
5355

5456
```
5557
> python -m unittest discover tests
5658
```
5759

58-
## Running the tutorials
60+
### Code quality checks
61+
62+
PySTAC uses [flake8](http://flake8.pycqa.org/en/latest/) and [yapf](https://github.com/google/yapf) for code formatting and style checks.
63+
64+
To run the flake8 style checks:
65+
66+
```
67+
> flake8 pystac
68+
> flake8 tests
69+
```
5970

60-
There are tutorials written as jupyter notebooks in the `tutorials` folder. To run them, run a jupyter notebook with the `tutorials` directory as the notebook directory:
71+
To format code:
6172

6273
```
63-
> PYTHONPATH=`pwd`:$PYTHONPATH jupyter notebook --ip 0.0.0.0 --port 8888 --notebook-dir=tutorials
74+
> yapf -ipr pystac
75+
> yapf -ipr tests
76+
```
77+
78+
You could also run the `.travis/style_checks` script to check flake8 and yapf.
79+
80+
### Documentation
81+
82+
To build and develop the documentation locally, make sure sphinx is available (which is installed with `requirementts-dev.txt`), and use the Makefile in the docs folder:
83+
6484
```
85+
> cd docs
86+
> make html
87+
> make livehtml
88+
```
89+
90+
Use 'make' without arguments to see a list of available commands.
91+
92+
93+
94+
## Runing the quickstart and tutorials
95+
96+
There is a quickstart and tutorials written as jupyter notebooks in the `docs/tutorials` folder.
97+
To run the notebooks, run a jupyter notebook with the `docs` directory as the notebook directory:
98+
99+
```
100+
> PYTHONPATH=`pwd`:$PYTHONPATH jupyter notebook --ip 0.0.0.0 --port 8888 --notebook-dir=docs
101+
```
102+
103+
You can then navigate to the notebooks and execute them.
65104

66105
Requires [Jupyter](https://jupyter.org/) be installed.

docs/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ help:
1212
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1313

1414
livehtml:
15-
sphinx-autobuild --host 0.0.0.0 ${SOURCEDIR} $(BUILDDIR)/html -d _build/doctrees
15+
sphinx-autobuild -z ../pystac --host 0.0.0.0 ${SOURCEDIR} $(BUILDDIR)/html -d _build/doctrees
1616

1717
.PHONY: help Makefile
1818

0 commit comments

Comments
 (0)