Skip to content

Support filenames with '{var}' in them #9

@thatch

Description

@thatch

For example, we currently generate a setup.cfg snippet with:

packages =
  {package}

It would often be convenient to also generate a stub {package}/__init__.py as well. Variable interpolation doesn't happen on the filenames currently.

For this issue, regen.py needs to be updated to apply variable_format to local_path as well. It's currently a Path, not a str, which makes this a little more interesting, and the logic from VARIABLE_RE through the call to variable_format should be extracted out to a function that can be called multiple times. Moving this to a class to make it easier to test is ok too!

Steps to test:

  1. Create templates/{package}/__init__.py with some text.
  2. cd /tmp/example
  3. /path/to/skel/regen.py (and answer some questions, say package is "foo")
  4. Check that /tmp/example/foo/__init__.py contains the appropriate text

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions