pyscaffold.extensions package¶
Submodules¶
pyscaffold.extensions.awesome module¶
-
class
pyscaffold.extensions.awesome.
AwesomeFiles
(name)[source]¶ Bases:
pyscaffold.api.Extension
Adding some additional awesome files
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
struct (dict) – project representation as (possibly) nested
dict
.opts (dict) – given options, see
create_project
for an extensive list.
- 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
Make sure options reflect the cookiecutter usage.
- Parameters
struct (dict) – project representation as (possibly) nested
dict
.opts (dict) – given options, see
create_project
for an extensive list.
- Returns
updated project representation and options
- Return type
struct, opts
pyscaffold.extensions.django module¶
Extension that creates a base structure for the project using django-admin.py.
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.py is not installed, run: pip install django', *args, **kwargs)[source]¶ Bases:
RuntimeError
This extension depends on the
django-admin.py
cli script.-
DEFAULT_MESSAGE
= 'django-admin.py is not installed, run: pip install django'¶
-
-
pyscaffold.extensions.django.
create_django_proj
(struct, opts)[source]¶ Creates a standard Django project with django-admin.py
- Parameters
struct (dict) – project representation as (possibly) nested
dict
.opts (dict) – given options, see
create_project
for an extensive list.
- Returns
updated project representation and options
- Return type
struct, opts
- Raises
RuntimeError – raised if django-admin.py is not installed
-
pyscaffold.extensions.django.
enforce_django_options
(struct, opts)[source]¶ Make sure options reflect the Django usage.
- Parameters
struct (dict) – project representation as (possibly) nested
dict
.opts (dict) – given options, see
create_project
for an extensive list.
- Returns
updated project representation and options
- Return type
struct, opts
pyscaffold.extensions.gitlab_ci module¶
Extension that generates configuration and script files for GitLab CI.
-
class
pyscaffold.extensions.gitlab_ci.
GitLab
(name)[source]¶ Bases:
pyscaffold.api.Extension
Generate GitLab CI configuration files
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.
-
pyscaffold.extensions.namespace.
add_namespace
(struct, opts)[source]¶ Prepend the namespace to a given file structure
- Parameters
struct (dict) – directory structure as dictionary of dictionaries
opts (dict) – options of the project
- Returns
directory structure as dictionary of dictionaries and input options
- Return type
tuple(dict, dict)
-
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.namespace.
move_old_package
(struct, opts)[source]¶ Move old package that may be eventually created without namespace
- Parameters
struct (dict) – directory structure as dictionary of dictionaries
opts (dict) – options of the project
- Returns
directory structure as dictionary of dictionaries and input options
- Return type
tuple(dict, dict)
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
-
remove_files
(struct, opts)[source]¶ Remove all skeleton files from structure
- Parameters
struct (dict) – project representation as (possibly) nested
dict
.opts (dict) – given options, see
create_project
for an extensive list.
- Returns
updated project representation and options
- Return type
struct, opts
-
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
struct (dict) – project representation as (possibly) nested
dict
.opts (dict) – given options, see
create_project
for an extensive list.
- 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.
-
class
pyscaffold.extensions.tox.
Tox
(name)[source]¶ Bases:
pyscaffold.api.Extension
Generate Tox configuration file
pyscaffold.extensions.travis module¶
Extension that generates configuration and script files for Travis CI.
-
class
pyscaffold.extensions.travis.
Travis
(name)[source]¶ Bases:
pyscaffold.api.Extension
Generate Travis CI configuration files
Module contents¶
Built-in extensions for PyScaffold.