Skip to content

A silly package for converting to and from Roman numerals. Made for tutorial on how to make packages.

Notifications You must be signed in to change notification settings

kiwidamien/Roman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roman!

Since Python was named after the Monte Python comedy troupe, it seems fitting to open the Roman package with a question:

... but apart from better sanitation and medicine and education and irrigation and public health and roads and a freshwater system and baths and public order... what have the Romans done for us?

-- The Life Of Brian, Monty Python

The answer: Roman Numerals!

Purpose

This is a "hello world" example of how to create a Python package. It does so by going through the process of creating a package (roman) that

  • converting between roman numeral strings and integers
  • converting between temperatures

This guide has been broken into several tags, so that the process can be followed. You can access different tag, clone this repo and use

git checkout tags/<tag name>

Tags available

A series of blog posts walks through the process of creating a package from start to finish. The tags made available are

  1. v0.1: the idea We write the Roman numerals function, write a short module, and can import it from one directory.
  2. v0.2: documentation We write the docstrings of the function, and show best practices.
  3. v0.3: make a package
    We write setup.py, and show how to install on our own system. We can also show how to install from github.
  4. v0.4: writing tests We write some unit tests, and introduce the tox package to allow easy testing.
  5. v0.5: deploying We use (twine)[https://pypi.org/project/twine/] to post onto TestPyPI.

Installation

To install from tag v0.3 onward, use

# installation is easy!
$ python setup.py install

To uninstall (e.g. when updating) you can use pip, even if you are only working locally

# so is uninstalling!
$ pip uninstall roman

Usage

Once installed, we can use this module with

>>> import roman
>>> roman.int_to_roman_string(4)
'IV'
>>> roman.roman_string_to_int('MMC')
2100
>>> roman.convert_all(0, 'C')
{'K': 273.15, 'F': 32, 'C': 0}

Useful references

About

A silly package for converting to and from Roman numerals. Made for tutorial on how to make packages.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages