-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debug echo selective remove files corrected badges title of homepage nojekyll and not delete files before doc update change username reset doc url to blank doc url test change doc header name dfx option modify doc pushing url typo remove last few traces of stub corrected readme to refer to skltemplate renames top level module to skltemplate grammar correction in readme merge changes from origin change name in docs Initial renaming stub to template Merge pull request #3 from jnothman/patch-1 Note about improving check_estimator Typos Changed forking to cloning correct typo remove -i added pypi instructions changed package name updated readme link changed harcoded module name renames scripts folder and avoided hard coding in test.sh Merge pull request #2 from jnothman/readme DOC Assorted fixes and additions to README added gallery installation to readme installing sphinx-gallery Build gallery using sphinx gallery removed user guide file moved user guide in readme doc clrifications use macro instead of hard code clarified numpy installation guide enh user guide changes elaborated circleCI section testing tables set vars in circle.yml added branch command var names in push doc Added nose line Added coveralls info Added forking and CI instructions changed user guide to markdown Create user_guide.rst installation chances and macro for docs url added link to docs changed badge style added circle ci badge doc change add docs properly only add docs folder force clean properly force clean added clean command forced checkout git changes added extra slash move via tmp folder remove deletion command reenable pushing script copy files from inside html folder doc prefix debug changes forced checkout added debug find command chnaged git commands dir changes modified push_doc changed push url loc corrected spelling name correction install pillow added doc push script try removing pythonpath changed install to develop added clean command install sklearn corrected sphinx command make pip install dependencies removed the user option from install fixed import for python 3 fixed tests made build branch master renamed circle.yml added circle yml added nature theme genete example plots added sphinx doc files added docstrings added own links rename to rst added sklearns doc added rst mode changed readme to show badges create success script no timer in tests specify test dir added coverage command removed mpl from requirements make conda install mpl changed cython version use miniconda travis changed added travis yml moved and renamed things added tests Added DemoEstimator corrected import nose correction requirements correction remove setup requires option added import warnings adde numpy scipy and cython to setup requires added sklearn to requirements added requirements created python package Initial commit
- Loading branch information
0 parents
commit b388a2f
Showing
26 changed files
with
1,412 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# scikit-learn specific | ||
doc/_build/ | ||
doc/auto_examples/ | ||
doc/modules/generated/ | ||
doc/datasets/generated/ | ||
|
||
# Distribution / packaging | ||
|
||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
language: python | ||
|
||
cache: | ||
apt: true | ||
# We use three different cache directory | ||
# to work around a Travis bug with multi-platform cache | ||
directories: | ||
- $HOME/.cache/pip | ||
- $HOME/download | ||
env: | ||
global: | ||
# Directory where tests are run from | ||
- TEST_DIR=/tmp/test_dir/ | ||
- MODULE=skltemplate | ||
matrix: | ||
- DISTRIB="conda" PYTHON_VERSION="2.7" | ||
NUMPY_VERSION="1.6.2" SCIPY_VERSION="0.11.0" CYTHON_VERSION="0.21" | ||
- DISTRIB="conda" PYTHON_VERSION="3.5" COVERAGE="true" | ||
NUMPY_VERSION="1.10.1" SCIPY_VERSION="0.16.0" CYTHON_VERSION="0.23.4" | ||
|
||
install: source ci_scripts/install.sh | ||
script: bash ci_scripts/test.sh | ||
after_success: source ci_scripts/success.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2016, Vighnesh Birodkar | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of project-template nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
#project-template - A template for scikit-learn extensions | ||
|
||
[![Travis Status](https://travis-ci.org/scikit-learn-contrib/project-template.svg?branch=master)](https://travis-ci.org/scikit-learn-contrib/project-template) | ||
[![Coveralls Status](https://coveralls.io/repos/scikit-learn-contrib/project-template/badge.svg?branch=master&service=github)](https://coveralls.io/r/scikit-learn-contrib/project-template) | ||
[![CircleCI Status](https://circleci.com/gh/scikit-learn-contrib/project-template.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/scikit-learn-contrib/project-template/tree/master) | ||
|
||
**project-template** is a template project for | ||
[scikit-learn](http://scikit-learn.org/) | ||
compatible extensions. | ||
|
||
It aids development of estimators that can be used in scikit-learn pipelines | ||
and (hyper)parameter search, while facilitating testing (including some API | ||
compliance), documentation, open source development, packaging, and continuous | ||
integration. | ||
|
||
## Important Links | ||
HTML Documentation - http://vighneshbirodkar.github.io/project-template/docs/ | ||
|
||
## Installation and Usage | ||
The package by itself comes with a single module and an estimator. Before | ||
installing the module you will need `numpy` and `scipy`. | ||
To install the module execute: | ||
```shell | ||
$ python setup.py install | ||
``` | ||
or | ||
``` | ||
pip install sklearn-template | ||
``` | ||
|
||
If the installation is successful, and `scikit-learn` is correctly installed, | ||
you should be able to execute the following in Python: | ||
```python | ||
>>> from skltemplate import TemplateEstimator | ||
>>> estimator = TemplateEstimator() | ||
>>> estimator.fit(np.arange(10), np.arange(10)) | ||
``` | ||
|
||
`TemplateEstimator` by itself does nothing useful, but it serves as an example | ||
of how other Estimators should be written. It also comes with its own unit | ||
tests under `template/tests` which can be run using `nosetests`. | ||
|
||
## Creating your own library | ||
|
||
### 1. Cloning | ||
Clone the project into your computer by executing | ||
```shell | ||
$ git clone https://github.com/vighneshbirodkar/project-template.git | ||
``` | ||
You should rename the `project-template` folder to the name of your project. | ||
To host the project on Github, visit https://github.com/new and create a new | ||
repository. To upload your project on Github execute | ||
```shell | ||
$ git remote add origin https://github.com/username/project-name.git | ||
$ git push origin master | ||
``` | ||
|
||
### 2. Modifying the Source | ||
You are free to modify the source as you want, but at the very least, all your | ||
estimators should pass the [`check_estimator`](http://scikit-learn.org/stable/modules/generated/sklearn.utils.estimator_checks.check_estimator.html#sklearn.utils.estimator_checks.check_estimator) | ||
test to be scikit-learn compatible. | ||
(If there are valid reasons your estimator cannot pass `check_estimator`, please | ||
[raise an issue](https://github.com/scikit-learn/scikit-learn/issues/new) at | ||
scikit-learn so we can make `check_estimator` more flexible.) | ||
|
||
This template is particularly useful for publishing open-source versions of | ||
algorithms that do not meet the criteria for inclusion in the core scikit-learn | ||
package (see [FAQ](http://scikit-learn.org/stable/faq.html)), such as recent | ||
and unpopular developments in machine learning. | ||
However, developing using this template may also be a stepping stone to | ||
eventual inclusion in the core package. | ||
|
||
In any case, developers should endeavor to adhere to scikit-learn's | ||
[Contributor's Guide](http://scikit-learn.org/stable/developers/) which promotes | ||
the use of: | ||
* algorithm-specific unit tests, in addition to `check_estimator`'s common tests | ||
* [PEP8](https://www.python.org/dev/peps/pep-0008/)-compliant code | ||
* a clearly documented API using [NumpyDoc](https://github.com/numpy/numpydoc) | ||
and [PEP257](https://www.python.org/dev/peps/pep-0257/)-compliant docstrings | ||
* references to relevant scientific literature in standard citation formats | ||
* [doctests](https://docs.python.org/3/library/doctest.html) to provide | ||
succinct usage examples | ||
* standalone examples to illustrate the usage, model visualisation, and | ||
benefits/benchmarks of particular algorithms | ||
* efficient code when the need for optimization is supported by benchmarks | ||
|
||
### 3. Modifying the Documentation | ||
|
||
The documentation is built using [sphinx](http://www.sphinx-doc.org/en/stable/). | ||
It incorporates narrative documentation from the `doc/` directory, standalone | ||
examples from the `examples/` directory, and API reference compiled from | ||
estimator docstrings. | ||
|
||
To build the documentation locally, ensure that you have `sphinx`, | ||
`sphinx-gallery` and `matplotlib` by executing: | ||
```shell | ||
$ pip install sphinx matplotlib sphinx-gallery | ||
``` | ||
The documentation contains a home page (`doc/index.rst`), an API | ||
documentation page (`doc/api.rst`) and a page documenting the `template` module | ||
(`doc/template.rst`). Sphinx allows you to automatically document your modules | ||
and classes by using the `autodoc` directive (see `template.rst`). To change the | ||
asthetics of the docs and other paramteres, edit the `doc/conf.py` file. For | ||
more information visit the [Sphinx Documentation](http://www.sphinx-doc.org/en/stable/contents.html). | ||
|
||
You can also add code examples in the `examples` folder. All files inside | ||
the folder of the form `plot_*.py` will be executed and their generated | ||
plots will be available for viewing in the `/auto_examples` URL. | ||
|
||
To build the documentation locally execute | ||
```shell | ||
$ cd doc | ||
$ make html | ||
``` | ||
|
||
### 4. Setting up Travis CI | ||
[TravisCI](https://travis-ci.org/) allows you to continuously build and test | ||
your code from Github to ensure that no code-breaking changes are pushed. After | ||
you sign up and authourize TravisCI, add your new repository to TravisCI so that | ||
it can start building it. The `travis.yml` contains the configuration required | ||
for Travis to build the project. You will have to update the variable `MODULE` | ||
with the name of your module for Travis to test it. Once you add the project on | ||
TravisCI, all subsequent pushes on the master branch will trigger a Travis | ||
build. By default, the project is tested on Python 2.7 and Python 3.5. | ||
|
||
### 5. Setting up Coveralls | ||
[Coveralls](https://coveralls.io/) reports code coverage statistics of your | ||
tests on each push. Sign up on Coveralls and add your repository so that | ||
Coveralls can start monitoring it. The project already contains the required | ||
configuration for Coveralls to work. All subsequent builds after adding your | ||
project will generate a coverage report. | ||
|
||
### 6. Setting up Circle CI | ||
The project uses [CircleCI](https://circleci.com/) to build its documentation | ||
from the `master` branch and host it using [Github Pages](https://pages.github.com/). | ||
Again, you will need to Sign Up and authorize CircleCI. The configuration | ||
of CircleCI is governed by the `circle.yml` file, which needs to be mofified | ||
if you want to setup the docs on your own website. The values to be changed | ||
are | ||
|
||
| Variable | Value| | ||
|----------|------| | ||
| `USERNAME` | The name of the user or organization of the repository where the project and documentation is hosted | | ||
| `DOC_REPO` | The repository where the documentation will be hosted. This can be the same as the project repository | | ||
| `DOC_URL` | The relative URL where the documentation will be hosted | | ||
| `EMAIL` | The email id to use while pushing the documentation, this can be any valid email address | | ||
|
||
In addition to this, you will need to grant access to the CircleCI computers | ||
to push to your documentation repository. To do this, visit the Project Settings | ||
page of your project in CircleCI. Select `Checkout SSH keys` option and then | ||
choose `Create and add user key` option. This should grant CircleCI privileges | ||
to push to the repository `https://github.com/USERNAME/DOC_REPO/`. | ||
|
||
If all goes well, you should be able to visit the documentation of your project | ||
on | ||
``` | ||
https://github.com/USERNAME/DOC_REPO/DOC_URL | ||
``` | ||
|
||
### 7. Adding Badges | ||
|
||
Follow the instructions to add a [Travis Badge](https://docs.travis-ci.com/user/status-images/), | ||
[Coveralls Badge](https://coveralls.io) and | ||
[CircleCI Badge](https://circleci.com/docs/status-badges) to your repository's | ||
`README`. | ||
|
||
### 8. Advertising your package | ||
|
||
Once your work is mature enough for the general public to use it, you should | ||
submit a Pull Request to modify scikit-learn's | ||
[related projects listing](https://github.com/scikit-learn/scikit-learn/edit/master/doc/related_projects.rst). | ||
Please insert brief description of your project and a link to its code | ||
repository or PyPI page. | ||
You may also wish to announce your work on the | ||
[`scikit-learn-general` mailing list](https://lists.sourceforge.net/lists/listinfo/scikit-learn-general). | ||
|
||
### 9. Uploading your package to PyPI | ||
|
||
Uploading your package to [PyPI](https://pypi.python.org/pypi) allows users to | ||
install your package through `pip`. Python provides two repositories to upload | ||
your packages. The [PyPI Test](https://testpypi.python.org/pypi) repository, | ||
which is to be used for testing packages before their release, and the | ||
[PyPI](https://pypi.python.org/pypi) repository, where you can make your | ||
releases. You need to register a username and password with both these sites. | ||
The username and passwords for both these sites need not be the same. To upload | ||
your package through the command line, you need to store your username and | ||
password in a file called `.pypirc` in your `$HOME` directory with the | ||
following format. | ||
|
||
```shell | ||
[distutils] | ||
index-servers = | ||
pypi | ||
pypitest | ||
|
||
[pypi] | ||
repository=https://pypi.python.org/pypi | ||
username=<your-pypi-username> | ||
password=<your-pypi-passowrd> | ||
|
||
[pypitest] | ||
repository=https://testpypi.python.org/pypi | ||
username=<your-pypitest-username> | ||
password=<your-pypitest-passowrd> | ||
``` | ||
Make sure that all details in `setup.py` are up to date. To upload your package | ||
to the Test server, execute: | ||
``` | ||
python setup.py register -r pypitest | ||
python setup.py sdist upload -r pypitest | ||
``` | ||
Your package should now be visible on: https://testpypi.python.org/pypi | ||
|
||
To install a package from the test server, execute: | ||
``` | ||
pip install -i https://testpypi.python.org/pypi <package-name> | ||
``` | ||
|
||
Similary, to upload your package to the PyPI server execute | ||
``` | ||
python setup.py register -r pypi | ||
python setup.py sdist upload -r pypi | ||
``` | ||
To install your package, execute: | ||
``` | ||
pip install <package-name> | ||
``` | ||
|
||
*Thank you for cleanly contributing to the scikit-learn ecosystem!* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Deactivate the travis-provided virtual environment and setup a | ||
# conda-based environment instead | ||
deactivate | ||
|
||
# Use the miniconda installer for faster download / install of conda | ||
# itself | ||
pushd . | ||
cd | ||
mkdir -p download | ||
cd download | ||
echo "Cached in $HOME/download :" | ||
ls -l | ||
echo | ||
if [[ ! -f miniconda.sh ]] | ||
then | ||
wget http://repo.continuum.io/miniconda/Miniconda-3.6.0-Linux-x86_64.sh \ | ||
-O miniconda.sh | ||
fi | ||
chmod +x miniconda.sh && ./miniconda.sh -b | ||
cd .. | ||
export PATH=/home/travis/miniconda/bin:$PATH | ||
conda update --yes conda | ||
popd | ||
|
||
# Configure the conda environment and put it in the path using the | ||
# provided versions | ||
conda create -n testenv --yes python=$PYTHON_VERSION pip nose \ | ||
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION cython=$CYTHON_VERSION | ||
matplotlib | ||
source activate testenv | ||
|
||
|
||
if [[ "$COVERAGE" == "true" ]]; then | ||
pip install coverage coveralls | ||
fi | ||
|
||
python --version | ||
python -c "import numpy; print('numpy %s' % numpy.__version__)" | ||
python -c "import scipy; print('scipy %s' % scipy.__version__)" | ||
python setup.py develop |
Oops, something went wrong.