Skip to content

Possibly Circular Import Error in small_time #272

@josiahls

Description

@josiahls

Describe the bug
pixi run mojo package lightbug_http/ fails.

Getting bizaar cannot be converted from 'SmallTime' to 'SmallTime' and cannot be converted from 'TimeZone' to 'TimeZone'

This is giving "circular import issue" vibes.

I'm happy to work on a PR to untangle this.

To Reproduce

pixi run mojo package lightbug_http/
Included from /home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/__init__.mojo:1:
/home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/small_time.mojo:292:20: error: no matching function in call to 'strptime'
    return strptime(date_str, fmt, time_zone.from_utc(tz_str))
           ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Included from /home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/__init__.mojo:1:
/home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/small_time.mojo:243:4: note: candidate not viable: argument #2 cannot be converted from 'TimeZone' to 'TimeZone'
fn strptime(date_str: String, fmt: String, tzinfo: TimeZone = TimeZone()) raises -> SmallTime:
   ^
Included from /home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/__init__.mojo:1:
/home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/small_time.mojo:270:4: note: candidate not viable: argument #2 cannot be converted from 'TimeZone' to 'String'
fn strptime(date_str: String, fmt: String, tz_str: String) raises -> SmallTime:
   ^
Included from /home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/__init__.mojo:1:
/home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/small_time.mojo:448:32: error: invalid call to 'format': method argument #0 cannot be converted from 'SmallTime' to 'SmallTime'
        return formatter.format(self, fmt)
               ~~~~~~~~~~~~~~~~^~~~~~~~~~~
Included from /home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/__init__.mojo:1:
Included from /home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/small_time.mojo:7:
/home/mojo_user/ash_dynamics/lightbug_http/lightbug_http/external/small_time/formatter.mojo:83:8: note: function declared here
    fn format(self, m: SmallTime, fmt: String) -> String:

Expected behavior
I propose eliminating the circular imports with a combination of Traits and __extension

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

System
------------
       Pixi version: 0.59.0
           Platform: linux-64
   Virtual packages: __unix=0=0
                   : __linux=6.8.0=0
                   : __glibc=2.35=0
                   : __archspec=1=piledriver
          Cache dir: /home/mojo_user/.cache/rattler/cache
       Auth storage: /home/mojo_user/.rattler/credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: /home/mojo_user/.pixi/bin
    Environment dir: /home/mojo_user/.pixi/envs
       Manifest dir: /home/mojo_user/.pixi/manifests/pixi-global.toml

Workspace
------------
               Name: lightbug_http
            Version: 0.25.7
      Manifest file: /home/mojo_user/ash_dynamics/lightbug_http/pixi.toml
       Last updated: 30-11-2025 17:41:49

Environments
------------
        Environment: default
           Features: default
        Solve group: default
           Channels: conda-forge, https://conda.modular.com/max, https://repo.prefix.dev/modular-community
   Dependency count: 2
       Dependencies: mojo, rattler-build
   Target platforms: linux-64, osx-arm64, linux-aarch64
    Prefix location: /home/mojo_user/ash_dynamics/lightbug_http/.pixi/envs/default
              Tasks: publish, build, format

        Environment: unit-tests
           Features: unit-tests, default
        Solve group: default
           Channels: conda-forge, https://conda.modular.com/max, https://repo.prefix.dev/modular-community
   Dependency count: 2
       Dependencies: mojo, rattler-build
   Target platforms: osx-arm64, linux-64, linux-aarch64
    Prefix location: /home/mojo_user/ash_dynamics/lightbug_http/.pixi/envs/unit-tests
              Tasks: publish, build, format, test

        Environment: integration-tests
           Features: integration-tests, default
        Solve group: default
           Channels: conda-forge, https://conda.modular.com/max, https://repo.prefix.dev/modular-community
   Dependency count: 4
       Dependencies: requests, fastapi, mojo, rattler-build
   Target platforms: linux-64, linux-aarch64, osx-arm64
    Prefix location: /home/mojo_user/ash_dynamics/lightbug_http/.pixi/envs/integration-tests
              Tasks: publish, build, format, integration_tests_udp, integration_tests_external, integration_tests_py

        Environment: bench
           Features: bench, default
        Solve group: default
           Channels: conda-forge, https://conda.modular.com/max, https://repo.prefix.dev/modular-community
   Dependency count: 2
       Dependencies: mojo, rattler-build
   Target platforms: osx-arm64, linux-aarch64, linux-64
    Prefix location: /home/mojo_user/ash_dynamics/lightbug_http/.pixi/envs/bench
              Tasks: publish, build, format, bench_server, bench

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions