-
Notifications
You must be signed in to change notification settings - Fork 103
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
perf: use orjson for writing compile_commands #118
Closed
Closed
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1d81111
perf: use orjson for writing compile_commands when available
aminya ec319bc
perf: use orjson for caching files
aminya f01758a
perf: use orjson for loading the cache files
aminya cdfd02b
fix: remove the json fallbacks for orjson code
aminya 4fb3ceb
build: use bazel to install orjson (#1)
garymm de73b76
fix: update rules_python
aminya dbd48fa
Revert "fix: update rules_python"
aminya c22f08c
Revert "build: use bazel to install orjson (#1)"
aminya 7a6a56d
Revert "fix: remove the json fallbacks for orjson code"
aminya e5206ce
fix: pretty print the compile commands for orjson
aminya afbeea1
docs: add faster command for orjson installation
aminya 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
build: use bazel to install orjson (#1)
- Loading branch information
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Starlark representation of locked requirements. | ||
|
||
@generated by rules_python pip_parse repository rule | ||
from @//:python_requirements_lock.txt | ||
""" | ||
|
||
load("@rules_python//python/pip_install:pip_repository.bzl", "whl_library") | ||
|
||
all_requirements = ["@pip_orjson//:pkg"] | ||
|
||
all_whl_requirements = ["@pip_orjson//:whl"] | ||
|
||
_packages = [("pip_orjson", "orjson==3.9.1")] | ||
_config = {"download_only": False, "enable_implicit_namespace_pkgs": False, "environment": {}, "extra_pip_args": [], "isolated": True, "pip_data_exclude": [], "python_interpreter": "python3", "python_interpreter_target": "@python_toolchain_x86_64-unknown-linux-gnu//:bin/python3", "quiet": True, "repo": "pip", "repo_prefix": "pip_", "timeout": 600} | ||
_annotations = {} | ||
|
||
def _clean_name(name): | ||
return name.replace("-", "_").replace(".", "_").lower() | ||
|
||
def requirement(name): | ||
return "@pip_" + _clean_name(name) + "//:pkg" | ||
|
||
def whl_requirement(name): | ||
return "@pip_" + _clean_name(name) + "//:whl" | ||
|
||
def data_requirement(name): | ||
return "@pip_" + _clean_name(name) + "//:data" | ||
|
||
def dist_info_requirement(name): | ||
return "@pip_" + _clean_name(name) + "//:dist_info" | ||
|
||
def entry_point(pkg, script = None): | ||
if not script: | ||
script = pkg | ||
return "@pip_" + _clean_name(pkg) + "//:rules_python_wheel_entry_point_" + script | ||
|
||
def _get_annotation(requirement): | ||
# This expects to parse `setuptools==58.2.0 --hash=sha256:2551203ae6955b9876741a26ab3e767bb3242dafe86a32a749ea0d78b6792f11` | ||
# down to `setuptools`. | ||
name = requirement.split(" ")[0].split("=")[0].split("[")[0] | ||
return _annotations.get(name) | ||
|
||
def install_deps(**whl_library_kwargs): | ||
whl_config = dict(_config) | ||
whl_config.update(whl_library_kwargs) | ||
for name, requirement in _packages: | ||
whl_library( | ||
name = name, | ||
requirement = requirement, | ||
annotation = _get_annotation(requirement), | ||
**whl_config | ||
) |
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 @@ | ||
orjson==3.9.1 |
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
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
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.
BTW if this works, then you can assume python 3.11 in refresh.template.py and simplify the script quite a bit. Not suggesting that should be in this PR, probably a later PR.
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.
It works, but the requirement is adding things to the workspace of the user, which I am not sure if it is desirable:
#118 (comment)