Due: Thursday, 16 November
This assignment was assigned without much time for you to work on it, so it is short. Hopefully you can complete most of it in class on Tuesday.
In this assignment, you will create a python package to help with some common geoscience unit conversions. This is a silly exercise, because there are already some great packages out there which can do this better and more comprehensively than we can hope to do in an hour or two. However, the point is to keep the coding simple and focus on organization, packaging, and testing.
Do the following:
- Create a new folder with the proper directory structure for a python package
called
unitconvert
. Initialize this directory as a new git repository. - In the package directory, create two modules:
- A module called
temperature
which implements two functions:fahrenheit_to_celsius
andcelsius_to_fahrenheit
. - A module called
distance
which implements two functions:miles_to_kilometers
andkilometers_to_miles
. - Don't forget
__init__.py
- A module called
- Make sure your modules all have complete and properly-formatted doc-strings.
- Write a test suite which checks each function in your package and run it
using
pytest
- Write a
setup.py
script which makes your package installable. - Push your project to a public github repository
Optional but highly recommended (required for a score of 3):
- Enable travis-ci integration on your github repo
- Add a
.travis.yml
file for your project and push it to your github repo. - Verify that travis-ci executed the test suite properly and add a shiny travis-ci badge to your readme file.
Turn in the assignment by emailing a link to your public repo to the TA and instructors.