-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add VSCode extension repos #1427
Conversation
f012a4f
to
f60ec5d
Compare
e4846cf
to
857e61e
Compare
I haven't tested this; I'm not sure if there are any steps I'm missing (maybe some unit and integration tests?). |
857e61e
to
6a2670a
Compare
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.
There are 2 repositories, please split into separate PRs.
openvsx almost works and looks useful, as it intersects with vscode-extension-*
from nix
ragarding vscmarketplace I'm hesitant as I'd prefer not to have any complex and/or paginating fetchers ever
class OpenVSXParser(Parser): | ||
def iter_parse(self, path: str, factory: PackageFactory) -> Iterable[PackageMaker]: | ||
with open(path, 'r') as extdatafile: | ||
extension_data = json.load(extdatafile) |
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.
Loading json into memory is not scalable. You should use iter_json_list
to parse it as stream.
# TODO: More metadata is available, it's just harder to fetch and will require its own fetcher, in all likelihood | ||
pkg.add_name('vscode-extension:{namespace}-{name}'.format(**extension), NameType.GENERIC_SRC_NAME) | ||
pkg.set_version(extension['version']) | ||
pkg.set_summary(extension['description']) |
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.
Description turns out to be optional, thus extension.get('description')
for extension in raw_extensions: | ||
with factory.begin() as pkg: | ||
# TODO: More metadata is available, it's just harder to fetch and will require its own fetcher, in all likelihood | ||
pkg.add_name('vscode-extension:{namespace}-{name}'.format(**extension), NameType.GENERIC_SRC_NAME) |
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.
vscode-extension:
prefix should be added in a ruleset (and we can shorten it to vscode:
). Also please use f-strings with defined fields.
pkg.set_version(extension['version']) | ||
pkg.set_summary(extension['description']) | ||
pkg.add_maintainers('{namespace}@openvsx'.format(**extension)) | ||
pkg.add_links(LinkType.UPSTREAM_HOMEPAGE, 'https://open-vsx.org/extension/{namespace}/{name}'.format(**extension)) |
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.
- f-strings with explicit extension fields here and around
- generated links are defined in
packagelinks
section of repo config. You can pass namespace/name throughpkg.extrafields
- link type would be PROJECT_HOMEPAGE, it's not upstream
if len(response['results'][0]['extensions']) < self.page_size: | ||
break | ||
|
||
with open(statefile.get_path(), 'w', encoding='utf-8') as extdata: |
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.
You write directly into statefile.get_file() here
Timeout. I've polished and merged openvsx support, vscmarketplace doesn't look suitable. Feel free to redo in compatible way if possible. |
- Fix parser to use standard json processing facility - Fix handling optional fields (download, description - Fix package link types and add another link (recipe/manifest) - Improbe name handling, handle display name properly - Move repository entry into modules/ fix type, update minpackages, enable shadow
No description provided.