Implementing Charter
We know that the Charter library's public interface will consist of a number of functions accessed at the package level, for example charter.new_chart()
. However, using the techniques covered in the previous chapter, we know that we don't have to define our library's API in the package initialization file to make these functions available at the package level. Instead, we can define the functions elsewhere, and import them into the __init__.py
file so that they are available for others to use.
Let's start by creating a directory to hold our charter
package. Create a new directory named charter
, and create within it an empty package initialization file, __init__.py
. This gives us the basic framework within which to write our ...
Get Modular Programming with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.