Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Documentation #21

Merged
merged 23 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8734791
update docs
elbeejay Feb 28, 2024
0bcd030
Merge branch 'main' of github.com:worldbank/GOSTurban into update-docs
elbeejay Feb 29, 2024
2eb4db3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 29, 2024
9f660ff
remove docs/notebooks
elbeejay Feb 29, 2024
c6ce3ca
Merge branch 'update-docs' of github.com:worldbank/GOSTurban into upd…
elbeejay Feb 29, 2024
be10311
Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks"
elbeejay Feb 29, 2024
9420f8d
Revert "remove docs/notebooks"
elbeejay Feb 29, 2024
545ab38
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 29, 2024
5a8a7fa
modify toc to only include notebook tutorials, clear notebook outputs
elbeejay Feb 29, 2024
ebeb0bb
Merge branch 'update-docs' of github.com:worldbank/GOSTurban into upd…
elbeejay Feb 29, 2024
ed08bff
fix deps, imports, and ci
elbeejay Feb 29, 2024
c9f852f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 29, 2024
419648a
generate conf.py as part of docs build workflow
elbeejay Feb 29, 2024
5e3578d
Merge branch 'update-docs' of github.com:worldbank/GOSTurban into upd…
elbeejay Feb 29, 2024
555845a
have workflow clean notebooks
elbeejay Feb 29, 2024
861c786
add extensions, options etc to _config.yml
elbeejay Feb 29, 2024
7c60f12
cleaned notebooks
elbeejay Feb 29, 2024
7ec9b65
remove non-functional exclusions
elbeejay Feb 29, 2024
4ebf1f5
build docs on prs, only deploy on main
elbeejay Feb 29, 2024
081bf9a
require nbconvert for docs
elbeejay Mar 1, 2024
398b7f2
add nbstrip git-hook
elbeejay May 27, 2024
84906cd
Merge branch 'main' of github.com:worldbank/GOSTurban into update-docs
elbeejay Jun 14, 2024
5374c07
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: docs
on:
push:
branches:
- main
pull_request:

jobs:
build:
Expand All @@ -17,12 +16,16 @@ jobs:
- name: Dependencies
run: |
if [ -f pyproject.toml ]; then pip install ".[docs]"; fi
- name: Clear notebooks and create conf.py file
run: |
jupyter-book config sphinx docs/
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --ClearMetadataPreprocessor.enabled=True --clear-output --inplace $(find . -type f -name '*.ipynb')
- name: Build Sphinx Documentation
run: |
sphinx-build docs _build/html -b html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: job.status == 'success'
if: github.ref == 'refs/heads/main' && job.status == 'success'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,11 @@ dmypy.json
_build/
docs/api/
src/GOSTurban/_version.py
docs/notebooks/

# ignore the generated sphinx conf.py file
# we generate it during the doc build using jupyter-book from _conf.py
docs/conf.py

