Skip to content

Commit f288284

Browse files
authored
Initial pre-commit hooks and documentation (nltk#2753)
1 parent 0d14c22 commit f288284

Some content is hidden

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

73 files changed

+348
-387
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: fix-byte-order-marker
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- id: requirements-txt-fixer

CONTRIBUTING.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ repository [nltk/nltk](https://github.com/nltk/nltk/):
5151
(`git clone https://github.com/<your-github-username>/nltk.git`);
5252
- Run `cd nltk` to get to the root directory of the `nltk` code base;
5353
- Install the dependencies (`pip install -r pip-req.txt`);
54+
- Install the [pre-commit](https://pre-commit.com) hooks: (`pre-commit install`)
5455
- Download the datasets for running tests
5556
(`python -m nltk.downloader all`);
5657
- Create a remote link from your local repository to the
@@ -150,33 +151,33 @@ pytest # all tests
150151

151152
**Deprecated:** NLTK uses [Cloudbees](https://nltk.ci.cloudbees.com/) for continuous integration.
152153

153-
NLTK uses [Travis](https://travis-ci.org/nltk/nltk/) for continuous integration.
154+
NLTK uses [Travis](https://travis-ci.org/nltk/nltk/) for continuous integration.
154155

155156
The [`.travis.yml`](https://github.com/nltk/nltk/blob/travis/.travis.yml) file configures the server:
156157

157-
- `matrix: include:` section
158+
- `matrix: include:` section
158159
- tests against supported Python versions (3.5, 3.6, 3.7, 3.8, 3.9)
159160
- all python versions run the `py-travis` tox test environment in the [`tox.ini`](https://github.com/nltk/nltk/blob/travis/tox.ini#L105) file
160161
- tests against Python 3.6 for third-party tools APIs
161162

162-
- `before_install:` section
163+
- `before_install:` section
163164
- checks the Java and Python version calling the `tools/travis/pre-install.sh` script
164165
- changes the permission for `tools/travis/coverage-pylint.sh` to allow it to be executable
165166
- changes the permission for `tools/travis/third-party.sh` to allow it to be executable
166-
167+
167168
- `install` section
168169
- the `tools/travis/install.sh` installs the `pip-req.txt` for NLTK and the necessary python packages for CI testing
169170
- install `tox` for testing
170-
171-
- `py-travis` tox test environment generally
171+
172+
- `py-travis` tox test environment generally
172173
- the `extras = all` dependencies in needed to emulate `pip install nltk[all]`, see https://tox.readthedocs.io/en/latest/config.html#confval-extras=MULTI-LINE-LIST
173174
- for the `py-travis-third-party` build, it will run `tools/travis/third-party.sh` to install third-party tools (Stanford NLP tools and CoreNLP and SENNA)
174175
- calls `tools/travis/coverage-pylint.sh` shell script that calls `pytest` with [`pytest-cov`](https://pytest-cov.readthedocs.io/) and
175176
- calls `pylint` # Currently, disabled because there's lots to clean...
176177

177178
- before returning a `true` to state that the build is successful
178-
179-
179+
180+
180181
#### To test with `tox` locally
181182

182183
First setup a new virtual environment, see https://docs.python-guide.org/dev/virtualenvs/
@@ -191,7 +192,7 @@ pipenv install -r pip-req.txt
191192
pipenv install tox
192193
tox -e py37
193194
```
194-
195+
195196

196197
# Discussion
197198

0 commit comments

Comments
 (0)