Skip to content

Commit 61e2fca

Browse files
authored
Merge pull request #243 from joshuacortez/chore/update_contributing
update contributing markdown
2 parents 1e69da3 + 29dc98d commit 61e2fca

File tree

3 files changed

+19
-167
lines changed

3 files changed

+19
-167
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,14 @@ If you are reporting a bug, please include:
2626
## Creating pull requests
2727

2828
1. Fork the repo in Github or go to https://github.com/thinkingmachines/geowrangler/fork
29-
2. Install and enable `pre-commit` and `poetry`
29+
2. Set up the development environment following the instructions in [DEVELOPMENT](https://github.com/thinkingmachines/geowrangler/blob/master/DEVELOPMENT.md)
3030

31-
```
32-
pip install poetry>=1.2.0 pre-commit
33-
pre-commit install
34-
poetry install
35-
poetry run pip install pip --upgrade
36-
poetry run pip install -e .
37-
```
38-
39-
3. Make the necessary changes. See [Developing with nbdev](#developing-with-nbdev) for more info.
31+
3. Make the necessary contributions. See [Developing with nbdev](#developing-with-nbdev) for more info.
4032

4133
4. Run the tests and ensure they all pass before submitting a PR. Also add tests whenever adding a new feature. Finally, clean up tests that are longer applicable.
4234

4335
```
44-
poetry run pytest --cov --cov-config=.coveragerc --cov-fail-under=80 -n auto
36+
pytest --cov --cov-config=.coveragerc --cov-fail-under=80 -n auto
4537
```
4638

4739
5. Commit and Submit PR for review
@@ -59,10 +51,18 @@ poetry run pytest --cov --cov-config=.coveragerc --cov-fail-under=80 -n auto
5951
Once the necessary changes are made, run the following to generate the python code.
6052

6153
```
62-
poetry run nbdev_export
63-
poetry run pre-commit run -a
64-
poetry run pre-commit run -a
54+
nbdev_export
6555
```
66-
> Note: we are running `pre-commit` twice so that it reformats the modules to comply with the project's formatting/linting standards and the next run checks if it is already compliant.
6756

57+
## View contributions on documentation site and edit as needed
58+
59+
1. Run nbdev_docs to create the HTML files via Quarto (can verify locally with some port: nbdev_preview --port 4327)
60+
- Doc site automatically updates once a PR is merged (in Settings > Pages need to make sure [geowrangler.thinkingmachin.es](http://geowrangler.thinkingmachin.es/) is the domain as it defaults to [thinkingmachines.github.io](http://thinkingmachines.github.io/) after merges)
61+
2. Edit [notebooks/index.ipynb](https://github.com/thinkingmachines/geowrangler/blob/master/notebooks/index.ipynb) to edit the [doc homepage](https://geowrangler.thinkingmachin.es/)
62+
3. Edit [notebooks/sidebar.yml](https://github.com/thinkingmachines/geowrangler/blob/master/notebooks/sidebar.yml) to edit the left sidebar
6863

64+
## Updating Google Colab links in notebooks
65+
- In notebooks such as tutorial notebooks you may want to add a Google Colab link at the beginning of the notebook for easy accessibility.
66+
- There is no automatic way yet to update this so it's a manual update of a markdown cell. Since the link points to a notebook in master, testing the Colab button is done after merging. Follow the sample below and replace the notebook name with your contributed notebook name.
67+
- Sample for notebooks/14_datasets_nightlights.ipynb:
68+
[![](https://colab.research.google.com/assets/colab-badge.svg "Open in Colab button")](https://colab.research.google.com/github/thinkingmachines/geowrangler/blob/master/notebooks/14_datasets_nightlights.ipynb)

DEVELOPMENT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can run geowrangler's jupyter notebooks to see how the different modules are
1414
* OS: Linux, MacOS, Windows Subsystem for Linux (WSL) on Windows
1515

1616
* Requirements:
17-
- python 3.8 or higher
17+
- python 3.9 or higher
1818
- virtualenv, venv or conda for python environment virtualization
1919
- [quarto](https://quarto.org) to preview the documentation site locally
2020

@@ -36,7 +36,7 @@ To generate and preview the documentation site on your local machine, you will n
3636

3737
**Set-up with virtualenv**
3838

39-
Set up your Python env with `virtualenv` and install pre-commits and the necessary python libs by running the following commands.
39+
Set up your Python env with `virtualenv` and install the necessary python libs by running the following commands.
4040

4141
Remember to replace `<your-github-id>` in the github url below with your GitHub ID to clone from your fork.
4242

@@ -64,7 +64,7 @@ conda deactivate # important to ensure libs from other envs aren't used
6464
conda activate geowrangler-env
6565
```
6666

67-
Then run the following to install the pre-commits and python libs.
67+
Then run the following to install the python libs.
6868
```
6969
cd geowrangler # cd into your geowrangler local directory
7070
pip install -e ".[dev]"

mkdocs/docs/README.md

Lines changed: 1 addition & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -49,152 +49,4 @@ The documentation for [the package is available here](https://geowrangler.thinki
4949

5050
If you want to learn more about **Geowrangler** and explore its inner workings, you can setup a local development environment. You can run geowrangler's jupyter notebooks to see how the different modules are built and how they work.
5151

52-
53-
#### Pre-requisites
54-
55-
* OS: Linux, MacOS, Windows Subsystem for Linux (WSL) on Windows
56-
57-
* Requirements:
58-
- python 3.7 or higher
59-
- virtualenv, venv or conda for python environment virtualization
60-
- poetry for dependency management
61-
62-
#### Github Repo Fork
63-
64-
If you plan to make contributions to geowrangler, we encourage you to
65-
[create your fork](https://github.com/thinkingmachines/geowrangler/fork) of the Geowrangler repo.
66-
67-
This will then allow you to push commits to your forked repo and
68-
then create a Pull Request (PR) from your repo to the main geowrangler
69-
repo for approval by geowrangler's maintainers.
70-
71-
#### Development Installation
72-
73-
We recommend creating a virtual python environment via [virtualenv](https://pypi.org/project/virtualenv/) or [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/index.html) for your development environment. Please see the relevant documentation for more details on installing these python environment managers. Afterward, continue the geowrangler setup instructions below.
74-
75-
76-
**Set-up with virtualenv**
77-
78-
First, install `libgeos` ( version >=3.8 required for building pygeos/shapely) through the ff. commands.
79-
80-
*See [libgeos documentation](https://libgeos.org/usage/install/) for installation details on other systems.*
81-
82-
```
83-
sudo apt update # updates package info
84-
sudo apt install build-essential # installs GCC
85-
sudo apt install libgeos-dev
86-
```
87-
88-
Next, set-up your Python env with `virtualenv` and install pre-commits and the necessary python libs by running the following commands.
89-
90-
Remember to replace `<your-github-id>` in the github url below with your GitHub ID to clone from your fork.
91-
92-
```
93-
git clone https://github.com/<your-github-id>/geowrangler.git
94-
cd geowrangler
95-
virtualenv -p /usr/bin/python3.9 .venv
96-
source .venv/bin/activate
97-
pip install pre-commit poetry>=1.2.0
98-
pre-commit install
99-
poetry config --local installer.no-binary pygeos,shapely
100-
poetry install
101-
```
102-
103-
You're all set! [Run the tests](#running-tests) to make sure everything was installed properly.
104-
105-
Whenever you open a new terminal, you can `cd <your-local-geowrangler-folder>`
106-
and run `poetry shell` to activate the geowrangler environment.
107-
108-
**Set-up with conda**
109-
110-
Run the following commands to set-up a conda env and install geos.
111-
112-
```
113-
conda create -y -n geowrangler-env python=3.9 # replace geowrangler-env if you prefer a different env name
114-
conda deactivate # important to ensure libs from other envs aren't used
115-
conda activate geowrangler-env
116-
conda install -y geos
117-
```
118-
119-
Then run the following to install the pre-commits and python libs.
120-
```
121-
cd geowrangler # cd into your geowrangler local directory
122-
pip install pre-commit poetry>=1.2.0
123-
pre-commit install
124-
poetry install
125-
```
126-
127-
You're all set! [Run the tests](#running-tests) to make sure everything was installed properly.
128-
129-
Whenever you open a new terminal, run `conda deactivate && conda activate geowrangler-env` to deactivate any conda env, and then activate the geowrangler environment.
130-
131-
### Jupyter Notebook Development
132-
133-
The code for the **geowrangler** python package resides in Jupyter notebooks located in the `notebooks` folder.
134-
135-
Using [nbdev](https://nbdev.fast.ai), we generate the python modules residing in the `geowrangler` folder from code cells in jupyter notebooks marked with an `#export` comment. A `#default_exp <module_name>` comment at the first code cell of each notebook directs `nbdev` to put the code in a module named `<module_name>` in the `geowrangler` folder.
136-
137-
See the [nbdev cli](https://nbdev.fast.ai/cli.html) documentation for more details on the commands to generate the package as well as the documentation.
138-
### Running notebooks
139-
140-
Run the following to view the jupyter notebooks in the `notebooks` folder
141-
142-
```
143-
poetry run jupyter lab
144-
```
145-
### Generating and viewing the documentation site
146-
147-
To generate and view the documentation site on your local machine, the quickest way is to setup [Docker](https://docs.docker.com/get-started/). The following assumes that you have setup docker on your system.
148-
```
149-
poetry run nbdev_docs --mk_readme False --force_all True
150-
docker-compose up jekyll
151-
```
152-
153-
As an alternative if you don't want to use _Docker_ you can [install jekyll](https://jekyllrb.com/docs/installation/) to view the documentation site locally.
154-
155-
`nbdev` converts notebooks within the `notebooks/` folder into a jekyll site.
156-
157-
From this jekyll site, you can then create a static site.
158-
159-
To generate the docs, run the following
160-
161-
```
162-
163-
poetry run nbdev_docs -mk_readme False --force_all True
164-
cd docs && bundle i && cd ..
165-
166-
```
167-
168-
To run the jekyll site, run the following
169-
170-
```
171-
cd docs
172-
bundle exec jekyll serve
173-
```
174-
175-
### Running tests
176-
177-
We are using `pytest` as our test framework. To run all tests and generate a generate a coverage report, run the following.
178-
179-
```
180-
poetry run pytest --cov --cov-config=.coveragerc -n auto
181-
```
182-
183-
184-
To run a single test or test file
185-
186-
```shell
187-
# for a single test function
188-
poetry run pytest tests/test_grids.py::test_create_grids
189-
# for a single test file
190-
poetry run pytest tests/test_grids.py
191-
```
192-
### Contributing
193-
194-
Please read [CONTRIBUTING.md](https://github.com/thinkingmachines/geowrangler/blob/master/CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](https://github.com/thinkingmachines/geowrangler/blob/master/CODE_OF_CONDUCT.md) before anything.
195-
196-
### Development Notes
197-
198-
For more details regarding our development standards and processes, please see [our wiki](https://github.com/thinkingmachines/geowrangler/wiki/DeveloperNotes).
199-
200-
52+
Set up the development environment following the instructions in [DEVELOPMENT](https://github.com/thinkingmachines/geowrangler/blob/master/DEVELOPMENT.md)

0 commit comments

Comments
 (0)