Skip to content

Commit 1acab8b

Browse files
authored
Merge pull request #990 from Abhishek-Dimri/docs/convert-rst-to-md-consistency
Move from recommonmark to myst-parser
2 parents 2e0b699 + b1ee7e2 commit 1acab8b

Some content is hidden

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

54 files changed

+1359
-1536
lines changed

AUTHORS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Authors
2+
3+
## Primary Authors
4+
5+
- [Ben Weinstein](https://github.com/bw4sz)
6+
>@bw4sz is the current maintainer and developer of DeepForest software and the lead scientist behind the software design of DeepForest.
7+
8+
- [Henry Senyondo](https://github.com/henrykironde)
9+
>@henrykironde is a support maintainer of DeepForest.
10+
11+
- [Ethan White](https://github.com/ethanwhite)
12+
>@ethanwhite is a PI and Author of DeepForest.
13+
14+
- [Om Doiphode](https://github.com/Om-Doiphode)
15+
>@Om-Doiphode is an Author.
16+
17+
- [Muhammed Magdy](https://github.com/Mu-Magdy)
18+
>@Mu-Magdy is an Author.
19+
20+
- [Dingyi Fang](https://github.com/dingyif)
21+
>@dingyif is an Author.
22+
23+
## Other Contributors
24+
25+
Special thanks to:
26+
27+
- Cameron Appel ([GitHub](https://github.com/camappel)) for help improving the livestock model.
28+
29+
Check GitHub for recent [contributors](https://github.com/weecology/DeepForest/graphs/contributors).
30+
We would like to thank everyone who has contributed to the project in any way.

AUTHORS.rst

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

CONTRIBUTING.md

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
# Developer's Guide
2+
3+
Depends on Python 3.5+
4+
5+
## Getting started
6+
7+
1. Quickstart by forking the [main repository](https://github.com/weecology/DeepForest)
8+
9+
2. Clone your copy of the repository.
10+
11+
- **Using ssh**:
12+
13+
```bash
14+
git clone git@github.com:[your user name]/DeepForest.git
15+
```
16+
17+
- **Using https**:
18+
19+
```bash
20+
git clone https://github.com/[your user name]/DeepForest.git
21+
```
22+
23+
3. Link or point your cloned copy to the main repository. (I always name it upstream)
24+
25+
```bash
26+
git remote add upstream https://github.com/weecology/DeepForest.git
27+
```
28+
29+
4. Check or confirm your settings using `git remote -v`
30+
31+
```text
32+
origin git@github.com:[your user name]/DeepForest.git (fetch)
33+
origin git@github.com:[your user name]/DeepForest.git (push)
34+
upstream https://github.com/weecology/DeepForest.git (fetch)
35+
upstream https://github.com/weecology/DeepForest.git (push)
36+
```
37+
38+
5. Install the package from the main directory.
39+
40+
Deepforest can be installed using either pip or conda.
41+
42+
**Install using Pip**
43+
44+
Installing with Pip uses [dev_requirements.txt](https://github.com/weecology/DeepForest/blob/main/dev_requirements.txt).
45+
46+
```bash
47+
$ pip install -r dev_requirements.txt
48+
$ pip install . -U
49+
```
50+
51+
**Install using Conda**
52+
53+
Installing with Conda uses [environment.yaml](https://github.com/weecology/DeepForest/blob/main/environment.yml).
54+
55+
Conda-based installs can be slow. We recommend using [mamba](https://mamba.readthedocs.io/en/latest/user_guide/mamba.html#quickstart) to speed them up.
56+
57+
```bash
58+
$ conda create -n deepforest python=3
59+
$ conda activate deepforest
60+
$ pip install . -U
61+
```
62+
63+
6. Verify the installation by running this simple test:
64+
65+
```python
66+
from deepforest import main
67+
model = main.deepforest()
68+
print("DeepForest successfully installed!")
69+
```
70+
71+
## Testing
72+
73+
### Running tests locally
74+
75+
```bash
76+
$ pip install . --upgrade # or python setup.py install
77+
$ pytest -v
78+
```
79+
80+
### Checking and fixing code style
81+
82+
#### Using Yapf
83+
84+
We use [yapf](https://github.com/google/yapf) for code formatting and style checking.
85+
86+
The easiest way to make sure your code is formatted correctly is to integrate it into your editor.
87+
See [EDITOR SUPPORT](https://github.com/google/yapf/blob/main/EDITOR%20SUPPORT.md).
88+
89+
You can also run yapf from the command line to cleanup the style in your changes:
90+
91+
```bash
92+
yapf -i --recursive src/deepforest/ --style=.style.yapf
93+
```
94+
95+
If the style tests fail on a pull request, running the above command is the easiest way to fix this.
96+
97+
#### Using pre-commit
98+
99+
We configure all our checks using the `.pre-commit-config.yaml` file. To verify your code styling before committing, you should run `pre-commit install` to set up the hooks, followed by `pre-commit run` to execute them. This will apply the formatting rules specified in the `.style.yapf` file. For additional information, please refer to the [pre-commit documentation](https://pre-commit.com/index.html).
100+
101+
### Testing the Conda Deepforest Build
102+
103+
We use the `conda_recipe/meta.yaml` to make sure that the conda build can build the package.
104+
105+
```bash
106+
$ cd conda_recipe
107+
$ conda build conda_recipe/meta.yaml -c conda-forge -c defaults
108+
```
109+
110+
### Conda staged recipe update
111+
112+
Update the Conda recipe after every release.
113+
114+
Clone the [Weecology staged recipes](https://github.com/weecology/staged-recipes).
115+
Checkout the deepforest branch, update the `deepforest/meta.yaml` with the new version and the sha256 values. Sha256 values are obtained from the source on [PYPI download files](https://pypi.org/project/deepforest/#files) using the deepforest-{version-number}.tar.gz.
116+
117+
```jinja
118+
{% set version = "fill new" %}
119+
{% set sha256 = "fill new" %}
120+
```
121+
122+
## Documentation
123+
124+
We are using [Sphinx](http://www.sphinx-doc.org/en/stable/) and [Read the Docs](https://readthedocs.org/) for the documentation.
125+
126+
We use [Docformatter](https://pypi.org/project/docformatter/) for formatting and style checking.
127+
128+
```bash
129+
$ docformatter --in-place --recursive src/deepforest/
130+
```
131+
132+
### Update Documentation
133+
134+
The documentation is automatically updated for changes in functions.
135+
However, the documentation should be updated after the addition of new functions or modules.
136+
137+
Change to the docs directory and use `sphinx-apidoc` to update the doc's `source`. Exclude the tests and setup.py documentation.
138+
139+
Run:
140+
141+
```bash
142+
sphinx-apidoc -f -o ./source ../ ../tests/* ../setup.py
143+
```
144+
145+
The `source` is the destination folder for the source rst files. `../` is the path to where the deepforest source code is located relative to the doc directory.
146+
147+
### Test documentation locally
148+
149+
```bash
150+
cd docs # Go to the docs directory and install the current changes.
151+
pip install ../ -U
152+
make clean # Run
153+
make html # Run
154+
```
155+
156+
## Create Release
157+
158+
### Start
159+
160+
1. **Run Pytest tests** – seriously, run them now. And Test build artifacts
161+
- Run `Pytest -v`
162+
- Run `pip install build && python -m build && twine check dist/*`
163+
2. Ensure `HISTORY.rst` is up to date with all changes since the last release.
164+
3. Use `bump-my-version show-bump` to determine the appropriate version bump.
165+
4. Update the version for release: `bump-my-version bump [minor | patch | pre_l | pre_n]`. If show-bump does not have the right option, we can manually set it `bump-my-version bump --new-version 1.4.0`
166+
5. Publish the release to PyPi and update the Conda package.
167+
- All releases are done on GitHub Actions when a new tag is pushed.
168+
- `git tag v1.0.0`
169+
- `git push origin v1.0.0`
170+
6. Post-release, update the version to the next development iteration:
171+
- Run `bump-my-version show-bump` to check the target version.
172+
- Then, execute `bump-my-version bump [minor | patch | pre_l | pre_n]`.
173+
174+
Note: Do not commit the build directory after making html.
175+
176+
## Upload to Hugging Face Hub
177+
178+
To upload a trained model to the weecology organization space on Hugging Face Hub:
179+
180+
1. Train or load your model checkpoint
181+
2. Set the label dictionary to match your classes
182+
3. Use `push_to_hub` with the weecology organization name
183+
184+
For example:
185+
186+
```python
187+
from deepforest import main
188+
189+
# Load model from checkpoint
190+
model = main.deepforest.load_from_checkpoint("path/to/checkpoint.ckpt")
191+
192+
# Set label dictionary mapping class names to indices
193+
model.label_dict = {"Livestock": 0}
194+
195+
# Push to weecology organization space
196+
model.push_to_hub("weecology/deepforest-livestock")
197+
```
198+
199+
The model will be uploaded to [https://huggingface.co/weecology/[model-name]](https://huggingface.co/weecology/[model-name])
200+
201+
Note: You must have appropriate permissions in the weecology organization to upload models.

0 commit comments

Comments
 (0)