How to check if one dictionary is a subset of another larger dictionary in python Oct. 11, 2022, 2:05 p.m.

Provided your code already has both dictionaries as variables, it's very concise to check for this inline:

if big | small == big:
  # do something

Here is a solution that also properly recurses into lists and sets contained within the dictionary. You can also use this for lists containing dicts etc...

def is_subset(subset, superset):
    if isinstance(subset, dict):
        return all(key in superset and is_subset(val, superset[key]) for key, val in subset.items())

    if isinstance(subset, list) or isinstance(subset, set):
        return all(any(is_subset(subitem, superitem) for superitem in superset) for subitem in subset)

    # assume that subset is a plain value if none of the above match
    return subset == superset

Ansible module development: getting started Sept. 23, 2019, 12:18 p.m.

A module is a reusable, standalone script that Ansible runs on your behalf, either locally or remotely. Modules interact with your local machine, an API, or a remote system to perform specific tasks like changing a database password or spinning up a cloud instance. Each module can be used by the Ansible API, or by the ansible or ansible-playbook programs. A module provides a defined interface, accepting arguments and returning information to Ansible by printing a JSON string to stdout before exiting. Ansible ships with thousands of modules, and you can easily write your own. If you’re writing a module for local use, you can choose any programming language and follow your own rules. This tutorial illustrates how to get started developing an Ansible module in Python.

tutorial ansible python

Sharing Your Labor of Love: PyPI Quick and Dirty Dec. 22, 2017, 8:33 a.m.

A completely incomplete guide to packaging a Python module and sharing it with the world on PyPI.

tutorial python

Boto 3 Documentation June 21, 2017, 9:22 a.m.

Boto is the Amazon Web Services SDK for Python, which allows Python developers to write software that makes use of Amazon services like S3 and EC2. Boto provides an easy to use, object-oriented API as well as low-level direct service access.

aws programming python

Python strftime reference May 20, 2017, 8:39 p.m.

Python's strftime directives, built automatically from the Python strftime docs.

documentation cheatsheet python

Strategies for reducing memory usage in Django migrations Feb. 25, 2017, 10:48 a.m.

This post is a collection of strategies for reducing memory usage during Django migrations.

django python

Classy CBV: Django Class-Based-View Inspector Sept. 4, 2016, 3:54 p.m.

Detailed descriptions, with full methods and attributes, for each of Django's class-based generic views.

django programming python

Reddit’s uptime (2008–2016) Aug. 30, 2016, 5:28 p.m.

Looking at the number of comments per minute that reddit gets, from 1 in 2008 to more than 2300 comments per minute in 2016.

graphing reddit python

Heroku Django Starter Template Aug. 29, 2016, 9:38 p.m.

Project starter template for Django 1.9 with production-ready configuration for Static Files, Database Settings, Gunicorn, and enhancements to Django's static file serving functionality via WhiteNoise

django programming python heroku

Python Tips and Traps Jan. 20, 2015, 4:59 p.m.

python programming tips

Wordnik Jan. 2, 2015, 3:22 p.m.

python python module programming api