Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert entry_points to dotted notation #82

Merged
merged 2 commits into from
Nov 28, 2023
Merged

Convert entry_points to dotted notation #82

merged 2 commits into from
Nov 28, 2023

Conversation

MHendricks
Copy link
Member

Convert the entry point's _ separator to . to be inline with the group spec of https://packaging.python.org/en/latest/specifications/entry-points/#data-model. The hab-gui pull request is part of this change.

I don't like making this kind of re-factor of a released feature but I think we should be using the same naming convention for entry_point groups in case we ever wanted to use the same group names for traditional entry_points.

Checklist

  • I have read the CONTRIBUTING.md document
  • I formatted my changes with black
  • I linted my changes with flake8
  • I have added documentation regarding my changes where necessary
  • Any pre-existing tests continue to pass
  • Additional tests were made covering my changes

Types of Changes

  • Bugfix (change that fixes an issue)
  • New Feature (change that adds functionality)
  • Documentation Update (if none of the other choices apply)

Proposed Changes

@MHendricks
Copy link
Member Author

If you are using the existing entry_point group names you can support migration by adding the old and new groups. Once you update all hosts to the new hab version you can drop the old names.

@MHendricks
Copy link
Member Author

This affects the following entry_points:

  • cli -> hab.cli
  • launch_cls - > hab.launch_cls

Example for migrating a site json file.

{
    "append": {
        "entry_points": {
 +            "hab.cli": {
+                 "gui": "hab_gui.cli:gui"
+             },
+             // TODO: Once hab>=0.29.0 is fully released, we can drop the "cli" duplicate
            "cli": {
                "gui": "hab_gui.cli:gui"
            }
        }
    }
}

Example for migrating a launch_cls call on an alias in a .hab.json file.

{
    "name": "houdini19.5",
    "aliases": {
        "windows": [
            [
                "houdinicore", {
                    "cmd": "C:\\Program Files\\Side Effects Software\\Houdini 19.5.716\\bin\\houdinicore.exe",
+                     // when launching houdini's gui. Just use the standard class
+                     "hab.launch_cls": {"subprocess": "subprocess:Popen"},
+                     // TODO: Remove "launch_cls" keys once hab>=0.29.0 is released everywhere
                    "launch_cls": {"subprocess": "subprocess:Popen"}
                }
            ]
        ]
    }
}

Once hab has been updated on all hosts, you can safely remove the legacy entry_points without the package prefix.

@MHendricks MHendricks merged commit 298b74c into main Nov 28, 2023
29 checks passed
@MHendricks MHendricks deleted the mikeh/dotted_ep branch November 28, 2023 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant