wads.populate
Populate a package directory with useful packaging files.
Provides the populate_pkg_dir function to add standard files like README.md, pyproject.toml, and .gitignore.
- class wads.populate.PopulateTracker[source]
Track actions during populate for summary reporting.
- wads.populate.cd(newdir, verbose=True)[source]
Change your working directory, do stuff, and change back to the original
- wads.populate.get_github_project_description(repo: str, default_factory=<function _mk_default_project_description>)[source]
Get project description from github repository, or default if not found
- wads.populate.populate_pkg_dir(pkg_dir, version: str = '0.0.1', description: str = 'There is a bit of an air of mystery around this project...', *, root_url: str | None = None, author: str | None = None, license: str = 'mit', description_file: str = 'README.md', keywords: list | None = [], install_requires: list | None = [], long_description='file:README.md', long_description_content_type='text/markdown', include_pip_install_instruction_in_readme=True, verbose: bool = True, overwrite: list = (), defaults_from: str | None = None, create_docsrc: bool = False, skip_docsrc_gen=False, skip_ci_def_gen=False, migrate: bool = False, create_gitattributes: bool = True, create_setup_py: bool = False, create_community_files: bool = False, version_control_system=None, ci_def_path=None, ci_tpl_path=None, project_type='lib', **configs)[source]
Populate project directory root with useful packaging files, if they’re missing.
>>> from wads.populate import populate_pkg_dir >>> import os >>> name = 'wads' >>> pkg_dir = f'/D/Dropbox/dev/p3/proj/i/{name}' >>> populate_pkg_dir(pkg_dir, ... description='Tools for packaging', ... root_url=f'https://github.com/i2mint', ... author='OtoSense')
- Parameters:
pkg_dir (str, optional) – The relative or absolute path of the working directory. Defaults to ‘.’.
version – The desired version
description – Short description of project
root_url – Root url of the code repository (not the url of the project, but one level up that!)
author – Author of the package
license – License name for the package (should be recognized by pypi). Default is ‘mit’
description_file – File name containing a description of the project. Default is ‘README.md’
keywords – Keywords to include in pypi publication
install_requires – The (pip install) names of of the packages required to install the package we’re generating
long_description – Text of the long description. Default is “file:README.md” (takes contents of README.md)
long_description_content_type – How to parse the long_description. Default is “text/markdown”
verbose (bool, optional: Whether to print a lot of stuff as project is being populated.) – Set to True if you want to log extra information during the process. Defaults to False.
default_from – Name of field to look up in wads_configs to get defaults from, or ‘user_input’ to get it from user input.
skip_docsrc_gen – Skip the generation of documentation stuff
create_docsrc – If True, create and populate a docsrc/ directory (overrides skip_docsrc_gen).
skip_ci_def_gen – Skip the generation of the CI stuff
create_setup_py – If True, create setup.py for backward compatibility (default: False, not needed with Hatchling).
create_community_files – If True, create community files (.editorconfig, issue/PR templates, dependabot.yml). Default: False.
migrate – If True, migrate existing setup.cfg to pyproject.toml and old CI to new CI format. Will fail if old CI has unmappable content.
create_gitattributes – If True (default), create a .gitattributes file with ‘*.ipynb linguist-documentation’.
version_control_system – ‘github’ or ‘gitlab’ (will TRY to be resolved from root url if not given)
ci_def_path – Path of the CI definition
ci_tpl_path – Pater of the template definition
configs – Extra configurations
- Returns:
- wads.populate.populate_proj_from_url(url, proj_rootdir=None, description=None, license='mit', **kwargs)[source]
git clone a repository and set the resulting folder up for packaging.