Skip to main content

A CLI tool to initialize Python projects with a standard structure.

Project description

Spider CLIGEN Documentation

Overview

The Spider CLIGEN is a command-line tool that helps developers quickly set up different types of Python projects, including packages, web applications, mobile apps, and more. It automates the creation of project structures, virtual environments, and essential files such as README.md, .gitignore, LICENSE, and CI workflow files for services like GitHub Actions, GitLab CI, and CircleCI.

Main Features:

  • Create project structure based on different types of Python projects.
  • Support for multiple license types (MIT, GPLv3, Apache, BSD 3-Clause, CC0).
  • Automates the creation of a virtual environment and installation of dependencies.
  • Generates configuration files for popular CI services.
  • Automatically generates essential files like README.md, .gitignore, LICENSE, and more.

Usage

The CLI provides the following commands:

  • startproject: Initialize a new project structure.
  • project-types: Display the supported project types.
$ python spider_cligen.py startproject

Project Structure Creation

Function: create_project_structure

def create_project_structure(project_type, project_name, license_type, project_owner, owner_email, ci_service):

Parameters:

  • project_type: The type of project (e.g., package, web, api).
  • project_name: The name of the project.
  • license_type: The type of license to be included (e.g., mit, gplv3, apache).
  • project_owner: Name of the project owner/author.
  • owner_email: Email of the project owner.
  • ci_service: Continuous Integration service to be configured (e.g., github, gitlab, circleci).

Raises:

  • ProjectTypeNotExitsError: Raised when the provided project type is not supported.
  • ContinousIntegrationServiceError: Raised if the CI service is not supported.
  • VenvCreateError: Raised if the virtual environment cannot be created.
  • RequirementsInstallationError: Raised if requirements cannot be installed.
  • CreateProjectStructureError: Raised if the project structure creation fails.

File and Path Creation

Function: create_readme

def create_readme(path, project_name):

Creates a README.md file for the project with the project name.

Function: create_requirements

def create_requirements(path):

Prompts the user for required packages and creates a requirements.txt file.

Function: create_gitignore

def create_gitignore(path):

Generates a .gitignore file based on predefined templates.

Function: create_lincense

def create_lincense(path, license_type, project_owner=None):

Generates a LICENSE file based on the specified license type (e.g., MIT, GPLv3, Apache, BSD 3-Clause, CC0).

Function: create_manifest

def create_manifest(path):

Creates a MANIFEST.in file for Python package projects.

Virtual Environment and Dependencies

Function: create_venv

def create_venv(path):

Creates a Python virtual environment in the project directory.

Function: install_requirements

def install_requirements(path):

Installs the required dependencies from the requirements.txt file in the virtual environment.

CI Workflow Files

Function: create_workflows_path

def create_workflows_path(project_path, service=DEFAULT_CI_SERVICE):

Generates CI workflow files for services like GitHub Actions, GitLab CI, and CircleCI.

License Generation

  • MIT License: generate_mit_license(project_owner)
  • GPLv3 License: generate_gplv3_license(project_owner)
  • Apache License: generate_apache_license(project_owner)
  • BSD 3-Clause License: generate_bsd3_license(project_owner)
  • CC0 License: generate_cco_license(project_owner)

Command-Line Interface (CLI)

Function: main

def main():

This is the main entry point for the CLI. It uses argparse to handle commands:

  • startproject: Prompts the user for details to create a new project.
  • project-types: Displays supported project types.

Example

# Start a new project
$ python spider_cligen.py startproject

# Show supported project types
$ python spider_cligen.py project-types

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

spider_cligen-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

spider_cligen-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file spider_cligen-0.1.0.tar.gz.

File metadata

  • Download URL: spider_cligen-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for spider_cligen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2e6575071c5d6838e4cbac8209071b709383eb04d7f1ded52eba104765ee03f
MD5 bc3d7e9fa4806e7228fdd43a57776c89
BLAKE2b-256 8a6642f5bc20bbc89c2774fd10be0e824be76ab635a354ad73746d552b81f6e6

See more details on using hashes here.

File details

Details for the file spider_cligen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: spider_cligen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for spider_cligen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c50d57b5fb246f814e91cdb5734ec940aa010d0f3d3016df505d69b165eee539
MD5 2664d54795d4eca0414f849dc02d0569
BLAKE2b-256 484af24bdaf85135accf28ba9c92f2d4487e398e2de1013f26226198f5772c6c

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