-
Notifications
You must be signed in to change notification settings - Fork 339
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
Register plugin from entry points #1872
Open
Ni-g-3l
wants to merge
18
commits into
AcademySoftwareFoundation:main
Choose a base branch
from
Ni-g-3l:feat/register_plugin_from_entry_points
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
91b3a3c
Add test data to load plugins from entry points
Ni-g-3l f8a8f49
Load REZ plugins from setuptools entry points
Ni-g-3l da9e66c
Fix flake8 report
Ni-g-3l 7fbed7c
Fix import of importlib metadata in python 3.8, 3.9
Ni-g-3l e776bb9
Signed-off-by: Nig3l <[email protected]>
Ni-g-3l 55ed2ce
Remove dupplicated plugin definition
Ni-g-3l ee6f9bf
Install test plugin to test data to speed up test
Ni-g-3l e6a3256
Add try except on load plugin from entry points
Ni-g-3l e30e7cd
Update plugin install doc
Ni-g-3l 0742acf
use modern build backend, use dist-info, fix tests and simplify file …
JeanChristopheMorinPerso 4e6a47a
Update src/rez/tests/util.py
JeanChristopheMorinPerso 25c020a
Remove vendored code for safety reason.
JeanChristopheMorinPerso 9579331
Re-add importlib-metadata (this time with the right version to suppor…
JeanChristopheMorinPerso ac70f9a
Make it compatible with python 3.8 and 3.9
JeanChristopheMorinPerso ffbe7f6
Fix python compat again...
JeanChristopheMorinPerso ab8e162
Last fix for real
JeanChristopheMorinPerso a7fa195
Fix flake8
JeanChristopheMorinPerso cab8f04
Add new plugin install methods
Ni-g-3l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/rez/data/tests/extensions/baz/baz-0.1.0.dist-info/METADATA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Metadata-Version: 2.4 | ||
Name: baz | ||
Version: 0.1.0 |
2 changes: 2 additions & 0 deletions
2
src/rez/data/tests/extensions/baz/baz-0.1.0.dist-info/entry_points.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[rez.plugins] | ||
baz_cmd = baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
baz plugin | ||
""" | ||
|
||
from rez.command import Command | ||
|
||
# This attribute is optional, default behavior will be applied if not present. | ||
command_behavior = { | ||
"hidden": False, # (bool): default False | ||
"arg_mode": None, # (str): "passthrough", "grouped", default None | ||
} | ||
|
||
|
||
def setup_parser(parser, completions=False): | ||
parser.add_argument( | ||
"-m", "--message", action="store_true", help="Print message from world." | ||
) | ||
|
||
|
||
def command(opts, parser=None, extra_arg_groups=None): | ||
from baz import core | ||
|
||
if opts.message: | ||
msg = core.get_message_from_baz() | ||
print(msg) | ||
return | ||
|
||
print("Please use '-h' flag to see what you can do to this world !") | ||
|
||
|
||
class BazCommand(Command): | ||
@classmethod | ||
def name(cls): | ||
return "baz" | ||
|
||
|
||
def register_plugin(): | ||
return BazCommand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def get_message_from_baz(): | ||
from rez.config import config | ||
message = config.plugins.command.baz.message | ||
return message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
baz = { | ||
"message": "welcome to this world." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "baz" | ||
version = "0.1.0" | ||
|
||
[project.entry-points."rez.plugins"] | ||
JeanChristopheMorinPerso marked this conversation as resolved.
Show resolved
Hide resolved
|
||
baz_cmd = "baz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer this format of build system, we should update plugins doc by replacing setup.py part by a pyproject.toml.