Skip to main content

actionsheets

Actionsheets is an open-source (hobby) project with a different take on cheatsheets. Standard cheatsheets are great for getting started, but don't get into the details for advanced or complex use cases. This is where actionsheets come in.

This Python package provides a large collection of code snippets, and can render them in the form of actionsheets. Actionsheets are grouped look-up tables by action/intended outcome, and a code snippet to achieve it. The package is intended for (new) developers to quickly look-up how to perform common actions for the given topic, but also contains some more advanced actions.

The package can print actionsheets in the console with coloring and syntax highlighting, but ideally, the package is used by other (better) front-end implementations. See the streamlit dashboard implementation, for example.

How do actionsheets differ from cheatsheets?

  • Actionsheets are expressed in terms of a desired action or result, and the code snippet(s) to achieve it.
    • This is a more natural way to look up code snippets. Especially useful for beginners.
  • Actions may be complex or comprise multiple steps.
    • Actions are not limited to the direct functionality provided by the package API.
    • Cheatsheets typically lack more advanced compound use cases.
  • Code snippets are data; enabling dynamic generation of sheets depending on user queries
    • Sheets can therefore be more feature-complete, as they do not need fit on a single page.

This way of organizing sheets is especially useful for packages or functions with powerful versatile functionality, where merely listing the API does not cover the full capabilities.

Install

To install the latest release:

pip install actionsheets

To install according to the latest commit:

pip install git+https://github.com/niekdt/actionsheets.git
poetry add git+https://github.com/niekdt/actionsheets.git

Contributing

Actionsheets are defined using TOML files. This makes it very easy to define a hierarchy of code snippets in a readable way.

Defining a code snippet belonging to the Create section of the respective actionsheet file is as simple as:

[create.list]
action = "Define a list"
code = "x = ['apple', 'pear', 'banana']"
details = "You can define as many items as you like"

For submitting code snippets or complete actionsheets, submit a PR to actionsheets on Github.

Actionsheet structure

Sheets are hierarchically structured using sections. The main sections are:

  1. Create
    How to define, instantiate or create the data type, possibly from other types.
    Examples: define a date, parse date from string, create set from a list of values.
  2. Test
    Check or assess something about the object.
    Examples: is it empty? does it contain a given value?
  3. Extract Get properties, attributes, or other information about the object of a different type than the object (typically scalars).
    Examples: length of a list, element value at a given index, max value among elements.
  4. Derive / Update Create a derived or altered object from the given object, preserving the object type, or update the object in-place / by-reference.
    Examples: head of a list, slicing a string, selecting conditional rows from a data frame.
  5. Convert Export / represent the object as a different data type.
    Examples: datetime as string, dictionary as list of key-value pairs, data frame as matrix.

Extract

Get properties, attributes, or other information about the object of a different type than the object (typically scalars).

Subcategory Description Examples
Properties Retrieve properties or attributes of the object. Length of a list, number of columns of a data frame.
Find Attempt to find a value or index of an object, typically with index output. Find max value, find index of min value, find key of most frequent value.
Aggregate Aggregate the object in a way that involves a computation, typically with scalar output. Sum all elements of a list, number of occurrences per value

Derive / update

Subcategory Description Examples
Transform Apply a transformation to the object or each of its elements, preserving the shape of the object. Element-wise operations such as adding a constant to a vector, or computing the cumulative sum over the elements
Order Change the order of elements, but not their values. Reversing the elements of a list, sorting a data frame by column values
Reshape Change the shape of the object, but preserves all elements. Transposing a matrix, converting a data frame to narrow format.
Grow Possibly increase the number of elements of the object. Appending elements to a list, replicating elements.
Shrink Possibly reduce the number of elements of the object. Removing elements from a list, removing duplicates.
Combine Combine, merge or join two or more objects. Stacking lists, set union, joining two data frames.

Motivation

My motivation for building this curated database of code snippet is out of frustration of the worsening state of the internet in quickly finding short answers to straightforward queries.

  • Many website have the code snippet(s) buried between tons of irrelevant text just for SEO optimization.
  • The quality of (accepted) answers on Stackoverflow is severely lacking for some programming languages:
    • Answers are out of date
    • Answers are overly complicated, inefficient, or nonfunctional (contributions by beginners)
    • For the future, this also means that the answers by any LLM are going to have the same issues.
  • The answer on the site was for a different question
  • The answer on the site was for a more narrow question
  • With the increasing usage of LLMs, the problem of bloated low-quality answer results will only get worse.

Metadata

Release files for actionsheets 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for actionsheets 0.3.0
File Size Uploaded
actionsheets-0.3.0.tar.gz 78.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for actionsheets 0.3.0
File Interpreter ABI Platform
actionsheets-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 179.1 kB

Release files / actionsheets-0.3.0.tar.gz

Download URL actionsheets-0.3.0.tar.gz
Size 78.9 kB
Tags Source
SHA-256 checksum
How to use checksums
86b4ef714d71e6a2745da5e82d9e81828363eca58677e5f0ff6abf23bba5b8a5
BLAKE2b-256 checksum
How to use checksums
d1188954e80b41f72e969adaee1401828425ccf1415587166f68fcc0be34e534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure

Release files / actionsheets-0.3.0-py3-none-any.whl

Download URL actionsheets-0.3.0-py3-none-any.whl
Size 100.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f2582fc33f5bdd6c3f6c083733d667fff56be57b195ff26a0a82303aa81002a
BLAKE2b-256 checksum
How to use checksums
6527372ad46ce69eb252019f2a8582fdc0e750dac30e8189a62fd05b68ccc52e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.11

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page