# ignore implementations output
notebooks/Implementations/output/
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ repos:
args: [--fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ pip install GOSTurban
```shell
pip install .
```
### Developer Installation

Install the package **in editable** mode with dependencies:
Install the package **in editable** mode with all of the dependencies needed to run the tests and build the documentation locally:

```shell
pip install -e .
```
```shell
pip install -e .[dev]
```

The `-e` flag stands for "editable," meaning changes to the source code will immediately affect the installed package.
The `-e` flag stands for "editable," meaning changes to the source code will immediately affect the installed package.

## License

Expand Down
14 changes: 13 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ logo: images/logo.png
# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
execute:
execute_notebooks: off
execute_notebooks: force
allow_errors: true

# only build files in toc
only_build_toc: true

# Add a bibtex file so that we can create citations
bibtex_bibfiles:
Expand All @@ -25,3 +29,11 @@ repository:
html:
use_issues_button: false
use_repository_button: true

# specify sphinx extensions
sphinx:
extra_extensions:
- sphinx.ext.napoleon
- sphinxcontrib.apidoc
config:
apidoc_module_dir: ../src
36 changes: 36 additions & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,39 @@ parts:
chapters:
- file: notebooks/Tutorials/UrbanAreas_tutorials.ipynb
Copy link
Contributor

@g4brielvs g4brielvs Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elbeejay Thanks for adding the content. @bpstewar Would you please review which of these notebooks should be added to the gh-pages documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've commented out everything except the Tutorials/ notebooks for now, so currently only those two will be included in the built documentation

- file: notebooks/Tutorials/LEI_Example.ipynb
# - caption: Implementations
# chapters:
# - file: notebooks/Implementations/JUP_SURGP_GLO_B_D__LEI_Evaluation.ipynb
# - file: notebooks/Implementations/URB_DECAT_B_ExploringGHSSMODcode.ipynb
# - file: notebooks/Implementations/URB_SEAU1_B_A_Ka_ExtractDataUrban.ipynb
# - file: notebooks/Implementations/WSF_DECAT_B_ExploringIDCerrors.ipynb
# - caption: KAZ_SCADR_UrbanizationReview
# chapters:
# - file: notebooks/Implementations/KAZ_SCADR_UrbanizationReview/ECA_Urban_Extents.ipynb
# - file: notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Combine_All.ipynb
# - file: notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Shape.ipynb
# - file: notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Structure.ipynb
# - file: notebooks/Implementations/KAZ_SCADR_UrbanizationReview/KAZ_Urbanization_Review.ipynb
# - file: notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Fullness.ipynb
# - file: notebooks/Implementations/KAZ_SCADR_UrbanizationReview/Urban_metrics_Sprawl.ipynb
# - caption: POV_EEAPV_COG_urban_assessment
# chapters:
# - file: notebooks/Implementations/POV_EEAPV_COG_urban_assessment/Summarize_Urban.ipynb
# - caption: Slum_Mapping
# chapters:
# - file: notebooks/Implementations/Slum_Mapping/Imagery_Search.ipynb
# - caption: URB_SCAUR_UKR_B_I_urbanizationReview
# chapters:
# - file: notebooks/Implementations/URB_SCAUR_UKR_B_I_urbanizationReview/URB_SCAUR_UKR_B_I_urbanizationReview.ipynb
# - caption: URB_SEAU1_NovelUrbanization
# chapters:
# - file: notebooks/Implementations/URB_SEAU1_NovelUrbanization/Create_Mosaick_Datasets.ipynb
# - file: notebooks/Implementations/URB_SEAU1_NovelUrbanization/GHSL_Standardize_To_Country.ipynb
# - file: notebooks/Implementations/URB_SEAU1_NovelUrbanization/MAP_Urbanization.ipynb
# - file: notebooks/Implementations/URB_SEAU1_NovelUrbanization/NGA_specific_results.ipynb
# - file: notebooks/Implementations/URB_SEAU1_NovelUrbanization/URB_SEAU1_B_A_Ka_NovelUrbanizaton.ipynb
# - file: notebooks/Implementations/URB_SEAU1_NovelUrbanization/WBGAPI_Extract_urbanization_GDP.ipynb
# - caption: URB_SURDR_ZAF_Energy_Transition
# chapters:
# - file: notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Data Preparation.ipynb
# - file: notebooks/Implementations/URB_SURDR_ZAF_Energy_Transition/Zonal_statistics.ipynb
79 changes: 0 additions & 79 deletions docs/conf.py

This file was deleted.

42 changes: 6 additions & 36 deletions notebooks/Implementations/JUP_SURGP_GLO_B_D__LEI_Evaluation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'src.LEI'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/tmp/ipykernel_81457/3673388608.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;31m#Import GOST urban functions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"../../\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 16\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0msrc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mLEI\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'src.LEI'"
]
}
],
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
Expand All @@ -48,9 +36,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"LEI_folder = \"/home/wb411133/data/Projects/LEI\"\n",
Expand Down Expand Up @@ -135,9 +121,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"for ghsl_file in GHSL_files:\n",
Expand Down Expand Up @@ -412,22 +396,8 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (geog)",
"language": "python",
"name": "geog"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"name": "python"
}
},
"nbformat": 4,
Expand Down
Loading
Loading