Skip to content

Allow dotted namespace package names in flit init (#679) - #822

Open
CyberneticX-Tech wants to merge 1 commit into
pypa:mainfrom
CyberneticX-Tech:fix/679-patch
Open

Allow dotted namespace package names in flit init (#679)#822
CyberneticX-Tech wants to merge 1 commit into
pypa:mainfrom
CyberneticX-Tech:fix/679-patch

Conversation

@CyberneticX-Tech

Copy link
Copy Markdown

Summary

Fixes #679.

flit init previously used str.isidentifier as the validator for the interactive module name prompt, which rejected valid Python namespace packages containing dot separators (such as my_org.my_pkg or ns.subpkg).

This change introduces validate_module_name in IniterBase, ensuring that every dot-separated segment is a valid Python identifier while disallowing empty components or leading/trailing dots.

Changes

  • Added IniterBase.validate_module_name(s: str) -> bool validating bool(s) and all(n.isidentifier() for n in s.split('.')).
  • Updated TerminalIniter.initialise() to use self.validate_module_name for module name validation.
  • Added comprehensive unit tests in tests/test_init.py covering valid/invalid module name patterns and end-to-end flit init execution with namespace packages.

Validate module names by ensuring each dot-separated component is a valid identifier, allowing namespace packages like 'my_org.my_pkg'. Closes pypa#679.
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.

flit init namespace package name validation

1 participant