Skip to content

Capture installer invocation context (subcommand) #233

@zsol

Description

@zsol

Motivation

Developers of installers are interested in usage statistics of their command line interfaces to help prioritize improvements to them. It would be helpful to understand:

  • the relative popularity of two interfaces achieving similar things within the same installer, e.g. uv sync vs uv pip install
  • in what contexts a certain command (e.g. pip download or pip wheel) is typically used

Plan

  • Add a new subcommand column of type STRING in the public BigQuery table (I'll need help with this).
  • Extend linehaul.ua.datastructures.Installer with a new subcommand field of type Optional[list[str]] with default value of None. This value would be shlex.join()ed when serializing using a cattrs unstructuring hook.
  • Change uv and pip to start attaching these fields to their user agent strings.

I believe these items can be done in any order.

Notes

Unfortunately Google BigQuery arrays have a weird interaction with NULL values:

When you write a NULL array to a table, it's converted to an empty array.

Because of this, using ARRAY<STRING> as the type of subcommand column would make it impossible to tell if the subcommand value was an empty list or missing. The next best thing is to store the subcommand as a single string, where this is not an issue.
The Installer field's type would still be kept as a list[str] to

  1. make sure the serialization to string is done consistently across installer implementations
  2. have a chance for other linehaul consumers (or a future bigquery update) access to the list-form data without changing all clients

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions