Packaging and Testing with Poetry and PyTest

Until now, all our code has lived in either notebooks or Python files. While that is totally fine, with the growth in volume and complexity of our code, it is increasingly becoming a good idea to form one or more go-to sources for the code we use most frequently, as well as sources for the complex code that we don't want to risk adding mistakes to. 

In this chapter, we will learn how to build our own packages for use in multiple projects or to be easily shared with others, using the poetry package. A package can work as a deliverable—something you can pass to or share with your client! Building and testing packages is a vital skill that increases your productivity and allows you to save time and reduce stress by enabling you to reuse the same properly tested body of code again and again.

Building packages also likely to improve your overall coding skills, as packages require code to be abstract and flexible and allow you to spend time on efficient implementation.

The following topics will be covered in this chapter:

  • The benefits of having a custom package
  • A few ways to develop a package
  • Defining dependencies and resources with Poetry
  • Workflow with the editable package installation
  • Testing your code with PyTest
  • Documentation with sphinx
  • Testing with CI
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.238.159