Speaker

Thea Flowers

Material

Note

  • goal
    • reduce toil (redundant boring stuff)
  • tools
    • tox
      • for automating python package testing
    • nox
      • flexible test automation
      • the configuration file is python noxfile.py
    • invoke
      • task execution tool
      • a tool framework
  • invoke example
from invoke import task


@task
def authors(ctx):
    """Print all the authors in this project"""

    result = ctx.run(
        "git log --pretty=format:\"%an <%ae>\"",
        encoding="utf-8",
        hide=True
    )

    authors = set(result.stdout.splitlines())
    authors = sorted(authors)

    for author in authors:
        print(author)


@task
def changelog(ctx, since):
    """Print the changelog since given git ref"""
    result = ctx.run(
        f"git log {since}..HEAD --format=%s",
        encoding="utf-8",
        hide=True
    )
    changes = result.stdout.splitlines()

    print(f"Changelog sine {since}:")
    for change in changes:
        print(f"- {change}")

Share on: TwitterFacebookEmail


Published

Category

PyCon US 2019

Tags

Contact