Repository navigation
Conversation
…d names The Python template used uv_build without module-name, so uv_build expected src/<distribution name>/. --package-name and numeric project names (renamed to middleware_<n>) therefore failed at uv sync. Derived package names that are keywords or shadow a standard-library or template-dependency module (logging, secrets, http, grpc, google, assert) were used verbatim and failed at the generated project's pytest step. Set module-name in the template, give such derived names the existing middleware_ prefix, and reject an explicit --package-name that would shadow a module before any download. Fixes NVIDIA#104 Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #104.
omm create --language pythonfails at the validation step whenever the import package is not the distribution-derived name, and whenever the derived package is a Python keyword or shadows another top-level module. Nothing is published in either case, but the user only sees auv syncorpytesterror after the downloads.Changes
templates/python/pyproject.toml: set[tool.uv.build-backend] module-name = "__PACKAGE_NAME__". Without it,uv_buildexpectssrc/<distribution name>/, so--package-name(documented in the README) and numeric project names such as123(which the generator renames tomiddleware_123) cannot build.generator.py: new_python_package_conflict(). A derived package that is a keyword, a standard-library module (sys.stdlib_module_names) or a template dependency (grpc,google) gets the existingmiddleware_prefix, like numeric names and the Rust reserved-name handling. An explicit--package-namewith such a name raisesProjectErrorin_template_context, before any network or filesystem work.module-name; new parametrized tests cover derived names (assert,logging,secrets,http,grpc,google) and rejected overrides (class,logging,grpc).Validation (macOS arm64, uv 0.11.3)
The 11 new or extended test cases fail on
mainand pass with this change.make check:ruff format --check,ruff checkandty checkpass. pytest: 100 passed, 4 failed. The same 4 tests fail onmainon macOS (test_publish_reports_filesystem_without_no_replace_support[22/78/102]andtest_publish_translates_unexpected_rename_error: their fake libc defines onlyrenameat2, while macOS takes therenamex_nppath). They are unrelated to this change, and the coverage gate misses on macOS for the same reason (93.82% on main, 93.94% with this change). These checks were not run on Linux.Real end-to-end runs with
--openshell-version v0.0.86:omm create audit-headers(control)src/audit_headersomm create audit-headers --package-name custom_pkgExpected a Python module at: src/audit_headers/__init__.py)src/custom_pkgomm create 123src/123/__init__.py)src/middleware_123omm create logging/secrets/http/grpc/googleModuleNotFoundError)src/middleware_<name>omm create assertSyntaxError)src/middleware_assertomm create proj --package-name loggingPython package name 'logging' shadows a Python standard-library moduleWith
--package-name custom_pkg,uv build --wheelpackagescustom_pkg/server.py, anduv run audit-headers --helpruns.Rust projects and
omm updateare unchanged.updatedoes not re-renderpyproject.toml. Before this change, projects with these names could not be created at all, so no existing project is affected.This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.