Skip to main content

CLI to scaffold a default Python service structure

Project description

๐Ÿš€ PyServInit - Project Bootstrapper

pyservinit is a Python-based utility script for initializing a backend project with a standardized structure. It creates directories, touches empty boilerplate files, and copies template files into a new project folder.

๐Ÿ“ฆ Features

  • Creates a structured directory tree for a new project.
  • Populates essential files (Dockerfile, docker-compose.yaml, main.py, etc.).
  • Loads content from .template files bundled in pyservinit.templates.
  • Automatically sets executable permissions for shell scripts.
  • Easy to use via command line.

๐Ÿ“ Project Structure Created

<project-name>/
โ”œโ”€โ”€ docker-compose.yaml
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ push.sh
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ request_data/
โ”‚   โ””โ”€โ”€ sample_data/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ api.py
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ constants.py
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ mapper_classes/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ input_classes.py
โ”‚   โ”‚   โ””โ”€โ”€ output_classes.py
โ”‚   โ”œโ”€โ”€ misc/
โ”‚   โ”œโ”€โ”€ tests/
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ””โ”€โ”€ utils.py

๐Ÿ›  Usage

python path/to/pyservinit.py <project-name>

Example:

python pyservinit.py my-backend-service

If my-backend-service already exists, the script will abort to prevent overwriting.


๐Ÿ“„ Templates

The script relies on templates stored in pyservinit.templates (an importable Python package resource).

Files like these are included:

  • Dockerfile.template
  • main.py.template
  • push.sh.template
  • etc.

You can add more .template files to the pyservinit/templates/ directory and either:

  • Map them explicitly in DESTINATION_MAP
  • Or have them default to src/misc/<template-name> after removing .template

๐Ÿงฉ Dependencies

Ensure pyservinit.templates is installed or accessible as a Python package.

๐Ÿ“Œ Notes

  • It is suitable for backend services in microservice-style architectures or for setting up ML inference services.
  • Shell script files (e.g., push.sh) are made executable automatically by the script.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyservinit-0.1.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyservinit-0.1.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pyservinit-0.1.3.tar.gz.

File metadata

  • Download URL: pyservinit-0.1.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pyservinit-0.1.3.tar.gz
Algorithm Hash digest
SHA256 392cc2eaef17e240cbc61f6afbad8c68ea6aea0de51b9a0eaa14abc31a9a4ad4
MD5 28ef8c8dff4a611563116c231389b8e5
BLAKE2b-256 206dc0ac0e3fb85f0c91938f1d11e7d54340f07eabd2f5bdf49b392bc06c3bc5

See more details on using hashes here.

File details

Details for the file pyservinit-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pyservinit-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pyservinit-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 19f87d707ef9d319470ffb6e006ba495ce2e2ecb7d71c5dfdc9eabe5ccfd7e47
MD5 2066dd759725028578d33dc1544f58fc
BLAKE2b-256 4ce231d5ced68fcbf20476574d84038480c53b05def3b08ed4561b109ae847e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page