Package: pybuilder-archetype-base
PyBuilder Archetype Base PluginThis plugin generates a base common structure with no major dependecies. The main idea is to get an skeleton that can
be used for any kind of Python module. It modifies PyBuilder structure logic lightly, removing some packages making
it lessJava-like.In the following diagram there is every directory and file created duringcreate_archetype_base:bin
docs
src
└── package_name
    ├── config  # For any kind of configuration files or constants
    |   ├── logger
    |   |   └── logger.yml
    |   ├── __init__.py
    |   ├── constants.py
    |   └── messages.py
    ├── core  # Logic of the project itself
    |   └── __init__.py
    ├── errors  # For every custom exception made
    |   ├── core  # Make as many scripts as packages in core (i.e. processing.py for core.processing)
    |   |   └── __init__.py
    |   └── __init__.py
    ├── utils  # For any kind of util used in the project
    |   ├── logging
    |   |   ├── __init__.py
    |   |   └── handlers.yml  # For custom logging handles (i.e. database logging)
    |   ├── __init__.py
    |   └── helpers.py
    └── __init__.py
tests
├── __init__.py
└── example_test.py
.gitignore
LICENSE # Empty file
README.md
requirements.txt
setup.pyThere are other PyBuilder plugins that depend on pybuilder_archetype_base that include other more specific packages.
These plugins are:pybuilder_archetype_api: For projects focused on web services(WIP)pybuilder_archetype_db: For projects using databasesHow to use pybuilder_archetype_baseNOTICE: This plugin only works on Windows due to its dependency with pybuilder_pycharm_workspace PyBuilder
plugin. Using this plugin in other OS shall not work properly. Multi-platform support soon.Add plugin dependencies to yourbuild.py(it requirespybuilder_pycharm_workspaceto work properly):use_plugin('pypi:pybuilder_archetype_base')use_plugin('pypi:pybuilder_pycharm_workspace')Configure the plugin within yourinitfunction:@initdefinitialise(project):project.set_property('project_base_path',project_path)project.set_property('pycharm_workspace_project_path',project_path)This will tell the plugin which is the project location in the filesystem.project_base_pathproperty value should be
always the same. It is needed to informpycharm_workspace_project_pathtoo in order to get
pybuilder_pycharm_workspace working.Launch the task with:(venv)C:\Users\foo\PycharmProjects\bar> pyb create_archetype_basebuild.pyfile recommendedThis plugin doesn't include abuild.pyfile due to there should be already one at the moment of the execution ofpybcommand. The following template can be used along this plugin. Modify as desired.frompathlibimportPathfrompybuilder.coreimportuse_plugin,init,Author,beforeuse_plugin('python.core')use_plugin('python.distutils')use_plugin('python.flake8')use_plugin('python.unittest')use_plugin('pypi:pybuilder_pycharm_workspace')use_plugin('pypi:pybuilder_archetype_base')project_path=Path(__file__).resolve().parentname=project_path.nameauthors=[Author("foo",'bar')]license="Apache License, Version 2.0"version='1.0.0'@initdefinitialise(project):project.depends_on_requirements('requirements.txt')project.set_property('dir_source_main_python','src')project.set_property('dir_source_unittest_python','tests')project.set_property('unittest_module_glob','test_*')project.set_property('project_base_path',project_path)project.set_property('pycharm_workspace_project_path',project_path)@init(environments='develop')definitialise_dev(project):project.version=f'{project.version}.dev'project.set_property('flake8_verbose_output',True)@init(environments='production')definitialise_pro(project):project.set_property('flake8_break_build',True)project.set_property('flake8_include_test_sources',True)@before('prepare')defpack_files(project):"""Includes non-Python files in the build.:param pybuilder.core.Project project: PyBuilder project instance:return: None"""package_path=list(Path(project.get_property('dir_source_main_python')).glob('*'))[0]resources_paths=sorted(package_path.glob('**'))[1:]project.package_data.update({package_path.name:[str((path.relative_to(package_path)/'*').as_posix())forpathinresources_paths]})Take note ofbuild.pyexample onpybuilder_pycharm_workspaceplugin README to cover its needs too.PropertiesPlugin has next properties with provided defaultsNameTypeDefault ValueDescriptionproject_base_pathPathNoneProject's path in filesystem (same asbuild.pyfile). Mandatory