Skip to content

xpd new project

Create sgconfig.yml, xpd.yml and the rules, rule-tests and utils folders Use xpd new project to start a folder of your own rules. It writes sgconfig.yml, xpd.yml, and the rules, rule-tests and utils folders, with relative paths. Each --pack declares a pack whose rules run on the files that import the module, or on every Python file with --every-file. It stops when the folder already has sgconfig.yml.

With --format json it prints the files it wrote. In a folder named /tmp/project, that looks like this.

Terminal window
$ xpd new project --pack team --yes --format json
{"item":"project","createdFiles":["/tmp/project/sgconfig.yml","/tmp/project/xpd.yml","/tmp/project/rules/.gitkeep","/tmp/project/rule-tests/.gitkeep","/tmp/project/utils/.gitkeep","/tmp/project/rules/team/.gitkeep"],"modifiedFiles":[]}
Terminal window
xpd new project [OPTIONS]

--pack <MODULE>

A rule pack to declare, named after the module its rules are about.

Give it more than once to pass several values.

--every-file

Run the new packs' rules on every Python file, not only on files that import the module.

--directory <DIR>

The project folder, which holds sgconfig.yml. Nothing is written outside it. Default: the nearest folder at or above the current one with sgconfig.yml, or the current folder for a new project.

-y, --yes

Never ask. Fail when a required flag is missing.

--format <FORMAT>

Print the result as text, or as JSON with createdFiles and modifiedFiles.

Default: text.

Values: text, json.