pyscaffold.extensions package¶
Submodules¶
pyscaffold.extensions.cirrus module¶
Extension that generates configuration for Cirrus CI.
-
class
pyscaffold.extensions.cirrus.
Cirrus
(name)[source]¶ Bases:
pyscaffold.api.Extension
Add configuration file for Cirrus CI (includes –tox and –pre-commit)
-
activate
(actions)[source]¶ Activate extension
Parameters: actions (list) – list of actions to perform Returns: updated list of actions Return type: list
-
augment_cli
(parser)[source]¶ Augments the command-line interface parser A command line argument
--FLAG
where FLAG=``self.name`` is added which appendsself.activate
to the list of extensions. As help text the docstring of the extension class is used. In most cases this method does not need to be overwritten. :param parser: current parser object
-
-
class
pyscaffold.extensions.cirrus.
IncludeExtensions
(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]¶ Bases:
argparse.Action
Automatically activate tox and pre-commit together with cirrus.
pyscaffold.extensions.cookiecutter module¶
Extension that integrates cookiecutter templates into PyScaffold.
Warning
Deprecation Notice - In the next major release the Cookiecutter extension
will be extracted into an independent package.
After PyScaffold v4.0, you will need to explicitly install
pyscaffoldext-cookiecutter
in your system/virtualenv in order to be
able to use it.
Bases:
pyscaffold.api.Extension
Additionally apply a Cookiecutter template
Register before_create hooks to generate project using Cookiecutter
Parameters: actions (list) – list of actions to perform Returns: updated list of actions Return type: list
Add an option to parser that enables the Cookiecutter extension
Parameters: parser (argparse.ArgumentParser) – CLI parser object
Bases:
RuntimeError
A cookiecutter template (git url) is required.
Bases:
RuntimeError
This extension depends on the
cookiecutter
package.
Create a cookie cutter template
Parameters: Returns: updated project representation and options
Return type: struct, opts
Create a Cookiecutter parser.
Parameters: obj_ref (Extension) – object reference to the actual extension Returns: parser for namespace cli argument Return type: NamespaceParser
pyscaffold.extensions.django module¶
Extension that creates a base structure for the project using django-admin.
Warning
Deprecation Notice - In the next major release the Django extension
will be extracted into an independent package.
After PyScaffold v4.0, you will need to explicitly install
pyscaffoldext-django
in your system/virtualenv in order to be
able to use it.
-
class
pyscaffold.extensions.django.
Django
(name)[source]¶ Bases:
pyscaffold.api.Extension
Generate Django project files
-
activate
(actions)[source]¶ Register hooks to generate project using django-admin.
Parameters: actions (list) – list of actions to perform Returns: updated list of actions Return type: list
-
mutually_exclusive
= True¶
-
-
exception
pyscaffold.extensions.django.
DjangoAdminNotInstalled
(message='django-admin is not installed, run: pip install django', *args, **kwargs)[source]¶ Bases:
RuntimeError
This extension depends on the
django-admin
cli script.-
DEFAULT_MESSAGE
= 'django-admin is not installed, run: pip install django'¶
-
-
pyscaffold.extensions.django.
create_django_proj
(struct, opts)[source]¶ Creates a standard Django project with django-admin
Parameters: Returns: updated project representation and options
Return type: struct, opts
Raises: RuntimeError
– raised if django-admin is not installed
pyscaffold.extensions.gitlab_ci module¶
Extension that generates configuration and script files for GitLab CI.
pyscaffold.extensions.namespace module¶
Extension that adjust project file tree to include a namespace package.
This extension adds a namespace option to
create_project
and provides correct values for the
options root_pkg and namespace_pkg to the following functions in the
action list.
-
class
pyscaffold.extensions.namespace.
Namespace
(name)[source]¶ Bases:
pyscaffold.api.Extension
Add a namespace (container package) to the generated package.
-
activate
(actions)[source]¶ Register an action responsible for adding namespace to the package.
Parameters: actions (list) – list of actions to perform Returns: updated list of actions Return type: list
-
augment_cli
(parser)[source]¶ Add an option to parser that enables the namespace extension.
Parameters: parser (argparse.ArgumentParser) – CLI parser object
-
-
pyscaffold.extensions.namespace.
add_namespace
(struct, opts)[source]¶ Prepend the namespace to a given file structure
Parameters: Returns: directory structure as dictionary of dictionaries and input options
Return type:
-
pyscaffold.extensions.namespace.
create_namespace_parser
(obj_ref)[source]¶ Create a namespace parser.
Parameters: obj_ref (Extension) – object reference to the actual extension Returns: parser for namespace cli argument Return type: NamespaceParser
-
pyscaffold.extensions.namespace.
enforce_namespace_options
(struct, opts)[source]¶ Make sure options reflect the namespace usage.
pyscaffold.extensions.no_skeleton module¶
Extension that omits the creation of file skeleton.py
-
class
pyscaffold.extensions.no_skeleton.
NoSkeleton
(name)[source]¶ Bases:
pyscaffold.api.Extension
Omit creation of skeleton.py and test_skeleton.py
-
activate
(actions)[source]¶ Activate extension
Parameters: actions (list) – list of actions to perform Returns: updated list of actions Return type: list
-
pyscaffold.extensions.pre_commit module¶
Extension that generates configuration files for Yelp pre-commit.
-
class
pyscaffold.extensions.pre_commit.
PreCommit
(name)[source]¶ Bases:
pyscaffold.api.Extension
Generate pre-commit configuration file
-
activate
(actions)[source]¶ Activate extension
Parameters: actions (list) – list of actions to perform Returns: updated list of actions Return type: list
-
static
add_files
(struct, opts)[source]¶ Add .pre-commit-config.yaml file to structure
Since the default template uses isort, this function also provides an initial version of .isort.cfg that can be extended by the user (it contains some useful skips, e.g. tox and venv)
Parameters: Returns: updated project representation and options
Return type: struct, opts
-
pyscaffold.extensions.tox module¶
Extension that generates configuration files for the Tox test automation tool.
pyscaffold.extensions.travis module¶
Extension that generates configuration and script files for Travis CI.
Module contents¶
Built-in extensions for PyScaffold.