pkgcreator is a Python CLI tool that helps you quickly set up a new Python package with a recommended folder structure, a virtual environment, license file, Git repository, and pre-filled configuration files like pyproject.toml and README.md.
It supports interactive prompts, smart defaults (e.g. from your Git config), and includes additional utilities like a GitHub folder downloader, CLI/formatter helpers, and virtual environment management.
Whether you're preparing a new project or just want a clean setup for your next internal tool — pkgcreator automates the boilerplate and saves you time.
Developed and maintained by Philipp Meder.
- Source code: https://github.com/PhilippMeder/pkgcreator.git
- Report bugs: https://github.com/PhilippMeder/pkgcreator/issues
Quick overview:
- Quick Start
- License
- Features (most interesting part)
- Requirements and Dependencies
Quick Start
Install this package (replace pkgcreator with pkgcreator[full] to install all optional dependencies on Python packages):
pip install pkgcreator
Create a new package structure, initialise Git, create a virtual environment, and include the MIT license:
pkgcreator create mypackage --git --venv --license MIT
For a detailed list of available options, see the section Package Structure Creator.
License
Distributed under the BSD 3-Clause License.
Features
Following features are covered here, with focus on the main feature Package Structure Creator.
- Package Structure Creator
- Accessing Git with Python
- GitHub Downloader
- Creating and Managing Virtual Environments
- Tools
To use the core features, you may directly call one of the two following lines:
pkgcreator [OPTIONS]
python -m pkgcreator [OPTIONS]
For a list of available options, see the next sections or run:
pkgcreator --help
Package Structure Creator
Create a typical file structure for a python package with the necessary files and their content.
Creating the package structure
Running pkgcreator create <NAME> will create the following package structure as officially recommended:
NAMEsrc/NAME__init__.py__main__.py(if the--scriptoption is used)
.gitignore(with some presets)LICENSE(with content if the-l, --license>option is used)pyproject.toml(with content according to the options used, see--help)README.md(with content according to the options used, see--help)
For a list of available options, read the next sections or run:
pkgcreator create --help
Configuring the creation process and adding Git/venv
There are several important options you may consider when creating the package structure:
-
Adding a license text with
--license <LICENSE>:Using the
-l, --license <LICENSE>option allows you to add the text of<LICENSE>if this is a valid identifier. To list all available identifiers, use--list-licenses. This option requires the python packagerequestsand will fail if it is not installed. -
Initialising a Git repository with
--git:If
Gitis available on your system, using the--gitoption automatically initialises a Git repository and commits all created files. -
Creating a virtual environment with
--venv:Using the
--venvoption automatically creates a virtual environment inNAME/.venv(ignored byGit) and installs the created package in editable mode so you can run it aspython -m <NAME>or import it withimport <NAME>inside the activated environment. -
Providing the package as a script with
--script:Using the
--scriptoption will create a__main__.pywith functionmain()that is called whenever you run the package as a module (python -m <NAME>). In addition, thepyproject.tomlregisters the terminal command<NAME>that will also call this function.
Using preselections and suggestions
If not explicitly set, some arguments will suggest values based on context:
--github-repositorynamemay suggest using the package name--author-namemay suggest usinguser.namefromgit config, if available--author-mailmay suggest usinguser.emailfromgit config, if available--gitmay ask whether to initialise a Git repository--venvmay ask whether to initialise a virtual environment and install the package in editable mode
Use the -m, --prompt-mode option to control whether these suggestions are shown or automatically handled:
| Option | yes |
auto |
no |
|---|---|---|---|
--github-repositoryname |
✅ | ✅ | ❌ |
--author-name |
✅ | ✅ | ❌ |
--author-mail |
✅ | ✅ | ❌ |
--git |
✅ | ❌ | ❌ |
--venv |
✅ | ❌ | ❌ |
yes: Automatically accept all suggestionsno: Skip all prompts and use defaults or leave unsetauto: Accept safe suggestions only (e.g., use Git info, but skip Git initialisation)ask(default): Prompt interactively for each case, and ask again before creating the project structure
Configuring project settings
There are a bunch of variables that are used for the creation of the pyproject.toml, README.md, and LICENSE (if -l is used).
These can be changed later in the mentioned files.
Available options are (the names are self-explanatory):
| Option | Notes |
|---|---|
--description |
|
--author-name |
suggests git config user.name if not set |
--author-mail |
suggests git config user.email if not set |
--github-username |
used for various project URLs (if not provided) |
--github-repositoryname |
used for various project URLs (if not provided), suggests the package name if not set |
In addition, a typical package also links to some of its online resources.
If not set, each of them will link to a subpage of the github repository defined by --github-username and --github-repositoryname.
--changelog--documentation--download--funding--homepage--issues--releasenotes--source
If some dependencies, optional dependencies or classifiers (for PyPI) are already known, they can be set with the following commands:
--dependencies package1 package2 ...--optional-dependencies package1 package2 ...(available as a[full]option during package installation)--classifiers classifier1 classifier2 ...(for a full list see PyPI classifier)
Accessing Git with Python
This feature is provided for completeness since it is used as a handy tool during the package structure creation process. You may run
pkgcreator git --help
to list the available options. However, running Git directly is usually more flexible and preferred.
GitHub Downloader
Download a specific folder (or the entire contents) from a public GitHub repository using the GitHub API.
Python version
Features:
- Downloads a subfolder or the full repository
- Supports branch selection
- Recursive or non-recursive download
Usage:
To download the repository contents (default branch main), run:
pkgcreator github-download <OWNER> <REPOSITORY> [OPTIONS]
Available options are (run pkgcreator github-download --help for a full list):
-b, --branchSelects the branch name (default: main).-s, --subfolderIf not provided, download the full repository. If set to a subdirectory of the repository, download this subdirectory. If set to a single file, only download this file.-d, --destinationLocal directory where the files should be downloaded to (default: ./downloaded_).-n, --no-recursiveDo not download folders recursively.--listList the content of the repository (or the given subfolder) and exit.
Note: The GitHub API limits the number of requests per time period. For more information see the Rate limits for the REST API.
Bash version
For completeness, a bash version is provided.
Located in: github_download.sh
Features:
- Uses
git sparse-checkoutto efficiently fetch only a folder - Minimal download size, ideal for large repositories
Usage:
./github_download.sh ExampleOwner example_repo main ./target_folder subdir/in/repo
Arguments:
<owner> <repo> [branch=main] [target_dir=<repo>_sparse] [folder=None]
If no folder is specified, the full repository is checked out.
Creating and Managing Virtual Environments
The command
pkgcreator venv [OPTIONS]
can create a virtual environment and install packages in this environment.
Available options are (run pkgcreator github-download --help for a full list):
-d, --destinationDirectory where the venv folder will be created (default: current working directory).-c, --createCreate the virtual environment.-i, --installList of packages to install (via pip).-e, --editableList of packages/local package paths to install in editable mode (-e).--nameName of the virtual environment folder (default: .venv).--version-suffixAppend Python major/minor version to the venv folder name.
Tools
In addition to the main features, also some useful tools that were written for the functionality of this package are available.
Logging tools
LoggerFormatterprovides a formatter that is a subclass of the standard library'slogging.Formatter. The logger messages will be color coded and start with[Error], [Warning], [Info]depending on the message type.logged_subprocess_runprovides a wrapper aroundsubprocess.runwhere the output feed of the process is streamed live to the given logger.
To use these features and understand their parameters, run:
from pkgcreator.logging_tools import LoggerFormatter, logged_subprocess_run
help(LoggerFormatter)
help(logged_subprocess_run)
CLI tools
ConsistentFormatterprovides anargparse.HelpFormatterthat aims at a consistent appearance. It enforces capitalization and periods where needed.generate_parser_templategenerates a template Python function that consistently creates anargparse.Argparserthat is either a standalone or a subparser.
To use these features and understand their parameters, run:
from pkgcreator.cli_tools import ConsistentFormatter, generate_parser_template
help(ConsistentFormatter)
help(generate_parser_template)
Requirements and Dependencies
Following requirements must be satisfied:
Python 3.10+(developed withPython 3.13, tested withPython 3.10+, lower version are not working due to the use ofmatch ... caseandUnion)
Following optional dependencies are recommended, but not required:
requestslibrary (for Python GitHub downloader and license selection/download)Git(for sparse-checkout Bash script or if you want to initialise a Git repository when creating a Python package)
To install Python dependencies you may either use
pip install DEPENDENCY
or directly specify that you want to install all optional dependencies when installing this package with:
pip install pkgcreator[full]
Metadata
Release files for pkgcreator 0.1.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pkgcreator-0.1.0.post1.tar.gz | 40.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pkgcreator-0.1.0.post1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.3 kB
Release files / pkgcreator-0.1.0.post1.tar.gz
| Download URL | pkgcreator-0.1.0.post1.tar.gz |
|---|---|
| Size | 40.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46a2e72d25dcad45fa70221f74abea4d5515cb274a218c0c67a75cb98a44144d
|
|
BLAKE2b-256 checksum How to use checksums |
6c6c1520f5e8d858c06ab3aa33f98ca16a3d4c364c85bcd047f4527d78bd7fc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2025.
Transparency logRelease files / pkgcreator-0.1.0.post1-py3-none-any.whl
| Download URL | pkgcreator-0.1.0.post1-py3-none-any.whl |
|---|---|
| Size | 37.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3a197aef4e41dfd1c3e82ed8fa82f860911673c787ed6a2301b0d100d4ee18c
|
|
BLAKE2b-256 checksum How to use checksums |
58b8f32e28ee65ba5fb1279da94c1c6b87403b9029f06b64d37f78b0d9d29f4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2025.
Transparency log