Skip to content

Commit e3df568

Browse files
committed
update docs
1 parent 738be8a commit e3df568

File tree

3 files changed

+53
-47
lines changed

3 files changed

+53
-47
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ Issues and pull requests are more than welcome: https://github.com/developmentse
55
**dev install**
66

77
```bash
8-
$ git clone https://github.com/developmentseed/titiler.git
9-
$ cd titiler
10-
$ pip install \
8+
git clone https://github.com/developmentseed/titiler.git
9+
cd titiler
10+
11+
python -m pip install \
1112
pre-commit \
1213
-e src/titiler/core["test"] \
1314
-e src/titiler/extensions["test,cogeo,stac"] \
@@ -20,32 +21,32 @@ $ pip install \
2021
This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code.
2122

2223
```bash
23-
$ pre-commit install
24+
pre-commit install
2425
```
2526

2627
### Docs
2728

2829
```bash
29-
$ git clone https://github.com/developmentseed/titiler.git
30-
$ cd titiler
31-
$ pip install nbconvert mkdocs mkdocs-material mkdocs-jupyter pygments pdocs
30+
git clone https://github.com/developmentseed/titiler.git
31+
cd titiler
32+
python -m pip install nbconvert mkdocs mkdocs-material mkdocs-jupyter pygments pdocs
3233
```
3334

3435
Hot-reloading docs:
3536

3637
```bash
37-
$ mkdocs serve -f docs/mkdocs.yml
38+
mkdocs serve -f docs/mkdocs.yml
3839
```
3940

4041
To manually deploy docs (note you should never need to do this because Github
4142
Actions deploys automatically for new commits.):
4243

4344
```bash
44-
$ mkdocs gh-deploy -f docs/mkdocs.yml
45+
mkdocs gh-deploy -f docs/mkdocs.yml
4546
```
4647

4748
```bash
48-
pdocs as_markdown \
49+
pdocs as_markdown \
4950
--output_dir docs/src/api \
5051
--exclude_source \
5152
--overwrite \
@@ -57,15 +58,15 @@ $ mkdocs gh-deploy -f docs/mkdocs.yml
5758
titiler.core.resources.enums \
5859
titiler.core.middleware
5960

60-
pdocs as_markdown \
61+
pdocs as_markdown \
6162
--output_dir docs/src/api \
6263
--exclude_source \
6364
--overwrite \
6465
titiler.extensions.cogeo \
6566
titiler.extensions.viewer \
6667
titiler.extensions.stac
6768

68-
pdocs as_markdown \
69+
pdocs as_markdown \
6970
--output_dir docs/src/api \
7071
--exclude_source \
7172
--overwrite \

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,33 @@ To install from PyPI and run:
6666

6767
```bash
6868
# Make sure you have pip up to date
69-
$ python -m pip install -U pip
69+
python -m pip install -U pip
7070

71-
$ python -m pip install titiler.{package}
71+
python -m pip install titiler.{package}
7272
# e.g.,
7373
# python -m pip install titiler.core
7474
# python -m pip install titiler.extensions
7575
# python -m pip install titiler.mosaic
7676
# python -m pip install titiler.application (also installs core, extensions and mosaic)
7777

7878
# Install uvicorn to run the FastAPI application locally
79-
$ python -m pip install uvicorn
79+
python -m pip install uvicorn
8080

8181
# Launch application locally
82-
$ uvicorn titiler.application.main:app
82+
uvicorn titiler.application.main:app
8383
```
8484

8585
To install from sources and run for development:
8686

8787
```
88-
$ git clone https://github.com/developmentseed/titiler.git
89-
$ cd titiler
90-
$ python -m pip install -U pip
91-
$ python -m pip install -e src/titiler/core -e src/titiler/extensions -e src/titiler/mosaic -e src/titiler/application
92-
$ python -m pip install uvicorn
93-
$ uvicorn titiler.application.main:app --reload
88+
git clone https://github.com/developmentseed/titiler.git
89+
cd titiler
90+
91+
python -m pip install -U pip
92+
python -m pip install -e src/titiler/core -e src/titiler/extensions -e src/titiler/mosaic -e src/titiler/application
93+
python -m pip install uvicorn
94+
95+
uvicorn titiler.application.main:app --reload
9496
```
9597

9698
## Docker
@@ -109,10 +111,10 @@ docker run --name titiler \
109111

