-
-
Notifications
You must be signed in to change notification settings - Fork 484
Description
What is the problem or limitation you are having?
briefcase new works well for bootstrapping a new project from scratch. However, if you have an existing project, the wizard can't really be used - your only option is to write (or update) your pyproject.toml config from scratch
Describe the solution you'd like
Briefcase should have an option (briefcase new --sources src/myapp) that can be used to set up an existing project with Briefcase. This mode would ask the usual wizard questions, use the location specified by --sources, and write a first draft of a pyproject.toml - updating the existing pyproject.toml if it already exists.
Describe alternatives you've considered
Treat this problem as a documentation issue.
Additional context
The easiest approach will likely be to use the cookiecutter new project template to generate a full dummy project config into a temporary directory, then merge the pyproject.toml in the dummy with the one that the project already has, and then clean up the temporary directory.
When the user specifies a sources of src/myapp, there should be some error detection to ensure that:
- The specified path exists
- It contains a
__main__.py
Once that has been verified, there's no need to ask the user for the appname - it should be the tail of the path given to --sources (i.e., --sources src/myapp would be an app name of myapp). The user should still be asked for formal name, bundle etc.
It may also be necessary to provide a --test-sources option so that the user can optionally specify the location of their test code.
- Specifying
--test-sourcesbut not--sourcesshould be an error; - if
--sourcesis specified, but--test-sourcesisn't, the template should be written as if there are no test sources; - If
--sourcesand--test-sourcesis specified, the testing entry script generated by the dummy template should be copied into the test sources folder.
When in --sources mode, the wizard should also audit the project to highlight any extra files that may be needed. For example, the default template generates a LICENSE and CHANGELOG file - if these aren't present in the existing project, the user should be warned that they should add them (or copy over the versions from the dummy project with a warning that dummy content has been added).