January 2022 Summaries
2 posts from Aspect Build
Filter
Month:
Year:
Post Summaries
Back to Blog
In a complex build environment involving migrations between different Python runtime versions or the integration of Bazel, managing multiple Python interpreters within one build graph can be challenging. The process described involves creating a system that allows for the use of multiple Python interpreters by intercepting the default interpreter execution and substituting it with the required version, using a stub script generated from a template. This involves setting up a py_runtime definition, utilizing the expand_template rule from the aspect_bazel_lib library, and configuring a stub template to manage interpreter paths via environment variables. The strategy includes defining macros for py_binary and py_test to allow specifying different interpreter versions, which are stored in a structured format for easy reference. The implementation also considers the management of external dependencies, ensuring that the pip_install rule aligns with the correct interpreter version to avoid mismatched dependencies. This approach is particularly useful when there are no overlapping dependencies between targets requiring different Python versions, facilitating a seamless transition and flexible environment setup.
Jan 31, 2022
1,254 words in the original blog post.
In the development of TypeScript in Bazel, a new Bazel plugin named "ts_project" was created to replace the complex and less compatible "ts_library" rule, offering a simpler and more compatible solution. This new rule, developed with OJ Kwon, utilizes the standard TypeScript compiler (tsc) but initially suffered from slower compilation due to starting a new process for each task. Efforts to introduce a watch mode were unsuccessful in scaling effectively. However, the integration of the SWC transpiler, known for its speed and efficiency regardless of being a new process or in watch mode, has resolved these issues, providing up to a 20x increase in speed over previous methods. Users can now choose their preferred transpiler, such as SWC or Babel, while still relying on tsc for type-checking when necessary. This advancement, supported by EngFlow's sponsorship, is expected to eventually lead to the deprecation of the old ts_library rule, simplifying the TypeScript build process within Bazel.
Jan 06, 2022
1,085 words in the original blog post.