Skip to main content

AI-powered configuration file generator for developers with natural language processing and context-aware generation

Project description

py-config-ai

PyPI version Python 3.8+ License: MIT

๐Ÿง  AI-powered configuration file generator for developers

Author: Sherin Joseph Roy
GitHub: https://github.com/Sherin-SEF-AI/py-config-ai
Email: sherin.joseph2217@gmail.com

Generate configuration files like .prettierrc, .eslintrc, pyproject.toml, black, ruff, flake8, and more using AI providers (OpenAI, Claude, Gemini, Groq). Simply describe your preferences in natural language and let AI create the perfect configuration for your project.

โœจ Features

  • ๐Ÿค– Multiple AI Providers: Support for OpenAI, Anthropic Claude, Google Gemini, and Groq
  • ๐Ÿ” Secure Key Management: Encrypted storage of API keys using keyring
  • ๐Ÿ“ Rich CLI Interface: Beautiful, interactive command-line interface with Rich
  • ๐ŸŽฏ Smart Presets: Pre-built configurations for common project types (FastAPI, Django, React, etc.)
  • ๐Ÿ”ง Extensive Config Support: 15+ configuration types including Python, JavaScript, Docker, and more
  • ๐Ÿ’ฌ Natural Language: Describe your needs in plain English
  • ๐ŸŽจ Interactive Mode: Guided setup with prompts and previews
  • ๐Ÿงช Connection Testing: Verify your AI provider setup

๐Ÿš€ Quick Start

1. Install the package

pip install py-config-ai

2. Add your API key

py-config-ai add-key groq your-api-key-here

3. Generate configurations using natural language!

Simple natural language commands:

# Generate a Python formatter config
py-config-ai create "I want to format Python code with 88 character line length"

# Create a React prettier config
py-config-ai create "Generate a prettier config for a React project with 2 spaces"

# Create a Docker setup
py-config-ai create "Create a dockerfile for a Python FastAPI application"

# Generate a gitignore
py-config-ai create "Create a gitignore file for a Python project with virtual environments"

Interactive guided mode:

py-config-ai generate --interactive

Traditional command-line mode:

py-config-ai generate --type black --description "100 character line length with strict formatting"

โœจ Key Features

๐Ÿง  Natural Language Integration

  • Describe what you want in plain English - no need to know exact config names
  • Smart configuration type detection - automatically identifies the right config type
  • Conversational interface - guided prompts with helpful examples
  • Context-aware generation - understands your project structure

๐Ÿ“ Automatic File Management

  • Smart file naming - automatically saves with correct extensions
  • No more copy-paste - files are saved directly to disk
  • Ready to edit - open files immediately in your preferred editor
  • Proper file extensions - .toml, .json, .conf, etc.

๐Ÿ” Context-Aware Generation

  • Project structure analysis - understands your codebase layout
  • Framework detection - recognizes Django, Flask, React, Next.js, etc.
  • File type counting - knows how many Python, JS, TS files you have
  • Existing config detection - builds upon your current setup
  • Directory-aware patterns - includes relevant exclusions and includes

๐Ÿ”ง Multiple AI Providers

  • OpenAI (GPT-4, GPT-3.5-turbo)
  • Anthropic Claude (Claude-3-Sonnet, Claude-3-Haiku)
  • Google Gemini (Gemini-1.5-Pro)
  • Groq (Llama3-8b-8192)

๐Ÿ›ก๏ธ Security & Quality

  • Secure API key storage using keyring with fallback
  • Input validation for all user inputs
  • Comprehensive error handling
  • Type hints throughout the codebase

๐Ÿ“‹ Supported Configuration Types

Python

  • pyproject.toml - Python project configuration (PEP 518)
  • black - Code formatter
  • isort - Import sorter
  • ruff - Fast linter and formatter
  • flake8 - Style guide enforcement
  • pylint - Static code analysis
  • mypy - Static type checker

JavaScript/TypeScript

  • .prettierrc - Code formatter
  • .eslintrc - Linter
  • tsconfig.json - TypeScript compiler

Other

  • markdownlint.json - Markdown linter
  • stylelint - CSS/SCSS linter
  • dockerfile - Docker container
  • .env - Environment variables
  • docker-compose.yml - Multi-container setup
  • nginx.conf - Web server
  • gitignore - Git ignore patterns

๐ŸŽฏ Available Presets

  • fastapi - FastAPI web application with modern Python tooling
  • django - Django web application with comprehensive tooling
  • react - React application with modern JavaScript tooling
  • node - Node.js application with modern JavaScript tooling
  • python-library - Python library with comprehensive development tooling

๐Ÿ› ๏ธ CLI Commands

Natural Language Generation

# Simple natural language commands
py-config-ai create "I want to format Python code with 88 character line length"
py-config-ai create "Generate a prettier config for a React project"
py-config-ai create "Create a dockerfile for a Python FastAPI application"

# With custom output file
py-config-ai create "Generate an ESLint config" --output .eslintrc.json

# With context (analyzes your project structure)
py-config-ai create "Create a gitignore for a Python project" --context .
py-config-ai create "Generate pyproject.toml for this package" --context .
py-config-ai create "Create Docker setup for this FastAPI app" --context .

