An open API service indexing awesome lists of open source software.

https://github.com/conda/cookiecutter-conda-python

A cookiecutter template for conda packages using Python
https://github.com/conda/cookiecutter-conda-python

Last synced: 9 months ago
JSON representation

A cookiecutter template for conda packages using Python

Awesome Lists containing this project

README

          

# cookiecutter-conda-python
A [cookiecutter](https://www.github.com/audreyr/cookiecutter "cookiecutter") template for
conda packages using Python

## Features

- Modern build system using [pyproject.toml](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/) and [hatchling](https://pypi.org/project/hatchling/) build backend
- Automatic versioning with [hatch-vcs](https://pypi.org/project/hatch-vcs/) (requires git annotated tags before it'll work)
- Ready-made conda recipe found in conda.recipe/meta.yaml
- It reads the pyproject.toml file for almost all metadata. You will likely not need to modify it
- You will need to set the `VERSION` env var to the output of `hatch version` to build the package
- [pre-commit](https://pre-commit.com/) config for automatic linting with every git commit
- Pre-configured for Appveyor, Travis CI and Circle CI (you need to activate each of these individually)
- Coverage report hosted on Codecov.io (activated after first successful CI run, which uploads results)
- Code analysis with codacy, setup to exclude version file and tests (requires activation of project at Codacy)

## Installation

Prior to installing cookiecutter-conda-python, the cookiecutter package must be installed in your environment. This is achieved via the following command::

conda install cookiecutter

With cookiecutter installed, the cookiecutter-conda-python template can be installed with::

cookiecutter https://github.com/conda/cookiecutter-conda-python.git

Once cookiecutter clones the template, you will be asked a series of questions related to your project::

[1/9] full_name (Full Name): (required)
[2/9] email (Email Address): (required)
[3/9] github_username (Destination github org or username): (required)
[4/9] repo_name (repository-name): (required)
[5/9] package_name (test_pkg): (optional, autogenerated from repository-name)
[6/9] project_short_description (Short description): (optional)
[7/9] noarch_python (y): (optional, default yes)
[8/9] include_cli (y): (optional, default yes)
[9/9] Select open_source_license
1 - MIT
2 - BSD
3 - ISC
4 - Apache
5 - GNUv3
6 - Proprietary
Choose from [1/2/3/4/5/6] (1): (optional, default 1)

## Usage

After answering the questions asked during installation, a conda Python package will be
created in your current working directory. This package will contain a simple CLI script
and the conda recipe necessary to build the application into a conda package.

You will need to have conda-build, hatch, hatchling, and hatch-vcs to build::

conda install conda-build hatch hatchling hatch-vcs

To build the conda package, be sure to set `VERSION`

VERSION=`hatch version` conda build conda.recipe/

You'll still need to activate the web services you want to use - they won't be active automatically.

- __Appveyor__: https://www.appveyor.com/docs/
- __Circle CI__: https://circleci.com/docs/2.0/#setting-up-your-build-on-circleci
- __Travis CI__: https://docs.travis-ci.com/user/getting-started/#To-get-started-with-Travis-CI
- __Codecov__: No configuration necessary - project will be created when first successful CI run completes and uploads coverage results
- __Codacy__: https://support.codacy.com/hc/en-us/articles/207278449-Getting-started-with-Codacy