Skip to content
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

Better PyApp integration #1423

Open
johannesloibl opened this issue Apr 24, 2024 · 0 comments
Open

Better PyApp integration #1423

johannesloibl opened this issue Apr 24, 2024 · 0 comments

Comments

@johannesloibl
Copy link

johannesloibl commented Apr 24, 2024

Hey, me again ;)

I'd like to request (and maybe even contribute) more integration options for PyApp.
Hatch right now only offers the scripts option, which is transforming your project scripts into a bunch of executables. While this may work for some easy use cases, it has following disadvantages:

  • Only [project.scripts] is taken into account and [project.gui-scripts] is ignored.
    So if your project needs to build both, it is hard to configure different PyApp environment variables for both.
  • No control over the naming of built executables. Right now the version number is appended and the script name is prepended. I'd like to make it template-able, something like mycustomname, mycustomname-{version} or {dist_name}-{version}.
  • __main__.py cannot be built if script is left empty. Also other options PyApp provides (PYAPP_EXEC_*) are not supported.

Here an example TOML i could imagine:

[tool.hatch.build.targets.binary]

[tool.hatch.build.targets.binary.variables]
CARGO_TARGET_DIR = ".tmp/pyapp_cargo"
PYAPP_DISTRIBUTION_EMBED = "false"
PYAPP_FULL_ISOLATION = "true"
PYAPP_PIP_EXTRA_ARGS = "--index-url ..."
PYAPP_UV_ENABLED = "true"

[tool.hatch.build.targets.binary.build-targets]
# Build the CLI from myapp.cli:cli
myapp-cli = { name = "{dist_name}-cli.exe", variables = {PYAPP_IS_GUI = "false", PYAPP_EXEC_SPEC = "myapp.cli:cli"}}
# Build the GUI from myapp.__main__
myapp-gui = { name = "{dist_name}.exe", variables = {PYAPP_IS_GUI = "true", PYAPP_EXEC_MODULE = "myapp"}}

This would enable all possible options of PyApp within Hatch and integrate it better.
What do you think? If you like it i could contribute this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant