mirror of
https://github.com/saymrwulf/zipline.git
synced 2026-05-14 20:58:10 +00:00
Introducing pre-commit hooks
In a intention to increase code quality and reducing faulty commits, pre-commits help checking the staged code for simple static code analysis.
This commit is contained in:
parent
6f72d19554
commit
11dadcaba4
11 changed files with 27 additions and 17 deletions
|
|
@ -94,7 +94,7 @@ install:
|
|||
- ps: $env:PYTABLES_VERSION=(sls "tables==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
|
||||
- ps: $env:H5PY_VERSION=(sls "h5py==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
|
||||
- ps: $env:TALIB_VERSION=(sls "TA-Lib==(.*)" .\etc\requirements_talib.txt -ca).matches.groups[1].value
|
||||
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
|
||||
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
|
||||
# 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:
|
||||
# "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."
|
||||
- ps: $env:CERTIFI_VERSION=(sls "certifi==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -77,4 +77,4 @@ TAGS
|
|||
|
||||
.gdb_history
|
||||
|
||||
*.dSYM/
|
||||
*.dSYM/
|
||||
|
|
|
|||
8
.pre-commit-config.yaml
Normal file
8
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: 'v2.4.0'
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-merge-conflict
|
||||
- id: flake8
|
||||
|
|
@ -73,7 +73,7 @@ install:
|
|||
# Make sure stdout is in blocking mode. If we don't, then conda create will barf during downloads.
|
||||
# See https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959 for details.
|
||||
- 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);'
|
||||
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
|
||||
# We conda install certifi at the pinned exact version because it is a transitive dependency of zipline via requests and uses distutils for packaging.
|
||||
# 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:
|
||||
# "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."
|
||||
- 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
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Zipline is a Pythonic algorithmic trading library. It is an event-driven
|
|||
system for backtesting. Zipline is currently used in production as the backtesting and live-trading
|
||||
engine powering `Quantopian <https://www.quantopian.com>`_ -- a free,
|
||||
community-centered, hosted platform for building and executing trading
|
||||
strategies. Quantopian also offers a `fully managed service for professionals <https://factset.quantopian.com>`_
|
||||
strategies. Quantopian also offers a `fully managed service for professionals <https://factset.quantopian.com>`_
|
||||
that includes Zipline, Alphalens, Pyfolio, FactSet data, and more.
|
||||
|
||||
- `Join our Community! <https://groups.google.com/forum/#!forum/zipline>`_
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ First, you'll need to clone Zipline by running:
|
|||
Then check out to a new branch where you can make your changes:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
||||
$ git checkout -b some-short-descriptive-name
|
||||
|
||||
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:
|
|||
You should now be free to run tests:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
||||
$ nosetests
|
||||
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ Packaging
|
|||
To learn about how we build Zipline conda packages, you can read `this`__ section in our release process notes.
|
||||
|
||||
__ release-process.html#uploading-conda-packages
|
||||
|
||||
|
||||
Contributing to the Docs
|
||||
------------------------
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ __ https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project
|
|||
|
||||
At least one of those calculations, max_leverage, was causing a
|
||||
divide by zero error.
|
||||
|
||||
|
||||
Instead of papering over that error, the entire calculation was
|
||||
a bit suspect so removing, with possibility of adding it back in
|
||||
later with handling the case (or raising appropriate errors) when
|
||||
|
|
|
|||
|
|
@ -124,10 +124,10 @@ channel:
|
|||
|
||||
Managing ``conda`` environments
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
It is recommended to install Zipline in an isolated ``conda`` environment.
|
||||
Installing Zipline in ``conda`` environments will not interfere your default
|
||||
Python deployment or site-packages, which will prevent any possible conflict
|
||||
with your global libraries. For more information on ``conda`` environment, see
|
||||
It is recommended to install Zipline in an isolated ``conda`` environment.
|
||||
Installing Zipline in ``conda`` environments will not interfere your default
|
||||
Python deployment or site-packages, which will prevent any possible conflict
|
||||
with your global libraries. For more information on ``conda`` environment, see
|
||||
the `Conda User Guide <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`_
|
||||
|
||||
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:
|
|||
|
||||
|
||||
Now you have set up an isolated environment called ``env_zipline``, a sandbox-like
|
||||
structure to install Zipline. Then you should activate the conda environment
|
||||
structure to install Zipline. Then you should activate the conda environment
|
||||
by using the command
|
||||
|
||||
.. code-block:: bash
|
||||
|
|
@ -164,4 +164,3 @@ To deactivate the ``conda`` environment:
|
|||
.. code-block:: bash
|
||||
|
||||
(env_zipline) $ source deactivate
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
a=0
|
||||
while read line
|
||||
do
|
||||
do
|
||||
if [[ -n "$line" && "$line" != \#* ]] ; then
|
||||
# forward to pip any args after the reqs filename
|
||||
pip install --exists-action w $line "${@:2}"
|
||||
|
|
|
|||
|
|
@ -22,3 +22,7 @@ versionfile_source=zipline/_version.py
|
|||
versionfile_build=zipline/_version.py
|
||||
tag_prefix=
|
||||
parentdir_prefix= zipline-
|
||||
|
||||
[flake8]
|
||||
exclude =
|
||||
versioneer.py
|
||||
|
|
|
|||
|
|
@ -811,4 +811,3 @@ def symbols(*args):
|
|||
--------
|
||||
:func:`zipline.api.set_symbol_lookup_date`
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ HOML
|
|||
GDXX
|
||||
GDJJ
|
||||
GDXS
|
||||
SMHD
|
||||
SMHD
|
||||
|
|
|
|||
Loading…
Reference in a new issue