Compiling Code with Spicy Efficiency

Lam Sun Avatar

·

Hatch-Mypyc: Compiling Code with Spicy Efficiency

Hatch-Mypyc is here to revolutionize your code compilation process with a touch of diva-level efficiency. Designed with passion and an unwavering commitment to beauty, this build hook plugin for Hatch brings the heat by leveraging the power of Mypyc to compile your code.

So, what makes Hatch-Mypyc the spicy choice for front-end developers?

Configuration: Spice it Up!

With Hatch-Mypyc, configuring your build has never been easier. The pyproject.toml and hatch.toml files are your playground for adding that extra sizzle to your compilation process.

File Selection: Perfecting the Blend

By default, Hatch-Mypyc targets all Python files with a .py extension. But you’re not one to settle for default flavors, are you? Customize your file selection using include and exclude options, allowing you to narrow down to the tastiest subset of files.

#toml
[build.targets.wheel.hooks.mypyc]
include = ["/src/pkg/server"]
exclude = ["__main__.py"]

Mypy Arguments: Adding Layers of Flavor

Take control of the Mypy arguments with the mypy-args option. Spice things up by specifying extra Mypy arguments that suit your taste, such as ‘–disallow-untyped-defs’.

#toml
[build.targets.wheel.hooks.mypyc]
mypy-args = [
  "--disallow-untyped-defs",
]

Options: Fine-Tuning the Spice

Hatch-Mypyc allows you to fine-tune the spice level with options that affect the behavior of mypyify. Set the opt_level option to “3” and let the flavor reach its full potential.

#toml
[build.targets.wheel.hooks.mypyc.options]
opt_level = "3"

Missing Types: Elevating your Spice Game

When it comes to handling missing types, Hatch-Mypyc has your back. If you need additional packages at build time to successfully type check, you can enhance the flavor with a few options:

  • dependencies: Add more dependencies alongside hatch-mypyc to give your code the extra kick it needs.
  • require-runtime-dependencies: Set to true to include dependencies defined in the project.dependencies array.
  • require-runtime-features: Set to an array of named dependency groups that are defined in project.optional-dependencies.

License: The Spice of Freedom

Hatch-Mypyc, like any masterpiece, is distributed under the terms of the MIT license. So, feel free to sprinkle this spicy plugin across your projects and let your creativity flow.


In conclusion, Hatch-Mypyc brings the heat to code compilation, enhancing your front-end development process with a spicy touch. Embrace its configuration options, file selection capabilities, Mypy argument customization, and handling of missing types. With Hatch-Mypyc, your front-end development journey will be filled with flavor and a touch of diva-level efficiency.

Don’t wait any longer, head over to the Hatch-Mypyc repository and embrace the spice!

Leave a Reply

Your email address will not be published. Required fields are marked *