Skip to content

21st Week of 2022

Coding

Python

BeautifulSoup

  • New: Introduce BeautifulSoup and how to use it.

    BeautifulSoup is a Python library for pulling data out of HTML and XML files. It works with your favorite parser to provide idiomatic ways of navigating, searching, and modifying the parse tree.

Pytest

  • New: Using fixtures at class level.

    Sometimes test functions do not directly need access to a fixture object. For example, tests may require to operate with an empty directory as the current working directory but otherwise do not care for the concrete directory.

    @pytest.mark.usefixtures("cleandir")
    class TestDirectoryInit:
        ...
    
    Due to the usefixtures marker, the cleandir fixture will be required for the execution of each test method, just as if you specified a cleandir function argument to each of them.

    You can specify multiple fixtures like this:

    @pytest.mark.usefixtures("cleandir", "anotherfixture")
    
  • Correction: Improve the snippet to run some tests in serial instead of parallel.

Python Snippets

HTML

DevOps

Infrastructure Solutions

EKS

  • New: Pod limit per node.

    AWS EKS supports native VPC networking with the Amazon VPC Container Network Interface (CNI) plugin for Kubernetes. Using this plugin allows Kubernetes Pods to have the same IP address inside the pod as they do on the VPC network.

    This is a great feature but it introduces a limitation in the number of Pods per EC2 Node instance. Whenever you deploy a Pod in the EKS worker Node, EKS creates a new IP address from VPC subnet and attach to the instance.

    The formula for defining the maximum number of pods per instance is as follows:

    N * (M-1) + 2
    

    Where:

    • N is the number of Elastic Network Interfaces (ENI) of the instance type.
    • M is the number of IP addresses of a single ENI.

    So, for t3.small, this calculation is 3 * (4-1) + 2 = 11. For a list of all the instance types and their limits see this document

Operating Systems

Linux

Anki