Chapter 15

What are the benefits of packaging code?

Packaging code is a great way to do the following:

  • Make certain code available to use from multiple other packages
  • Share code with colleagues or make it easy to install for yourself
  • Set a project to collaborate on with others
  • Add reliability to your code by constantly running tests
  • Structure code better and isolate it from your day-to-day work

What is the main difference between Conda and pip as package managers?

At this moment, the difference is not as great as it was before. Historically, pip didn't support adding non-Python code as a binary for various reasons. This is a problem for data analysis projects since many data-related packages, namely NumPy, SciPy, and sklearn, use C and even Fortran under the hood.

This is where Conda comes into play—it allows you to install any tool in any language, even one that's totally unrelated to Python. Today, Conda is a well-established package manager and is especially popular among data scientists. 

One additional feature of Conda is that it has multiple channels—from personal channels, to shared, and community-driven channels (conda-forge), to the most conservative, carefully curated Anaconda channel. If needed, you can also pay for a private channel, dedicated to your company.

What is dependency resolution, and why is it difficult?

Dependency resolution is the process of finding the right versions of all the packages that are required to run software. It is difficult and not always achievable because, for an arbitrary package, there are dozens of direct and indirect dependencies. That's why building a package requires a thorough, sufficiently relaxed, and minimal definition of the required packages.

What are the benefits of poetry over the standard setup tools?

First and foremost, poetry supports a new, TOML-based specification for packages. This is fundamentally safer as a client won't be running arbitrary code from the web on installation. Next, poetry generates a dedicated virtual environment for the development process and provides a locked specification of that environment for exact replication. Last but not least, it has a powerful dependency resolver and can analyze the depth and status of your dependencies.

Why do we need tests?

Tests are a critical part of any software development. They allow you to ensure that code is behaving as expected, thus allowing for the safe alteration of existing code. 

What is the purpose of CI?

CI, or continuous integration, is a term that represents an automated pipeline connected to a version control system. CI usually runs tests and security checks on code and returns a status to the version control system so that developers can safely merge commits and move code to production. CI can also generate and store artifacts (binaries, for example) or trigger updates for live servers. CI plays an important role in the continuous process of rolling out new versions of products to clients. It can also save time by running tests on multiple machines in parallel, compared to running them locally on the developer's machine.

..................Content has been hidden....................

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