110112
- Built the docker locally
111113
```
112-
$ git clone https://github.com/developmentseed/titiler.git
113-
$ cd titiler
114+
git clone https://github.com/developmentseed/titiler.git
115+
cd titiler
114116
115-
$ docker-compose up --build titiler # or titiler-uvicorn
117+
docker-compose up --build titiler # or titiler-uvicorn
116118
```
117119

118120
Some options can be set via environment variables, see: https://github.com/tiangolo/uvicorn-gunicorn-docker#advanced-usage

docs/src/intro.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ Users can choose to extend or use `TiTiler` as it is.
1010
`TiTiler` comes with a default (complete) application with support for COG, STAC, and MosaicJSON. You can install and start the application locally by doing:
1111

1212
```bash
13-
$ python -m pip install -U pip
14-
$ python -m pip install uvicorn titiler.application
15-
$ uvicorn titiler.application.main:app
13+
# Update pip
14+
python -m pip install -U pip
15+
16+
# Install titiler packages
17+
python -m pip install uvicorn titiler.application
18+
19+
# Start application using uvicorn
20+
uvicorn titiler.application.main:app
1621

1722
> INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
1823
```
@@ -38,35 +43,25 @@ The default application can be customized using environment variables defined in
3843
- `DISABLE_MOSAIC` (bool): disable `/mosaic` endpoints.
3944
- `LOWER_CASE_QUERY_PARAMETERS` (bool): transform all query-parameters to lower case (see https://github.com/developmentseed/titiler/pull/321).
4045

41-
## Development
42-
43-
To install and run `Titiler` from sources and for developing the `Titiler` code itself:
44-
45-
```
46-
$ git clone https://github.com/developmentseed/titiler.git
47-
$ cd titiler
48-
$ pip install uvicorn -e src/titiler/core -e src/titiler/mosaic -e src/titiler/application
49-
$ uvicorn titiler.application.main:app --reload
50-
51-
> INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
52-
> INFO: Started reloader process [66665] using statreload
53-
```
54-
5546
## Customized, minimal app
5647

5748
`TiTiler` has been developed so users can build their own app using only the portions they need. Using [TilerFactories](advanced/tiler_factories.md), users can create a fully customized application with only the endpoints needed.
5849

5950
When building a custom application, you may wish to only install the `core` and/or `mosaic` modules. To install these from PyPI:
6051

6152
```bash
62-
$ python -m pip install -U pip
63-
$ python -m pip install titiler.core
64-
$ python -m pip install titiler.mosaic
53+
# Update pip
54+
python -m pip install -U pip
55+
56+
# Install titiler.core and uvicorn packages
57+
python -m pip install titiler.core uvicorn
6558
```
6659

6760
These can then be used like:
6861

6962
```py
63+
# app.py
64+
import uvicorn
7065
from titiler.core.factory import TilerFactory
7166
from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers
7267

@@ -76,6 +71,10 @@ app = FastAPI()
7671
cog = TilerFactory()
7772
app.include_router(cog.router)
7873
add_exception_handlers(app, DEFAULT_STATUS_CODES)
74+
75+
76+
if __name__ == '__main__':
77+
uvicorn.run(app=app, host="127.0.0.1", port=8080, log_level="info")
7978
```
8079

8180
![](img/custom_app.png)
@@ -86,8 +85,7 @@ If you want to include all of Titiler's built-in endpoints, but also include
8685
customized endpoints, you can import and extend the app directly.
8786

8887
```bash
89-
$ python -m pip install -U pip
90-
$ python -m pip install titiler.application # also installs titiler.core and titiler.mosaic
88+
python -m pip install titiler.application uvicorn # also installs titiler.core and titiler.mosaic
9189
```
9290

9391
These can then be used like:
@@ -110,6 +108,7 @@ def token_validation(access_token: str = Security(api_key_query)):
110108
if not access_token:
111109
raise HTTPException(status_code=403, detail="Missing `access_token`")
112110

111+
# if access_token == `token` then OK
113112
if not access_token == "token":
114113
raise HTTPException(status_code=403, detail="Invalid `access_token`")
115114

@@ -121,6 +120,10 @@ router = APIRouter(dependencies=[Depends(token_validation)])
121120
tiler = TilerFactory(router_prefix="private/cog", router=router)
122121

123122
app.include_router(tiler.router, prefix="/private/cog", tags=["Private"])
123+
124+
125+
if __name__ == '__main__':
126+
uvicorn.run(app=app, host="127.0.0.1", port=8080, log_level="info")
124127
```
125128

126129
More on [customization](advanced/customization.md)

0 commit comments

Comments
 (0)