Skip to content

Commit

Permalink
Initial commit of cookiecutter-conda-python template
Browse files Browse the repository at this point in the history
  • Loading branch information
mandeep committed May 17, 2017
1 parent b85e610 commit b40b2dd
Show file tree
Hide file tree
Showing 16 changed files with 224 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[report]
omit =
setup.py
tests/*
9 changes: 9 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"full_name": "Full Name",
"email": "Email Address",
"github_username": "github_username",
"repo_name": "repository_name",
"package_name": "{{ cookiecutter.repo_name.lower().replace(' ', '_') }}",
"project_short_description": "Short description",
"version": "0.1.0"
}
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
testpaths = tests/test_template.py
26 changes: 26 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from setuptools import setup

setup(
name='cookiecutter-conda-python',
packages=[],
version='0.1.0',
description='Cookiecutter template for a Python conda package',
author='Continuum Analytics, Inc.',
author_email='conda@continuum.io',
url='https://github.com/conda/cookiecutter-conda-package',
keywords=['cookiecutter', 'template', 'package', 'conda', 'python'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Software Development',
],
)
25 changes: 25 additions & 0 deletions tests/test_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pytest


@pytest.fixture
def context():
"""Test template creation with test parameters."""
return {
"full_name": "test name",
"email": "test@email.com",
"github_username": "test_username",
"repo_name": "test_repo",
"package_name": "test_repo",
"project_short_description": "Test description.",
"version": "0.1.0"
}


def test_template(cookies, context):
"""Test the template for proper creation."""
result = cookies.bake(extra_context=context)

assert result.exit_code == 0
assert result.exception is None
assert result.project.basename == 'test_repo'
assert result.project.isdir()
5 changes: 5 additions & 0 deletions {{cookiecutter.repo_name}}/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[report]
omit =
setup.py
{{ cookiecutter.package_name }}/__main__.py
{{ cookiecutter.package_name }}/tests/*
62 changes: 62 additions & 0 deletions {{cookiecutter.repo_name}}/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# 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/

# pyenv python configuration file
.python-version
30 changes: 30 additions & 0 deletions {{cookiecutter.repo_name}}/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Config file for automatic testing at travis-ci.org

language: python
- "2.7"
- "3.6"
sudo: required
before_install:
- sudo apt-get update
install:
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes
- conda update -q conda
- conda install -n conda-build
- conda install anaconda-client
- conda install pytest-cov
- pip install coveralls
- conda build .
- conda install --use-local {{ cookiecutter.package_name }}
- conda info -a
script:
- pytest -s -v --cov={{ cookiecutter.package_name }}
after_success:
- coveralls
10 changes: 10 additions & 0 deletions {{cookiecutter.repo_name}}/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
===============================
{{ cookiecutter.package_name }}
===============================


.. image:: https://img.shields.io/travis/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}.svg
:target: https://travis-ci.org/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}


{{ cookiecutter.project_short_description }}
16 changes: 16 additions & 0 deletions {{cookiecutter.repo_name}}/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package:
name: {{ cookiecutter.package_name }}
version: {{ cookiecutter.version }}
build:
# If the installation is complex, or different between Unix and Windows, use separate bld.bat and build.sh files instead of this key.
# Add the line "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or "skip: True # [not win]" to limit to Windows.
script: python setup.py install
requirements:
build:
- python
- setuptools
run:
- python
about:
home: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}
summary: {{ cookiecutter.project_short_description }}
26 changes: 26 additions & 0 deletions {{cookiecutter.repo_name}}/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from setuptools import setup

requirements = [
# package requirements go here
]

setup(
name='{{ cookiecutter.repo_name }}',
version='{{ cookiecutter.version }}',
description="{{ cookiecutter.project_short_description }}",
author="{{ cookiecutter.full_name.replace('\"', '\\\"') }}",
author_email='{{ cookiecutter.email }}',
url='https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.repo_name }}',
packages=['{{ cookiecutter.package_name }}', '{{ cookiecutter.package_name }}.tests'],
entry_points={
'console_scripts': [
'{{ cookiecutter.package_name }}={{ cookiecutter.package_name }}.cli:cli'
]
},
install_requires=requirements,
keywords='{{ cookiecutter.repo_name }}',
classifiers=[
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
]
)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from {{ cookiecutter.package_name }} import cli

cli()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def cli():
return "CLI template"
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from {{ cookiecutter.package_name }} import cli

def test_cli_template():
assert cli.cli() == 'CLI template'

0 comments on commit b40b2dd

Please sign in to comment.