Skip to content

✨🐱✨ smol - minimising imports!! #124

Open

Description

@lovelydinosaur

Can we minimize our imports sufficiently that hip is able to run on micropython?

$ grep "^import" ./src/hip/* -h | sort | uniq
import contextlib   # *snip* (Used in the timeouts. Use an explicit manager instead.)
import contextvars  # *snip* (Used in the timeouts. An explicit style would be `backend.timeout(...)` instead of global contextvar.)
import copy         # *snip* (Used in JSON to ensure immutability. Easy to do this explicitly instead.)
import datetime     # *snip* (User in Server for `Date` header. Replace with `time.gmtime()` and an explicit formatting helper function)
import enum         # *snip* (Used in parsers. Could just use CONSTANTS.)
import io
import ipaddress    # *snip* (Used in URL parsing. This validation could be optional, or removed.)
import json
import logging      # *snip* (We could shim this.)
import os
import re
import time
import types        # *snip* (Annotations only.)
import typing       # *snip* (Annotations only.)
import zlib

Async support is a pre-cursor for this working all the way through.

Perhaps having the import contraints of micropython would be worthwhile?

Activity

  1. changed the title [-]MicorPython[/-] [+]MicroPython[/+] on Oct 30, 2026
  2. changed the title [-]MicroPython[/-] [+]MicroPython support[/+] on Oct 30, 2026
  3. changed the title [-]MicroPython support[/-] [+]Minimising imports[/+] on Oct 30, 2026
  4. changed the title [-]Minimising imports[/-] [+]so smol!!... minimising imports[/+] on Oct 30, 2026
  5. changed the title [-]so smol!!... minimising imports[/-] [+]✨🐱✨ smol - minimising imports[/+] on Oct 30, 2026
  6. changed the title [-]✨🐱✨ smol - minimising imports[/-] [+]✨🐱✨ smol - minimising imports!![/+] on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sprint candidateCould make for a good code sprint task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions