Skip to content
Snippets Groups Projects
Commit b7fb64c9 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Moved the cookiecutter to its own Gitlab project.

The template is in https://gitlab.idiap.ch:bob/new-project
parent 35e353fd
No related branches found
No related tags found
1 merge request!311Cookiecutter for new bob projects
Pipeline #64182 failed
Showing
with 0 additions and 1178 deletions
# Cookiecutter template for Bob packages
Please use bob.devtools' `bdt new` command.
This is a template using [cookiecutter](https://github.com/cookiecutter/cookiecutter)
to create new [bob](https://www.idiap.ch/software/bob) packages.
## Create a new project via bob.devtools
Install bob.devtools in your conda environment (or use the one you already have):
```bash
mamba install bob.devtools
```
Then, to create a new package, run:
```bash
bdt new bob/package_name name email
```
(Use `bdt new --help` for more info)
## Manually create a new project (not recommended)
Ensure you have a working cookiecutter installation:
```bash
cookiecutter --help
```
Then, run:
```bash
cookiecutter bob/devtools/cookiecutter
```
{
"author_name": "",
"author_email": "{{ cookiecutter.author_name.lower().replace(' ','.') }}@idiap.ch",
"group": "bob",
"project_name": "bob.newproject",
"project_short_description": "",
"license": ["GNU General Public License v3 (GPLv3)", "BSD 3-Clause"]
}
#!/usr/bin/env python
"""Cookiecutter hook executed after the project is generated.
1. Removes the unused license file from the project.
"""
REMOVE_PATHS = [
"{% if cookiecutter.license != 'GNU General Public License v3 (GPLv3)'%} COPYING {% endif %}",
"{% if cookiecutter.license != 'BSD 3-Clause'%} LICENSE {% endif %}",
]
import os
for path in REMOVE_PATHS:
path = path.strip()
if path and os.path.exists(path):
if os.path.isdir(path):
os.rmdir(path)
else:
os.unlink(path)
[flake8]
max-line-length = 80
ignore = E501,W503,E302,E402,E203
*~
*.swp
*.pyc
bin
eggs
parts
.installed.cfg
.mr.developer.cfg
*.egg-info
src
develop-eggs
sphinx
dist
.nfs*
.gdb_history
build
.coverage
record.txt
miniconda.sh
miniconda/
include: 'https://gitlab.idiap.ch/bob/bob.devtools/raw/master/bob/devtools/data/gitlab-ci/single-package.yaml'
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
hooks:
- id: isort
args: [--settings-path, "pyproject.toml"]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- id: check-added-large-files
- id: check-yaml
exclude: .*/meta.yaml
This diff is collapsed.
Copyright (c) {% now 'utc', '%Y' %} Idiap Research Institute, http://www.idiap.ch/
Written by {{ cookiecutter.author_name }} <{{ cookiecutter.author_email }}>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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.
3. Neither the name of the copyright holder 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.
include README.rst {% if cookiecutter.license == "GNU General Public License v3 (GPLv3)" %}COPYING {% endif %}version.txt requirements.txt
recursive-include doc *.rst *.png *.ico *.txt
[![doc stable](https://img.shields.io/badge/docs-stable-yellow.svg)](https://www.idiap.ch/software/bob/docs/{{ cookiecutter.group }}/{{ cookiecutter.project_name }}/stable/index.html)
[![doc latest](https://img.shields.io/badge/docs-latest-orange.svg)](https://www.idiap.ch/software/bob/docs/{{ cookiecutter.group }}/{{ cookiecutter.project_name }}/master/index.html)
[![pipeline](https://gitlab.idiap.ch/{{ cookiecutter.group }}/{{ cookiecutter.project_name }}/badges/master/pipeline.svg)](https://gitlab.idiap.ch/{{ cookiecutter.group }}/{{ cookiecutter.project_name }}/commits/master)
[![coverage](https://gitlab.idiap.ch/{{ cookiecutter.group }}/{{ cookiecutter.project_name }}/badges/master/coverage.svg)](https://www.idiap.ch/software/bob/docs/{{ cookiecutter.group }}/{{ cookiecutter.project_name }}/master/coverage/index.html)
[![gitlab](https://img.shields.io/badge/gitlab-project-0000c0.svg)](https://gitlab.idiap.ch/{{ cookiecutter.group }}/{{ cookiecutter.project_name }})
[![pypi](https://img.shields.io/pypi/v/{{ cookiecutter.project_name }}.svg)](https://pypi.python.org/pypi/{{ cookiecutter.project_name }})
# {{ cookiecutter.project_short_description }}
This package is part of {% if cookiecutter.group == "bob" %}the signal-processing and machine learning toolbox [Bob](https://www.idiap.ch/software/bob){% else %}[BEAT](https://www.idiap.ch/software/beat), an open-source evaluation platform for data science algorithms and workflows{% endif %}.
**INSERT A DESCRIPTION OF YOUR PROJECT HERE**
## Installation
Complete [{{ cookiecutter.group }}'s `installation`](https://www.idiap.ch/software/{{ cookiecutter.group }}/install) instructions.
Then, to install this package, run:
$ conda install {{ cookiecutter.project_name }}
## Contact
For questions or reporting issues to this software package, contact our
development [discussion channel](https://www.idiap.ch/software/{{ cookiecutter.group }}/discuss).
{% raw %}{% set name = '{% endraw %}{{ cookiecutter.project_name }}{% raw %}' %}
{% set project_dir = environ.get('RECIPE_DIR') + '/..' %}
package:
name: {{ name }}
version: {{ environ.get('BOB_PACKAGE_VERSION', '0.0.1') }}
build:
number: {{ environ.get('BOB_BUILD_NUMBER', 0) }}
run_exports:
- {{ pin_subpackage(name) }}
script:
- cd {{ project_dir }}
{% if environ.get('BUILD_EGG') %}
- "{{ PYTHON }} setup.py sdist --formats=zip"
{% endif %}
- "{{ PYTHON }} -m pip install . -vv"
# installs the documentation source, readme to share/doc so it is available
# during test time
- install -d "${PREFIX}/share/doc/{{ name }}"
- cp -R README.rst requirements.txt doc "${PREFIX}/share/doc/{{ name }}/"
requirements:
# place your build dependencies before the 'host' section
host:
- python {{ python }}
- setuptools {{ setuptools }}
- pip {{ pip }}
- bob.extension
# place your other host dependencies here (same as requirements.txt)
# use the format:
# - numpy {{ numpy }}
# Also place your optional dependencies here, like:
# - matplotlib {{ matplotlib }}
run:
- python
- setuptools
# place other runtime dependencies here (same as requirements.txt)
# Use the format:
# - {{ pin_compatible('numpy') }}
# List your optional dependencies here, like:
# run_constrained:
# - {{ pin_compatible('matplotlib') }}
test:
imports:
- {{ name }}
commands:
# runs tests for package only, report only what is in the package
# creates html and xml reports and place them in specific directories
- pytest --verbose --cov {{ name }} --cov-report term-missing --cov-report html:{{ project_dir }}/sphinx/coverage --cov-report xml:{{ project_dir }}/coverage.xml --pyargs {{ name }}
- sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx
- sphinx-build -aEb doctest {{ project_dir }}/doc sphinx
- conda inspect linkages -p $PREFIX {{ name }} # [not win]
- conda inspect objects -p $PREFIX {{ name }} # [osx]
requires:
- pytest {{ pytest }}
- pytest-cov {{ pytest_cov }}
- coverage {{ coverage }}
- sphinx {{ sphinx }}
- sphinx_rtd_theme {{ sphinx_rtd_theme }}
# extend this list with further test-time-only dependencies
{% endraw %}
about:
summary: {{ cookiecutter.project_short_description }}
home: https://www.idiap.ch/software/{{ cookiecutter.group }}/
license: {{ cookiecutter.license }}
license_family: {% if cookiecutter.license == 'GNU General Public License v3 (GPLv3)' %}GPL{% else %}BSD{% endif %}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import pkg_resources
import sphinx_rtd_theme
# For inter-documentation mapping:
from bob.extension.utils import link_documentation, load_requirements
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = "1.3"
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.graphviz",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
# 'matplotlib.sphinxext.plot_directive',
]
# Be picky about warnings
nitpicky = True
# Ignores stuff we can't easily resolve on other project's sphinx manuals
nitpick_ignore = []
# Allows the user to override warnings from a separate file
if os.path.exists("nitpick-exceptions.txt"):
for line in open("nitpick-exceptions.txt"):
if line.strip() == "" or line.startswith("#"):
continue
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore.append((dtype, target))
# Always includes todos
todo_include_todos = True
# Generates auto-summary automatically
autosummary_generate = True
# Create numbers on figures with captions
numfig = True
# If we are on OSX, the 'dvipng' path maybe different
dvipng_osx = "/Library/TeX/texbin/dvipng"
if os.path.exists(dvipng_osx):
pngmath_dvipng = dvipng_osx
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix of source filenames.
source_suffix = ".rst"
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "{{ cookiecutter.project_name }}"
copyright = "%s, Idiap Research Institute" % time.strftime("%Y")
# Grab the setup entry
distribution = pkg_resources.require(project)[0]
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = distribution.version
# The full version, including alpha/beta/rc tags.
release = distribution.version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["links.rst"]
# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# Some variables which are useful for generated material
project_variable = project.replace(".", "_")
short_description = "{{ cookiecutter.project_short_description }}"
owner = ["Idiap Research Institute"]
# -- Options for HTML output ---------------------------------------------------
html_theme = "sphinx_rtd_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = project_variable
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = "img/{{ cookiecutter.group }}-logo.png"
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
html_favicon = "img/{{ cookiecutter.group }}-favicon.ico"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = project_variable + "_doc"
# -- Post configuration --------------------------------------------------------
# Included after all input documents
rst_epilog = """
.. |project| replace:: Bob
.. |version| replace:: %s
.. |current-year| date:: %%Y
""" % (
version,
)
# Default processing flags for sphinx
autoclass_content = "class"
autodoc_member_order = "bysource"
autodoc_default_options = {
"members": True,
"undoc-members": True,
"show-inheritance": True,
}
sphinx_requirements = "extra-intersphinx.txt"
if os.path.exists(sphinx_requirements):
intersphinx_mapping = link_documentation(
additional_packages=["python", "numpy"]
+ load_requirements(sphinx_requirements)
)
else:
intersphinx_mapping = link_documentation()
bob/devtools/cookiecutter/{{cookiecutter.project_name}}/doc/img/beat-128x128.png

24.5 KiB

bob/devtools/cookiecutter/{{cookiecutter.project_name}}/doc/img/beat-favicon.ico

26.8 KiB

bob/devtools/cookiecutter/{{cookiecutter.project_name}}/doc/img/beat-logo.png

13.1 KiB

bob/devtools/cookiecutter/{{cookiecutter.project_name}}/doc/img/bob-128x128.png

6.39 KiB

bob/devtools/cookiecutter/{{cookiecutter.project_name}}/doc/img/bob-favicon.ico

4.19 KiB

bob/devtools/cookiecutter/{{cookiecutter.project_name}}/doc/img/bob-logo.png

6.12 KiB

.. -*- coding: utf-8 -*-
.. _{{ cookiecutter.project_name }}:
{{ "="*(cookiecutter.project_short_description|length + 2) }}
{{ cookiecutter.project_short_description }}
{{ "="*(cookiecutter.project_short_description|length + 2) }}
.. todo ::
Write here a small (1 paragraph) introduction explaining this project. See
other projects for examples.
Users Guide
===========
.. toctree::
:maxdepth: 2
api
.. todolist::
.. include:: links.rst
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment