-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(ingest): fix metadata for custom python packages #9391
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,8 @@ def generate( | |
""" | ||
) | ||
|
||
(src_path / "py.typed").write_text("") | ||
|
||
(package_path / "setup.py").write_text( | ||
f"""{autogen_header} | ||
from setuptools import setup | ||
|
@@ -87,6 +89,11 @@ def generate( | |
"avro-gen3=={_avrogen_version}", | ||
"acryl-datahub", | ||
], | ||
package_data={{ | ||
"{python_package_name}": ["py.typed"], | ||
"{python_package_name}.models": ["schema.avsc"], | ||
"{python_package_name}.models.schemas": ["*.avsc"], | ||
}}, | ||
Comment on lines
+92
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. by default it only packages .py files, so this tells it to also include the raw schema files in the .whl and .tar.gz files |
||
entry_points={{ | ||
"datahub.custom_packages": [ | ||
"models={python_package_name}.models.schema_classes", | ||
|
Empty file.
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,36 @@ | ||
from typing import ClassVar | ||
|
||
from avrogen.dict_wrapper import DictWrapper | ||
|
||
|
||
class _Aspect(DictWrapper): | ||
"""Base class for all aspects types. | ||
|
||
All codegened types inherit from DictWrapper, either directly or indirectly. | ||
Types that are aspects inherit directly from _Aspect. | ||
""" | ||
|
||
ASPECT_NAME: ClassVar[str] = None # type: ignore | ||
ASPECT_TYPE: ClassVar[str] = "default" | ||
ASPECT_INFO: ClassVar[dict] = None # type: ignore | ||
|
||
def __init__(self): | ||
if type(self) is _Aspect: | ||
# Ensure that it cannot be instantiated directly, as | ||
# per https://stackoverflow.com/a/7989101/5004662. | ||
raise TypeError( | ||
"_Aspect is an abstract class, and cannot be instantiated directly." | ||
) | ||
super().__init__() | ||
|
||
@classmethod | ||
def get_aspect_name(cls) -> str: | ||
return cls.ASPECT_NAME # type: ignore | ||
|
||
@classmethod | ||
def get_aspect_type(cls) -> str: | ||
return cls.ASPECT_TYPE | ||
|
||
@classmethod | ||
def get_aspect_info(cls) -> dict: | ||
return cls.ASPECT_INFO |
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.
The star makes me think there's multiple such files, but I think there should just be one? Or do we have multiple for multiple python versions, or something like that?
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.
yes there should be just one file - I'll make it a bit more clear