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

Fix dev environment/testing install instructions #2958

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
- Adam Hawley <https://github.com/adamjhawley>
- Panagiotis Simakis <https://github.com/sp1thas>
- Richard Wang <https://github.com/richarddwang>
- SG Kassel <https://github.com/sgkasselau>

## Others whose work we've taken and included in NLTK, but who didn't directly contribute it:

Expand Down
54 changes: 45 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ repository [nltk/nltk](https://github.com/nltk/nltk/):
- Clone your forked repository locally
(`git clone https://github.com/<your-github-username>/nltk.git`);
- Run `cd nltk` to get to the root directory of the `nltk` code base;
- Install the dependencies (`pip install -r pip-req.txt`);
- Install the [pre-commit](https://pre-commit.com) hooks: (`pre-commit install`)
- Download the datasets for running tests
(`python -m nltk.downloader all`);
- Install the dependencies directly (`pip install -r pip-req.txt`)
or isolated from your other projects via pipenv (`pipenv install -r pip-req.txt --python 3.7`);
- Install the [Prover9](https://www.cs.unm.edu/~mccune/prover9/manual/2009-11A/install.html) theorem prover (required for inference tests);
- Install the [pre-commit](https://pre-commit.com) hooks: (`pre-comment install`)
or via pipenv (`pipenv install --dev pre-commit --python 3.7; pipenv run pre-commit install`);
- Remove the first two lines from `.git/hooks/pre-commit` if you have any trouble making commits due to `Syntax error: "(" unexpected` errors
- Download the datasets (approximately 4GB in size) for running tests (`python -m nltk.downloader all`)
or via pipenv (`pipenv run python -m nltk.downloader all`);
- Create a remote link from your local repository to the
upstream `nltk/nltk` on GitHub
(`git remote add upstream https://github.com/nltk/nltk.git`) --
Expand All @@ -66,18 +70,44 @@ We use the famous
[gitflow](https://nvie.com/posts/a-successful-git-branching-model/) to manage our
branches.

Here's how to set up gitflow in a fresh copy of nltk:

`git checkout develop`
`git branch main`
`git flow init`
```
Which branch should be used for bringing forth production releases?
- develop
- main
Branch name for production releases: [main] main

Which branch should be used for integration of the "next release"?
- develop
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
Hooks and filters directory? [/home/<path to your copy>/nltk/.git/hooks]
```

Summary of our git branching model:
- Go to the `develop` branch (`git checkout develop`);
- Get all the latest work from the upstream `nltk/nltk` repository
(`git pull upstream develop`);
- Create a new branch off of `develop` with a descriptive name (for example:
`feature/portuguese-sentiment-analysis`, `hotfix/bug-on-downloader`). You can
do it by switching to the `develop` branch (`git checkout develop`) and then
creating a new branch (`git checkout -b name-of-the-new-branch`);
creating a new branch directly (`git checkout -b name-of-the-new-branch`)
or with Gitflow (`git flow feature start name-of-the-new-branch`);
- Do many small commits on that branch locally (`git add files-changed`,
`git commit -m "Add some change"`);
- Run the tests to make sure nothing breaks
(`tox -e py37` if you are on Python 3.7);
(`tox -e py37` if you are on Python 3.7, within `pipenv shell` if you're using pipenv);
- Add your name to the `AUTHORS.md` file as a contributor;
- Push to your fork on GitHub (with the name as your local branch:
`git push origin branch-name`);
Expand Down Expand Up @@ -196,9 +226,15 @@ For example, using `pipenv`:
```
git clone https://github.com/nltk/nltk.git
cd nltk
pipenv install -r pip-req.txt
pipenv install tox
tox -e py37
pipenv install -r pip-req.txt --python 3.7
pipenv install --dev tox
pipenv run python -m nltk.downloader all
pipenv run tox -e py37
```

Or to run just one test using tox:
```
pipenv run tox -e py37 -- nltk/test/inference.doctest
```


Expand Down
16 changes: 0 additions & 16 deletions nltk/test/inference.doctest
Original file line number Diff line number Diff line change
Expand Up @@ -301,23 +301,7 @@ statements as new assumptions.
True
>>> print(prover.proof())
============================== prooftrans ============================
Prover9 (...) version ...
Process ... was started by ... on ...
...
The command was ".../prover9".
============================== end of head ===========================
<BLANKLINE>
============================== end of input ==========================
<BLANKLINE>
============================== PROOF =================================
<BLANKLINE>
% -------- Comments from original proof --------
% Proof 1 at ... seconds.
% Length of proof is 13.
% Level of proof is 4.
% Maximum clause weight is 0.
% Given clauses 0.
<BLANKLINE>
1 (all x (boxerdog(x) -> dog(x))). [assumption].
2 (all x (boxer(x) -> person(x))). [assumption].
3 (all x -(dog(x) & person(x))). [assumption].
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ commands =
pip install scipy scikit-learn

; pytest --cov=nltk --cov-report html:{envdir}/docs nltk/test/
pytest
pytest {posargs}

[testenv:pypy]
; numpy is bundled with pypy; coverage is extra slow and
Expand Down