Skip to content

Commit 94d54a8

Browse files
author
Daniil Gafni
committed
add dev documentation
1 parent e39fb4a commit 94d54a8

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

CONTRIBUTING.md

+33-9
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,45 @@
22

33
To clone this project locally, issue
44

5-
```
5+
```shell
66
git clone https://github.com/Hananel-Hazan/bindsnet.git # clones bindsnet repository
77
```
88

99
in the directory of your choice. This will place the repository's code in a directory titled `bindsnet`.
1010

11-
All development should take place on a branch separate from master. To create a branch, issue
11+
Install the project with [Poetry](https://python-poetry.org/) (current supported version - 1.1.8)
12+
13+
```shell
14+
poetry install
15+
poetry run pre-commit install
16+
```
17+
1218

19+
Now you can access the project environment with `poetry shell` or run commands with `poetry run <command>`. For example, `poetry run python examples/mnist/conv_mnist.py`.
20+
21+
Please make sure the `Poetry` environment is activated when you commit your files! The `git commit` command will invoke `pre-commit`, which is installed with Poetry too. IDEs like PyCharm have plugins for `Poetry` and will activate the environment automatically.
22+
23+
Run the tests, they all should pass
24+
25+
```shell
26+
poetry run pytest
1327
```
28+
29+
All development should take place on a branch separate from master. To create a branch, issue
30+
31+
```shell
1432
git branch [branch-name] # create new branch
1533
```
1634

1735
replacing `[branch-name]` with a simple and memorable name of choice; e.g., `git branch dan`. Switch to the newly created branch using
1836

19-
```
37+
```shell
2038
git checkout [branch-name] # switch to a different branch of the repository
2139
```
2240

2341
__Note__: Issue `git branch` with no arguments to list all branches currently being tracked, with an asterisk next to the currently used branch; e.g.,
2442

25-
```
43+
```shell
2644
$ git branch # list all branches and indicate current branch
2745
* dan
2846
devel
@@ -34,40 +52,46 @@ If new branches have been created on the remote repository, you may start tracki
3452

3553
After making changes to the repository, issue a `git status` command to see which files have been modified. Then, use
3654

37-
```
55+
```shell
3856
git add [file-name(s) | -A] # add modified or newly created files
3957
```
4058

4159
to add one or more modified files (`file-name(s)`), or all modified files (`-A` or `--all`). These include newly created files. Issue
4260

61+
```shell
62+
pre-commit run -a
4363
```
64+
65+
to run the `pre-commit` tool that will automatically format your code with `black`. Issue
66+
67+
```shell
4468
git commit -m "[commit-message]" # Useful messages help when reverting / searching through history
4569
```
4670

4771
to "commit" your changes to your local repository, where `[commit-message]` is a _short yet descriptive_ note about what changes have been made.
4872

4973
Before pushing your changes to the remote repository, you must make sure that you have an up-to-date version of the `master` code. That is, if master has been updated while you have been making your changes, your code will be out of date with respect to the master branch. Issue
5074

51-
```
75+
```shell
5276
git pull # gets all changes from remote repository
5377
git merge master # merges changes made in master branch with those made in your branch
5478
```
5579

5680
and fix any merge conflicts that may have resulted, and re-commit after the fix with
5781

58-
```
82+
```shell
5983
git commit # no -m message needed; merge messages are auto-generated
6084
```
6185

6286
Push your changes back to the repository onto the same branch you are developing on. Issue
6387

64-
```
88+
```shell
6589
git push [origin] [branch-name] # verbose; depends on push.default behavior settings
6690
```
6791

6892
or,
6993

70-
```
94+
```shell
7195
git push # concise; again, depends on push.default behavior
7296
```
7397

0 commit comments

Comments
 (0)