Skip to content

Commit

Permalink
Merge pull request #13 from Bernardo-MG/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Bernardo-MG committed Jan 19, 2017
2 parents f6e0db0 + a7df4ce commit df8dc1b
Show file tree
Hide file tree
Showing 15 changed files with 130 additions and 48 deletions.
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,31 @@ matrix:
include:
- python: "2.7"
env: TEST_DOCS=true DEPLOY_DOCS=true
addons:
apt:
packages:
- sshpass

before_install:
# Gets scripts
- git clone -b v0.2.0 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
- git clone -b v0.4.1 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
# Sets scripts as executable
- chmod -R +x ~/.scripts/*
# Prepares CI environment
- source ~/.scripts/travis/load-travis-environment.sh
install:
# tox is required for the tests
- pip install tox
# sphinx is required for the docs
- pip install sphinx
# Dependencies
- pip install --upgrade -r requirements.txt
script:
# Documentation tests are run
- ~/.scripts/python/run_tests.sh $DO_TEST_DOCS docs
after_success:
# Documentation deployment
- ~/.scripts/rtd/deploy.sh $DO_DEPLOY_DOCS cookiecutter-python-library
- ~/.scripts/sphinx/build-html.sh $DO_DEPLOY_DOCS docs
- cd ~/sphinx/build/html
- ~/.scripts/deploy/deploy-ssh.sh $DO_DEPLOY_DOCS_RELEASE $DEPLOY_USERNAME $DEPLOY_PASSWORD $DEPLOY_HOST $DEPLOY_PORT $DEPLOY_PATH_RELEASE
- ~/.scripts/deploy/deploy-ssh.sh $DO_DEPLOY_DOCS_DEVELOP $DEPLOY_USERNAME $DEPLOY_PASSWORD $DEPLOY_HOST $DEPLOY_PORT $DEPLOY_PATH_DEVELOP
18 changes: 9 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ While it mostly follows my personal tastes, it offers a series of good
practices which include deployment files, makefile, testing, and the use of
various free services, such as Github, Travis and Pypi.

.. image:: https://readthedocs.org/projects/cookiecutter-python-library/badge/?version=latest
:target: http://cookiecutter-python-library.readthedocs.org/en/latest/
:alt: Cookiecutter Python Library latest documentation Status
.. image:: https://readthedocs.org/projects/cookiecutter-python-library/badge/?version=develop
:target: http://cookiecutter-python-library.readthedocs.org/en/develop/
:alt: Cookiecutter Python Library development documentation Status
.. image:: https://img.shields.io/badge/docs-release-blue.svg
:target: http://docs.wandrell.com/cookiecutter-python-library
:alt: Cookiecutter Python Library latest documentation
.. image:: https://img.shields.io/badge/docs-develop-blue.svg
:target: http://docs.wandrell.com/development/cookiecutter-python-library
:alt: Cookiecutter Python Library development documentation

Features
--------
Expand Down Expand Up @@ -45,7 +45,7 @@ documentation sites:
- The `development docs`_ are generated from the latest code in the 'develop' branch

You can also create the documentation from the source files, kept in the 'docs'
folder, with the help of Sphinx. For this use the makefile, or the make.bat
folder, with the help of `Sphinx`_. For this use the makefile, or the make.bat
file, contained on that folder.

Usage
Expand Down Expand Up @@ -114,8 +114,8 @@ The project has been released under the `MIT License`_.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _GitHub project page: https://github.com/Bernardo-MG/cookiecutter-python-library
.. _project issues tracker: https://github.com/Bernardo-MG/cookiecutter-python-library/issues
.. _latest docs: http://cookiecutter-python-library.readthedocs.org/en/latest/
.. _development docs: http://cookiecutter-python-library.readthedocs.org/en/develop/
.. _latest docs: http://docs.wandrell.com/cookiecutter-python-library
.. _development docs: http://docs.wandrell.com/development/cookiecutter-python-library
.. _MIT License: http://www.opensource.org/licenses/mit-license.php
.. _Sphinx: http://sphinx-doc.org/
.. _Sphinx Docs Theme: https://github.com/Bernardo-MG/sphinx-docs-theme
Expand Down
4 changes: 3 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
"package_name": "python-library",
"project_short_description": "A library for Python",
"year": "2016",
"version": "0.1.2"
"version": "0.1.2",
"docs_release_url": "docs.wandrell.com",
"docs_development_url": "docs.wandrell.com/development"
}
22 changes: 0 additions & 22 deletions docs/source/_templates/about_code.html

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ twine==1.8.1
cookiecutter==1.4.0

# Documentation
sphinx-docs-theme==0.2.0
sphinx-docs-theme==0.2.3
Pygments==2.1.3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def run_tests(self):
include_package_data=True,
package_data={
},
version='0.1.2',
version='0.1.3',
description='Cookiecutter template for Python libraries.',
author='Bernardo Martínez Garrido',
author_email='programming@wandrell.com',
Expand Down
17 changes: 14 additions & 3 deletions {{cookiecutter.package_name}}/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ matrix:
# Tests and deploys docs, also runs coverage report
- python: "3.5"
env: COVERAGE=true TEST_DOCS=true DEPLOY_DOCS=true
addons:
apt:
packages:
- sshpass

before_install:
# Gets scripts
- git clone -b v0.2.0 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
- git clone -b v0.4.1 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
# Sets scripts as executable
- chmod -R +x ~/.scripts/*
# Prepares CI environment
Expand All @@ -36,15 +40,22 @@ before_install:
install:
# tox is required for the tests
- pip install tox
# sphinx is required for the docs
- pip install sphinx
# Dependencies
- pip install --upgrade -r requirements.txt
script:
# Code is checked
- ~/.scripts/python/run_tests.sh true check
# Tests are run
- ~/.scripts/python/run_tests.sh true $PYTHON_VERSION_TEST
# Documentation tests are run
- ~/.scripts/python/run_tests.sh $DO_TEST_DOCS docs
# Tests coverage is run
# Documentation tests are run
- ~/.scripts/python/run_tests.sh $DO_COVERAGE coverage
after_success:
# Documentation deployment
- ~/.scripts/rtd/deploy.sh $DO_DEPLOY_DOCS {{cookiecutter.package_name}}
- ~/.scripts/sphinx/build-html.sh $DO_DEPLOY_DOCS docs
- cd ~/sphinx/build/html
- ~/.scripts/deploy/deploy-ssh.sh $DO_DEPLOY_DOCS_RELEASE $DEPLOY_USERNAME $DEPLOY_PASSWORD $DEPLOY_HOST $DEPLOY_PORT $DEPLOY_PATH_RELEASE
- ~/.scripts/deploy/deploy-ssh.sh $DO_DEPLOY_DOCS_DEVELOP $DEPLOY_USERNAME $DEPLOY_PASSWORD $DEPLOY_HOST $DEPLOY_PORT $DEPLOY_PATH_DEVELOP
12 changes: 6 additions & 6 deletions {{cookiecutter.package_name}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ project according to a few pieces of data it will ask for.
:alt: {{ cookiecutter.project_name }} Pypi package page

.. image:: https://readthedocs.org/projects/{{ cookiecutter.package_name }}/badge/?version=latest
:target: http://{{ cookiecutter.package_name }}.readthedocs.org/en/latest/
:target: http://{{ cookiecutter.docs_release_url }}/{{ cookiecutter.package_name }}
:alt: {{ cookiecutter.project_name }} latest documentation Status
.. image:: https://readthedocs.org/projects/{{ cookiecutter.package_name }}/badge/?version=develop
:target: http://{{ cookiecutter.package_name }}.readthedocs.org/en/develop/
:target: http://{{ cookiecutter.docs_development_url }}/{{ cookiecutter.package_name }}
:alt: {{ cookiecutter.project_name }} development documentation Status

Features
Expand All @@ -47,7 +47,7 @@ documentation sites:
- The `development docs`_ are generated from the latest code in the 'develop' branch

You can also create the documentation from the source files, kept in the 'docs'
folder, with the help of Sphinx. For this use the makefile, or the make.bat
folder, with the help of `Sphinx`_. For this use the makefile, or the make.bat
file, contained on that folder.

Prerequisites
Expand Down Expand Up @@ -84,7 +84,7 @@ the following command:
Usage
-----

The application has been coded in Python, without using any particular
The application has been coded in Python, and does not require any particular
framework.

Collaborate
Expand Down Expand Up @@ -114,8 +114,8 @@ License
The project has been released under the `MIT License`_.

.. _GitHub project page: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.package_name }}
.. _latest docs: http://{{ cookiecutter.package_name }}.readthedocs.org/en/latest/
.. _development docs: http://{{ cookiecutter.package_name }}.readthedocs.org/en/develop/
.. _latest docs: http://{{ cookiecutter.docs_release_url }}/{{ cookiecutter.package_name }}
.. _development docs: http://{{ cookiecutter.docs_development_url }}/{{ cookiecutter.package_name }}
.. _Pypi package: https://pypi.python.org/pypi/{{ cookiecutter.package_name }}
.. _MIT License: http://www.opensource.org/licenses/mit-license.php
.. _project issues tracker: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.package_name }}/issues
Expand Down
7 changes: 7 additions & 0 deletions {{cookiecutter.package_name}}/docs/source/code/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=========
Code docs
=========

.. toctree::

placeholder
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
==================
Placeholder module
==================

.. automodule:: placeholder
:members:
:undoc-members:
:inherited-members:
:show-inheritance:
3 changes: 2 additions & 1 deletion {{cookiecutter.package_name}}/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
('Usage', './usage.html')],
'navbar_links': [('Documentation', [('Acquire', './acquire.html'),
('Usage', './usage.html')]),
('Info and Reports', [('Reports', './reports.html')])],
('Info and Reports', [('Reports', './reports.html'),
('Code docs', './code/index.html')])],
}

# Output file base name for HTML help builder.
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.package_name}}/docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Features
acquire
usage
reports
code/index
2 changes: 1 addition & 1 deletion {{cookiecutter.package_name}}/docs/source/reports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Report Description
============ ===

.. _Coveralls: https://coveralls.io/github/{{ cookiecutter.github_username }}/{{ cookiecutter.package_name }}
.. _Landscape: https://landscape.io/github/{{ cookiecutter.github_username }}/{{ cookiecutter.package_name }}/master
.. _Landscape: https://landscape.io/github/{{ cookiecutter.github_username }}/{{ cookiecutter.package_name }}
2 changes: 1 addition & 1 deletion {{cookiecutter.package_name}}/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ setuptools==26.1.1
twine==1.8.1

# Documentation
sphinx-docs-theme==0.2.0
sphinx-docs-theme==0.2.3
Pygments==2.1.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-

from abc import ABCMeta, abstractmethod

"""
Placeholder classes.
Replace this module for the actual code.
"""

__author__ = '{{ cookiecutter.developer_name }}'
__license__ = 'MIT'


class AbstractPlaceholder(object):
"""
Placeholde for an abstract class.
"""
__metaclass__ = ABCMeta

def __init__(self):
pass

@abstractmethod
def method(self):
"""
An abstract method.
"""
raise NotImplementedError('The roll method must be implemented')


class Placeholder(AbstractPlaceholder):
"""
An extension of the abstract placeholder.
"""

def __init__(self, data):
super(Placeholder, self).__init__()
self._field = data

def __str__(self):
return '%s' % self.field

def __repr__(self):
return '<class %s>(field=%r)' % \
(self.__class__.__name__, self.field)

@property
def field(self):
"""
A field in the placeholder class.
:return: the field content
"""
return self._field

@field.setter
def field(self, field):
self._field = field

def method(self):
pass

0 comments on commit df8dc1b

Please sign in to comment.