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.1.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.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spider_cligen-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 9b05a2d794496b0bc17f33e84f9ebd3f669065dfa29e8654a97d02ac88e75ead
MD5 2adcc556802da10dbb98f838639a74d4
BLAKE2b-256 fa69319151594d05ad7f19150da68c7ea1b56e1f94aab8f7922be57b591b69a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spider_cligen-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45c52c4fc897611ee3c4939d77c1d2729684a9a47a71615259ec249f6020eff9
MD5 cfcf9b3c70705932d646e9865615793b
BLAKE2b-256 0360cc619f77ec76f54da8dd28f4dd2da2ba7a4c4c7a92e1b8a480acf2635ad4

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