Traditional Generation

# Interactive mode
py-config-ai generate --interactive

# Generate specific config
py-config-ai generate --type black --description "100 char line length, strict formatting"

# Use preset
py-config-ai generate --preset fastapi

# With context
py-config-ai generate --type .eslintrc --context ./src --description "React project with TypeScript"

# Show preview before saving
py-config-ai generate --type .prettierrc --preview --output .prettierrc.json

API Key Management

# Add API key
py-config-ai add-key openai
py-config-ai add-key anthropic
py-config-ai add-key gemini
py-config-ai add-key groq

# List configured keys
py-config-ai list-keys

# Remove key
py-config-ai remove-key openai

Information Commands

# List supported config types
py-config-ai list

# List available presets
py-config-ai presets

# Test provider connection
py-config-ai test --provider openai

๐Ÿ”ง Configuration Examples

Black Configuration

py-config-ai generate --type black --description "Use 100 character line length, target Python 3.9+, and exclude tests directory"

ESLint Configuration

py-config-ai generate --type .eslintrc --description "React project with TypeScript, use Airbnb style guide, and allow console.log in development"

Dockerfile

py-config-ai generate --type dockerfile --description "Python 3.11 slim image for FastAPI app, expose port 8000, use uvicorn"

๐Ÿ—๏ธ Project Structure

py-config-ai/
โ”œโ”€โ”€ src/py_config_ai/
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ generator.py      # Main configuration generator
โ”‚   โ”‚   โ””โ”€โ”€ key_manager.py    # Secure API key management
โ”‚   โ”œโ”€โ”€ providers/
โ”‚   โ”‚   โ”œโ”€โ”€ base.py          # Abstract provider interface
โ”‚   โ”‚   โ”œโ”€โ”€ openai_provider.py
โ”‚   โ”‚   โ”œโ”€โ”€ anthropic_provider.py
โ”‚   โ”‚   โ”œโ”€โ”€ gemini_provider.py
โ”‚   โ”‚   โ””โ”€โ”€ groq_provider.py
โ”‚   โ”œโ”€โ”€ configs/
โ”‚   โ”‚   โ”œโ”€โ”€ config_types.py  # Supported configuration types
โ”‚   โ”‚   โ””โ”€โ”€ presets.py       # Pre-built configurations
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”œโ”€โ”€ file_utils.py    # File operations
โ”‚   โ”‚   โ””โ”€โ”€ validation.py    # Input validation
โ”‚   โ”œโ”€โ”€ templates/           # Configuration templates
โ”‚   โ””โ”€โ”€ cli.py              # Command-line interface
โ”œโ”€โ”€ tests/                  # Test suite
โ”œโ”€โ”€ docs/                   # Documentation
โ””โ”€โ”€ pyproject.toml         # Package configuration

๐Ÿ”’ Security

  • API keys are stored securely using the keyring library
  • Fallback to encrypted local storage if keyring is unavailable
  • No keys are logged or transmitted unnecessarily
  • Input validation for all user-provided data

๐Ÿงช Testing

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=py_config_ai

# Run linting
black src/
isort src/
flake8 src/
mypy src/

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

# Clone the repository
git clone https://github.com/your-username/py-config-ai.git
cd py-config-ai

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Sherin Joseph Roy - Startup Founder & Hardware/IoT Enthusiast

About the Author

Sherin is a startup founder and hardware/IoT enthusiast passionate about building innovative solutions that bridge the gap between hardware and software. With expertise in autonomous systems, robotics, and AI, Sherin has developed multiple open-source packages on PyPI and is focused on creating intelligent machines that think and act independently.

Specializations:

  • Autonomous Systems & Self-Driving Vehicles
  • Robotics & Computer Vision
  • IoT & Embedded Systems
  • Hardware Design & Development
  • AI/ML & Machine Learning
  • Cybersecurity & Ethical Hacking

๐Ÿ™ Acknowledgments

  • Typer for the beautiful CLI framework
  • Rich for the stunning terminal output
  • Halo for the loading spinners
  • All the AI providers for their amazing APIs

๐Ÿ“ž Support


Made with โค๏ธ for developers who want to focus on code, not configuration.

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

py_config_ai-1.0.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

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

py_config_ai-1.0.0-py3-none-any.whl (32.8 kB view details)

Uploaded Python 3

File details

Details for the file py_config_ai-1.0.0.tar.gz.

File metadata

  • Download URL: py_config_ai-1.0.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for py_config_ai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4d761392ae9448fe907f18f0bcaf36f1310f9d156250d54c7109aa8b5ce5e6f8
MD5 eae6b53f823f4f3e1facc2c8fc68f181
BLAKE2b-256 b0d5039b2b8ade8f2ee932375ed3c88786836cf8bb4694035316985a357955f5

See more details on using hashes here.

File details

Details for the file py_config_ai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: py_config_ai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for py_config_ai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e983788fe9a110b3381947bb7b75b70188e2d0792fc1510107a5745e81565a0
MD5 f1e91d82a2ee4e19dce3a8031905a0f5
BLAKE2b-256 17f25592e6e2de66053a9ec2716a70d73102a51dea13a4065081e5ea86f98642

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