Skip to content

Latest commit

 

History

History
62 lines (40 loc) · 4.17 KB

instructions.md

File metadata and controls

62 lines (40 loc) · 4.17 KB

Python Package Exercise

A little exercise to create a Python package, build it, test it, distribute it, and use it.

Concept

A package is software that has been built, tested, and distributed in a way that makes it easy for other developers to download, install, and configure to add extra functionality to their own programs. Your job is to create a Python package that brings a little bit of joy and levity to the lives of other developers. The package you create should be lighthearted and not "serious" software. However, you will create it following rigorous software engineering practices.

Inspiration

Some inspirational Python packages, for example:

Requirements

Create a Python package with at least four functions that accept arguments which influence their behavior. The package must be distributed in the PyPI repository and installable via pip.

  • Use pipenv to manage the package dependencies and virtual environments with a Pipfile.
  • Use pytest to write and run tests to validate that your package code behaves as expected. Create as many tests as necessary to thorooughly verify each function's expected behavior - this should be no fewer than three tests per package function.
  • Use build to create the package artifacts.
  • Use twine to upload the package to PyPI.
  • Use GitHub Actions to build your package and run your tests on two different recent versions of Python with every pull request to the main branch of your GitHub repository.

Create an example program that uses all functions of your package and demonstrates its complete functionality.

Developer workflow

All team members must have visibly contributed to the code using their own git & GitHub accounts in order to claim that they contributed to the project.

All code changes must be done in feature branches and not directly in the main branch.

To merge code from a feature branch into the main branch, do the following:

  1. Create a pull request from the feature branch to the main branch.
  2. Ask a fellow developer to review your code.
  3. The reviewer must review the code and run unit tests to verify that the functions behave as expepcted.
  4. If the reviewer has any concerns, discuss then and make any changes agreed upon.
  5. Merge the pull request into the main branch.
  6. Delete the feature branch.
  7. Pull the latest changes from the remote main branch to your local main branch.

Warning: the longer you let code sit in a feature branch, the more likely your team is to end up in merge hell. . Merge feature branches into main often to avoid this fate.

Documentation

Replace the contents of the README.md file with a beautifully-formatted Markdown file including a plain-language description of your project and clear instructions, including exact code examples, for:

  • how a developer who wants to import your project into their own code can do so - include documentation for all functions in your package and a link to an example Python program that uses each of them.
  • how a developer who wants to contribute to your project can set up the virtual environment, install dependencies, and build and test your package for themselves.

Include a badge at the top of the README.md file showing the result of the latest build/test workflow run.

Include the names of all teammates as links to their GitHub profiles in the README.md file.

Include a link to your package's page on the PyPI website.