Skip to content

Commit

Permalink
Merge pull request #16 from Bernardo-MG/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Bernardo-MG committed Jan 7, 2018
2 parents 86d3792 + 360abff commit bac2ba4
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 60 deletions.
39 changes: 22 additions & 17 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
* text=auto

# Known text files
*.xml text
*.yml text
*.md text
*.sh text
*.css text
*.txt text
*.css text diff=css
*.js text
*.json text
*.htm text diff=html
*.html text diff=html
*.properties text
*.sh text
*.md text
*.txt text
*.xml text
*.yml text

# Known source files
*.pxd text
*.py text
*.py3 text
*.pyw text
*.pyx text
*.pxd text diff=python
*.py text diff=python
*.py3 text diff=python
*.pyw text diff=python
*.pyx text diff=python

# Known binary files
*.db binary
*.p binary
*.pkl binary
*.pyc binary
*.pyd binary
*.pyo binary
*.db binary
*.p binary
*.pkl binary
*.pyc binary
*.pyd binary
*.pyo binary
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ addons:

before_install:
# Gets scripts
- git clone -b v1.1.3 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
- git clone -b v1.2.0 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
# Sets scripts as executable
- chmod -R +x ~/.scripts/*
# Prepares CI environment
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Installation and deployment
setuptools==26.1.1
twine==1.8.1
setuptools==38.2.5
twine==1.9.1

# Cookiecutter
cookiecutter==1.5.1
cookiecutter==1.6.0

# Documentation
Sphinx==1.6.5
sphinx-docs-theme==0.2.3
Pygments==2.2.0
30 changes: 24 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,32 @@ def read(*names, **kwargs):
).read()


# For running tox tests
class _ToxTester(test_command):
"""
Tox test command.
Calls tox for running the tests.
"""
user_options = [
('test-module=', 'm', "Run 'test_suite' in specified module"),
('test-suite=', 's',
"Run single test, case or suite (e.g. 'module.test_suite')"),
('test-runner=', 'r', "Test runner to use"),
('profile=', 'p', 'Test profile to use')
]

def initialize_options(self):
test_command.initialize_options(self)
self.profile = None

def finalize_options(self):
test_command.finalize_options(self)
self.test_args = []
self.test_suite = True

if self.profile is not None:
# Adds the profile argument
# For example: '-e=py36'
self.test_args.append('-e=' + self.profile)

def run_tests(self):
# import here, cause outside the eggs aren't loaded
Expand All @@ -48,7 +68,7 @@ def run_tests(self):
include_package_data=True,
package_data={
},
version='0.1.5',
version='0.1.6',
description='Cookiecutter template for Python libraries.',
author='Bernardo Martínez Garrido',
author_email='programming@bernardomg.com',
Expand All @@ -71,9 +91,7 @@ def run_tests(self):
],
long_description=read('README.rst'),
install_requires=[
'cookiecutter',
'setuptools',
'sphinx_docs_theme',
'cookiecutter'
],
tests_require=_tests_require,
extras_require={'test': _tests_require},
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ changedir =
docs/source
deps =
-r{toxinidir}/requirements.txt
sphinx
commands =
sphinx-build -b linkcheck ./ {envtmpdir}/html
sphinx-build -nW -b html -d {envtmpdir}/doctrees ./ {envtmpdir}/html
39 changes: 22 additions & 17 deletions {{cookiecutter.package_name}}/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
* text=auto

# Known text files
*.xml text
*.yml text
*.md text
*.sh text
*.css text
*.txt text
*.css text diff=css
*.js text
*.json text
*.htm text diff=html
*.html text diff=html
*.properties text
*.sh text
*.md text
*.txt text
*.xml text
*.yml text

# Known source files
*.pxd text
*.py text
*.py3 text
*.pyw text
*.pyx text
*.pxd text diff=python
*.py text diff=python
*.py3 text diff=python
*.pyw text diff=python
*.pyx text diff=python

# Known binary files
*.db binary
*.p binary
*.pkl binary
*.pyc binary
*.pyd binary
*.pyo binary
*.db binary
*.p binary
*.pkl binary
*.pyc binary
*.pyd binary
*.pyo binary
2 changes: 1 addition & 1 deletion {{cookiecutter.package_name}}/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ addons:

before_install:
# Gets scripts
- git clone -b v1.1.3 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
- git clone -b v1.2.0 --single-branch https://github.com/Bernardo-MG/ci-shell-scripts.git ~/.scripts
# Sets scripts as executable
- chmod -R +x ~/.scripts/*
# Prepares CI environment
Expand Down
19 changes: 15 additions & 4 deletions {{cookiecutter.package_name}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,29 @@ to install it. For this use the following command;

``$ pip install {{ cookiecutter.package_name }}``

If manual installation is required, the project includes a setup.py file, along
a makefile allowing direct installation of the library, which can be done with
the following command:
If needed, manual installation is possible:

``$ make install``
``$ python setup.py install``

Usage
-----

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

Testing
-------

The tests included with the project can be run with:

``$ python setup.py test``

This will delegate the execution to tox.

It is possible to run just one of the test profiles, in this case the py36 profile:

``$ python setup.py test -p "py36"``

Collaborate
-----------

Expand Down
20 changes: 19 additions & 1 deletion {{cookiecutter.package_name}}/docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,22 @@ Usage

Describe here how to use the library with some general use examples.

Any detailed topic should go into it's own section.
Any detailed topic should go into it's own section.

-------
Testing
-------

The tests included with the project can be run with:

.. code::
$ python setup.py test
This will delegate the execution to tox.

It is possible to run just one of the test profiles, in this case the py36 profile:

.. code::
$ python setup.py test -p "py36"
10 changes: 7 additions & 3 deletions {{cookiecutter.package_name}}/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Installation and deployment
setuptools==26.1.1
twine==1.8.1
setuptools==38.2.5
twine==1.9.1

# Testing
tox==2.9.1

# Documentation
Sphinx==1.6.5
sphinx-docs-theme==0.2.3
Pygments==2.1.3
Pygments==2.2.0
32 changes: 27 additions & 5 deletions {{cookiecutter.package_name}}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

__license__ = 'MIT'

# Source package
_source_package = '{{ cookiecutter.package_name }}'

# Regular expression for the version
_version_re = re.compile(r'__version__\s+=\s+(.*)')

Expand All @@ -32,19 +35,41 @@ def read(*names, **kwargs):
encoding=kwargs.get('encoding', 'utf8')
).read()


# Gets the version for the source folder __init__.py file
with open('{{ cookiecutter.package_name }}/__init__.py', 'rb',
with open(_source_package + '/__init__.py', 'rb',
encoding='utf-8') as f:
version_lib = f.read()
version_lib = _version_re.search(version_lib).group(1)
version_lib = str(ast.literal_eval(version_lib.rstrip()))


class _ToxTester(test_command):
"""
Tox test command.
Calls tox for running the tests.
"""
user_options = [
('test-module=', 'm', "Run 'test_suite' in specified module"),
('test-suite=', 's',
"Run single test, case or suite (e.g. 'module.test_suite')"),
('test-runner=', 'r', "Test runner to use"),
('profile=', 'p', 'Test profile to use')
]

def initialize_options(self):
test_command.initialize_options(self)
self.profile = None

def finalize_options(self):
test_command.finalize_options(self)
self.test_args = []
self.test_suite = True

if self.profile is not None:
# Adds the profile argument
# For example: '-e=py36'
self.test_args.append('-e=' + self.profile)

def run_tests(self):
# import here, cause outside the eggs aren't loaded
Expand Down Expand Up @@ -83,9 +108,6 @@ def run_tests(self):
],
long_description=read('README.rst'),
install_requires=[
'setuptools',
'sphinx_docs_theme',
'twine',
],
tests_require=_tests_require,
extras_require={'test': _tests_require},
Expand Down
1 change: 0 additions & 1 deletion {{cookiecutter.package_name}}/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ changedir =
docs/source
deps =
-r{toxinidir}/requirements.txt
sphinx
commands =
sphinx-build -b linkcheck ./ {envtmpdir}/html
sphinx-build -nW -b html -d {envtmpdir}/doctrees ./ {envtmpdir}/html

0 comments on commit bac2ba4

Please sign in to comment.