Skip to content

Remove legacy main module shim#66

Merged
dprada merged 1 commit intomainfrom
codex/determine-necessity-of-main.py
Nov 4, 2025
Merged

Remove legacy main module shim#66
dprada merged 1 commit intomainfrom
codex/determine-necessity-of-main.py

Conversation

@dprada
Copy link
Collaborator

@dprada dprada commented Nov 4, 2025

Summary

  • inline the deprecated pyunitwizard.main compatibility layer into the package initializer
  • remove the standalone main.py module now that imports are redirected through pyunitwizard
  • update utilities to import is_quantity from the package exports

Testing

  • pytest

https://chatgpt.com/codex/tasks/task_e_69099912b49083269642cfd9c77cb935

@dprada dprada self-assigned this Nov 4, 2025
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return module


sys.modules.setdefault("pyunitwizard.main", _create_main_compat_module())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Attach compatibility shim to package namespace

The new shim registers a pyunitwizard.main module with sys.modules.setdefault but never binds that module to the pyunitwizard package object. Because the entry already exists in sys.modules, import pyunitwizard.main completes without adding an attribute, so subsequent access still raises AttributeError. This breaks code that previously did import pyunitwizard.main followed by pyunitwizard.main.some_api. After creating the module you need to assign it to globals()["main"] (or otherwise expose it via the package) to retain the pre‑refactor behavior【F:pyunitwizard/init.py†L87-L87】

Useful? React with 👍 / 👎.

@dprada dprada merged commit 52b8942 into main Nov 4, 2025
6 checks passed
@dprada dprada deleted the codex/determine-necessity-of-main.py branch November 4, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant