Overview

A minimum project template for morden python development.

Usage

Prerequisite

Please install cookiecutter, pyenv and direnv.

Initialize the project

  1. Execute the following command to Initialize your project from the template:

    cookiecutter https://github.com/huntzhan/morden-python-project-template.git
  2. Activate the helper snippets:

    cd <project>
    direnv allow
  3. Execute the following command will setup virtualenv, install deps and optionally push to git remote repository for you:

    pyproject-init
    
    # Parameters:
    # -r: Optional. The git remote url. If provided, will initialize git and push to remote.
    # -c: Optional. Path to the pip cache folder.
    #     If provided, will explicitly download the required distributions to
    #     and install distributions from such folder.
    # -p: Optional. Python version. Default to '3.8.7'.
    # -t: Optional. Setup extra tag. Default to 'dev'.

Update dependencies

Execute the following command to install or upgrade your dependencies. The default behavior is equivalent to pip install -e .'[dev]'.

pyproject-install-deps

# Parameters:
# -c: Optional. Path to the pip cache folder.
#     If provided, will explicitly download the required distributions to
#     and install distributions from such folder.
# -t: Optional. Setup extra tag. Default to 'dev'.

Make a release

The following command will change the version in setup.cfg, then commit automatically, and finally push to the default remote as well as creating a new tag in remote for you. Make sure all the changes have been committed.

pyproject-bump-version <mode>

# Parameters:
# mode: Required. Should be one of the ['major', 'minor', 'patch']

Others

  1. Code formatting:

    yapf -i -r <package_name>
  2. Code linting:

    flake8
  3. Execute static analyzer:

    pytype
  4. Build a distribution:

    python setup.py clean --all
    python -m build --wheel

References