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

optionally override module names; bump version to 0.16.0 #128

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

dicej
Copy link
Collaborator

@dicej dicej commented Nov 27, 2024

This adds CLI and componentize-py.toml options for overriding the generated Python module names for one or more WIT interfaces.

By default, the name is the snake-case version of the WIT name, qualified as necessary with the package namespace and name and/or the version in cases of ambiguity. Sometimes that's not what you want, though, so now you can override the naming on an individual basis as long as the name(s) you pick are unique.

This can be especially useful for backwards compatibility when adding new versions of WIT interfaces. In that case, the generated module name may go from unqualified to qualified, but you can now force the name of the original version to be unqualified for compatibility. For example:

  • You release an SDK with an interface called foo:bar/baz@1.0.0. Since that's the only interface with the name baz, componentize-py will name the generated module baz also.

  • Later, you release a new version of the SDK with support for both foo:bar/baz@1.0.0 and foo:bar/baz@2.0.0. In that case, componentize-py will name the generated modules foo_bar_baz_1_0_0 and foo_bar_baz_2_0_0 by default. However, you don't want to force users of your SDK to use the new name, so you pass --import-interface-name foo:bar/baz@1.0.0=baz to componentize-py, which tells it to use the original name.

This adds CLI and componentize-py.toml options for overriding the generated
Python module names for one or more WIT interfaces.

By default, the name is the snake-case version of the WIT name, qualified as
necessary with the package namespace and name and/or the version in cases of
ambiguity.  Sometimes that's not what you want, though, so now you can override
the naming on an individual basis as long as the name(s) you pick are unique.

This can be especially useful for backwards compatibility when adding new
versions of WIT interfaces.  In that case, the generated module name may go from
unqualified to qualified, but you can now force the name of the original version
to be unqualified for compatibility.  For example:

- You release an SDK with an interface called `foo:bar/baz@1.0.0`.  Since that's
  the only interface with the name `baz`, `componentize-py` will name the
  generated module `baz` also.

- Later, you release a new version of the SDK with support for _both_
  `foo:bar/baz@1.0.0` _and_ `foo:bar/baz@2.0.0`.  In that case,
  `componentize-py` will name the generated modules `foo_bar_baz_1_0_0` and
  `foo_bar_baz_2_0_0` by default.  However, you don't want to force users of
  your SDK to use the new name, so you pass `--import-interface-name
  foo:bar/baz@1.0.0=baz` to `componentize-py`, which tells it to use the
  original name.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
dicej added a commit to dicej/spin-python-sdk that referenced this pull request Nov 27, 2024
This adds support for fermyon:spin@3.0.0 worlds, while still using the 2.0.0
worlds by default.  Apps may opt-in to using a 3.0.0 world by specifying
e.g. `--world fermyon:spin/spin-http@3.0.0` as part of their `componentize-py`
command in their `spin.toml` file.

This also updates to `componentize-py` v0.16.0 (which includes
bytecodealliance/componentize-py#128, a feature required
for compatibility with earlier SDK releases).

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
i.e. match what we're doing in release.yaml.

TODO: Factor out the "Populate cache" job into a reusable action instead of
cut-and-pasting it.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej merged commit 528a3a0 into bytecodealliance:main Nov 27, 2024
4 checks passed
@dicej dicej deleted the name-override branch November 27, 2024 21:01
dicej added a commit to dicej/spin-python-sdk that referenced this pull request Nov 27, 2024
This adds support for fermyon:spin@3.0.0 worlds, while still using the 2.0.0
worlds by default.  Apps may opt-in to using a 3.0.0 world by specifying
e.g. `--world fermyon:spin/spin-http@3.0.0` as part of their `componentize-py`
command in their `spin.toml` file.

This also updates to `componentize-py` v0.16.0 (which includes
bytecodealliance/componentize-py#128, a feature required
for compatibility with earlier SDK releases).

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
dicej added a commit to fermyon/spin-python-sdk that referenced this pull request Dec 3, 2024
This adds support for fermyon:spin@3.0.0 worlds, while still using the 2.0.0
worlds by default.  Apps may opt-in to using a 3.0.0 world by specifying
e.g. `--world fermyon:spin/spin-http@3.0.0` as part of their `componentize-py`
command in their `spin.toml` file.

This also updates to `componentize-py` v0.16.0 (which includes
bytecodealliance/componentize-py#128, a feature required
for compatibility with earlier SDK releases).

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
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

Successfully merging this pull request may close these issues.

1 participant