FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(project): escape project name in rendered pythonnative.toml by ernesthenry · Pull Request #35 · pythonnative/pythonnative · GitHub

Repository navigation

fix(project): escape project name in rendered pythonnative.toml - #35

Closed
ernesthenry wants to merge 1 commit into
pythonnative:mainfrom
ernesthenry:fix/escape-project-name-toml
Closed

ernesthenry wants to merge 1 commit into
pythonnative:mainfrom
ernesthenry:fix/escape-project-name-toml

Conversation

Copy link
Copy Markdown
Contributor

What

  • Properly escape project names, display names, and app identifiers in render_default_toml().
  • Sanitize comments in the rendered pythonnative.toml template.

Why

  • Project names containing double quotes, backslashes, or control characters produced malformed TOML files that could not be parsed by tomllib.

How (brief)

  • Used json.dumps() to serialize string literals into the starter TOML template in src/pythonnative/project/config.py.
  • Added unit tests in tests/project/test_config.py and CLI tests in tests/test_cli.py.

Testing

  • pytest tests/project/test_config.py -v (22 passed)
  • pytest tests/test_cli.py -k test_cli_init -v (20 passed)
  • ruff check and black formatting checks passed.

Risks/Impact

  • Low risk; non-breaking fix for template generation.

Docs/Follow-ups

  • None required.

Closes #29

Copy link
Copy Markdown
Contributor

Thanks for the work here, and your test coverage was solid. Unfortunately this one's a duplicate: issue #29 was claimed and assigned on Aug 30, and PR #32 (opened before this one) has since merged and closed the issue. It also went a different route per the discussion on #29 (input validation in pn init plus escaping as defense in depth), which is why I'm not folding any of this in. I'm going to close this PR as superseded.

Sorry the effort didn't land this time. To avoid a repeat, please comment on an issue to claim it and wait for assignment before starting work; the assignee and linked PRs on the issue are the quickest way to see whether it's taken. We just opened ten new good first issues (#36-#45). If one interests you, comment on it and I'll assign it to you.

owenthcarey closed this Sep 1, 2026
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pn init doesn't escape the project name written into pythonnative.toml

2 participants


Back | FazBrowse Home | New Git URL