Skip to content

xpd rules new project

Use xpd rules 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 rules 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 rules new project [OPTIONS]
Option Default What it does
--pack <MODULE> A rule pack to declare, named after the module its rules are about. Repeatable.
--category <CATEGORY> Default category for each pack created by this command. Values: data, numerics, statistics, features, models, evaluation, optimization, visualization, workflow.
--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> text Print the result as text, or as JSON with createdFiles and modifiedFiles. Values: text, json.