Skip to content

Commit 8443934

Browse files
author
Scott Sanderson
authored
Merge pull request #2631 from willianpaixao/willianpaixao_precommit-hooks
Introducing pre-commit hooks
2 parents 0a01e24 + 6e62c9c commit 8443934

File tree

11 files changed

+32
-17
lines changed

11 files changed

+32
-17
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ install:
9494
- ps: $env:PYTABLES_VERSION=(sls "tables==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
9595
- ps: $env:H5PY_VERSION=(sls "h5py==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
9696
- ps: $env:TALIB_VERSION=(sls "TA-Lib==(.*)" .\etc\requirements_talib.txt -ca).matches.groups[1].value
97-
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
97+
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
9898
# Since conda installs latest certifi by default, we would fail to uninstall that new version when trying to install the pinned version using pip later in the build:
9999
# "Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall."
100100
- ps: $env:CERTIFI_VERSION=(sls "certifi==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ TAGS
7777

7878
.gdb_history
7979

80-
*.dSYM/
80+
*.dSYM/

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: 'v2.4.0'
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-merge-conflict
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
10+
- repo: https://gitlab.com/pycqa/flake8
11+
rev: '3.7.9'
12+
hooks:
13+
- id: flake8

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ install:
7373
# Make sure stdout is in blocking mode. If we don't, then conda create will barf during downloads.
7474
# See https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959 for details.
7575
- python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
76-
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
76+
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
7777
# Since conda installs latest certifi by default, we would fail to uninstall that new version when trying to install the pinned version using pip later in the build:
7878
# "Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall."
7979
- conda create -n testenv --use-local --yes -c quantopian -c quantopian/label/ci pip python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY_VERSION pandas=$PANDAS_VERSION scipy=$SCIPY_VERSION ta-lib=$TALIB_VERSION libgfortran=3.0 certifi=$CERTIFI_VERSION

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Zipline is a Pythonic algorithmic trading library. It is an event-driven
1616
system for backtesting. Zipline is currently used in production as the backtesting and live-trading
1717
engine powering `Quantopian <https://www.quantopian.com>`_ -- a free,
1818
community-centered, hosted platform for building and executing trading
19-
strategies. Quantopian also offers a `fully managed service for professionals <https://factset.quantopian.com>`_
19+
strategies. Quantopian also offers a `fully managed service for professionals <https://factset.quantopian.com>`_
2020
that includes Zipline, Alphalens, Pyfolio, FactSet data, and more.
2121

2222
- `Join our Community! <https://groups.google.com/forum/#!forum/zipline>`_

docs/source/development-guidelines.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ First, you'll need to clone Zipline by running:
2020
Then check out to a new branch where you can make your changes:
2121

2222
.. code-block:: bash
23-
23+
2424
$ git checkout -b some-short-descriptive-name
2525
2626
If you don't already have them, you'll need some C library dependencies. You can follow the `install guide`__ to get the appropriate dependencies.
@@ -122,7 +122,7 @@ Then run ``pip install`` TA-lib:
122122
You should now be free to run tests:
123123

124124
.. code-block:: bash
125-
125+
126126
$ nosetests
127127
128128
@@ -144,7 +144,7 @@ Packaging
144144
To learn about how we build Zipline conda packages, you can read `this`__ section in our release process notes.
145145

146146
__ release-process.html#uploading-conda-packages
147-
147+
148148
Contributing to the Docs
149149
------------------------
150150

@@ -209,7 +209,7 @@ __ https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project
209209
210210
At least one of those calculations, max_leverage, was causing a
211211
divide by zero error.
212-
212+
213213
Instead of papering over that error, the entire calculation was
214214
a bit suspect so removing, with possibility of adding it back in
215215
later with handling the case (or raising appropriate errors) when

docs/source/install.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ channel:
124124
125125
Managing ``conda`` environments
126126
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127-
It is recommended to install Zipline in an isolated ``conda`` environment.
128-
Installing Zipline in ``conda`` environments will not interfere your default
129-
Python deployment or site-packages, which will prevent any possible conflict
130-
with your global libraries. For more information on ``conda`` environment, see
127+
It is recommended to install Zipline in an isolated ``conda`` environment.
128+
Installing Zipline in ``conda`` environments will not interfere your default
129+
Python deployment or site-packages, which will prevent any possible conflict
130+
with your global libraries. For more information on ``conda`` environment, see
131131
the `Conda User Guide <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`_
132132

133133
Assuming ``conda`` has been set up, you can create a ``conda`` environment:
@@ -146,7 +146,7 @@ Assuming ``conda`` has been set up, you can create a ``conda`` environment:
146146
147147
148148
Now you have set up an isolated environment called ``env_zipline``, a sandbox-like
149-
structure to install Zipline. Then you should activate the conda environment
149+
structure to install Zipline. Then you should activate the conda environment
150150
by using the command
151151

152152
.. code-block:: bash
@@ -164,4 +164,3 @@ To deactivate the ``conda`` environment:
164164
.. code-block:: bash
165165
166166
(env_zipline) $ source deactivate
167-

etc/ordered_pip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
a=0
44
while read line
5-
do
5+
do
66
if [[ -n "$line" && "$line" != \#* ]] ; then
77
# forward to pip any args after the reqs filename
88
pip install --exists-action w $line "${@:2}"

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ versionfile_source=zipline/_version.py
2222
versionfile_build=zipline/_version.py
2323
tag_prefix=
2424
parentdir_prefix= zipline-
25+
26+
[flake8]
27+
exclude =
28+
versioneer.py

zipline/api.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,4 +811,3 @@ def symbols(*args):
811811
--------
812812
:func:`zipline.api.set_symbol_lookup_date`
813813
"""
814-

0 commit comments

Comments
 (0)