chore: add LICENSE, PR guidelines, README, and pyproject.toml files
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 wawahuy
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+365
@@ -0,0 +1,365 @@
|
||||
# Pull Request Guidelines
|
||||
|
||||
## 📋 Overview
|
||||
|
||||
This document outlines the standards and processes for contributing to ComfyUI-HTTP. Following these guidelines ensures code quality, maintainability, and smooth collaboration.
|
||||
|
||||
## 🔄 Pull Request Process
|
||||
|
||||
### 1. Before Creating a PR
|
||||
|
||||
- **Fork and Clone**: Fork the repository and clone it locally
|
||||
- **Branch Strategy**: Create a feature branch from `main`
|
||||
```bash
|
||||
git checkout -b feature/your-feature-name
|
||||
# or
|
||||
git checkout -b fix/issue-description
|
||||
# or
|
||||
git checkout -b docs/documentation-update
|
||||
```
|
||||
|
||||
- **Issue Reference**: Link your PR to an existing issue when applicable
|
||||
- **Environment Setup**: Ensure you have the development environment properly configured
|
||||
|
||||
### 2. Branch Naming Convention
|
||||
|
||||
Use descriptive branch names following this pattern:
|
||||
|
||||
- `feature/add-http-auth-support` - For new features
|
||||
- `fix/memory-leak-in-http-client` - For bug fixes
|
||||
- `docs/update-api-documentation` - For documentation updates
|
||||
- `refactor/improve-error-handling` - For code refactoring
|
||||
- `test/add-integration-tests` - For test additions
|
||||
- `chore/update-dependencies` - For maintenance tasks
|
||||
|
||||
### 3. Code Standards
|
||||
|
||||
#### Code Quality Requirements
|
||||
|
||||
- **Type Hints**: All functions must include proper type hints
|
||||
- **Docstrings**: Use Google-style docstrings for all public methods
|
||||
- **Error Handling**: Implement comprehensive error handling with meaningful messages
|
||||
- **Logging**: Use appropriate logging levels for debugging and monitoring
|
||||
|
||||
#### Example Code Structure
|
||||
|
||||
```python
|
||||
from typing import Dict, Any, Optional
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class HTTPGetNode:
|
||||
"""HTTP GET node for ComfyUI workflows.
|
||||
|
||||
This node performs HTTP GET requests and returns the response data
|
||||
for use in ComfyUI workflows.
|
||||
|
||||
Attributes:
|
||||
timeout: Request timeout in seconds
|
||||
max_retries: Maximum number of retry attempts
|
||||
"""
|
||||
|
||||
def __init__(self, timeout: int = 30, max_retries: int = 3) -> None:
|
||||
"""Initialize the HTTP GET node.
|
||||
|
||||
Args:
|
||||
timeout: Request timeout in seconds
|
||||
max_retries: Maximum number of retry attempts
|
||||
|
||||
Raises:
|
||||
ValueError: If timeout or max_retries are invalid
|
||||
"""
|
||||
if timeout <= 0:
|
||||
raise ValueError("Timeout must be positive")
|
||||
|
||||
self.timeout = timeout
|
||||
self.max_retries = max_retries
|
||||
|
||||
def execute(self, url: str, headers: Optional[Dict[str, str]] = None) -> Dict[str, Any]:
|
||||
"""Execute HTTP GET request.
|
||||
|
||||
Args:
|
||||
url: Target URL for the request
|
||||
headers: Optional HTTP headers
|
||||
|
||||
Returns:
|
||||
Dictionary containing response data and metadata
|
||||
|
||||
Raises:
|
||||
requests.RequestException: If the request fails
|
||||
ValueError: If URL is invalid
|
||||
"""
|
||||
# Implementation here
|
||||
pass
|
||||
```
|
||||
|
||||
### 4. Testing Requirements
|
||||
|
||||
#### Mandatory Tests
|
||||
|
||||
- **Unit Tests**: Cover all new functions and methods
|
||||
- **Integration Tests**: Test HTTP endpoints and workflows
|
||||
- **Error Cases**: Test error conditions and edge cases
|
||||
- **Performance Tests**: For performance-critical code
|
||||
|
||||
#### Test Structure
|
||||
|
||||
```python
|
||||
import pytest
|
||||
from unittest.mock import Mock, patch
|
||||
from your_module import HTTPGetNode
|
||||
|
||||
class TestHTTPGetNode:
|
||||
"""Test suite for HTTPGetNode."""
|
||||
|
||||
def setup_method(self):
|
||||
"""Set up test fixtures."""
|
||||
self.node = HTTPGetNode(timeout=30)
|
||||
|
||||
def test_execute_success(self):
|
||||
"""Test successful HTTP GET request."""
|
||||
# Test implementation
|
||||
pass
|
||||
|
||||
def test_execute_timeout(self):
|
||||
"""Test request timeout handling."""
|
||||
# Test implementation
|
||||
pass
|
||||
|
||||
@pytest.mark.parametrize("invalid_url", ["", "not-a-url", None])
|
||||
def test_execute_invalid_url(self, invalid_url):
|
||||
"""Test handling of invalid URLs."""
|
||||
# Test implementation
|
||||
pass
|
||||
```
|
||||
|
||||
### 5. Documentation Requirements
|
||||
|
||||
- **README Updates**: Update README.md if adding new features
|
||||
- **Code Comments**: Comment complex logic and algorithms
|
||||
- **API Documentation**: Document public interfaces
|
||||
- **Examples**: Provide usage examples for new features
|
||||
|
||||
### 6. Commit Message Standards
|
||||
|
||||
Follow [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
||||
|
||||
```
|
||||
<type>[optional scope]: <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer(s)]
|
||||
```
|
||||
|
||||
#### Examples:
|
||||
|
||||
```
|
||||
feat(http): add authentication support for HTTP requests
|
||||
|
||||
- Add support for Bearer token authentication
|
||||
- Add support for Basic authentication
|
||||
- Update documentation with auth examples
|
||||
|
||||
Closes #123
|
||||
```
|
||||
|
||||
```
|
||||
fix(image): resolve memory leak in image processing
|
||||
|
||||
The image conversion was not properly releasing memory after processing
|
||||
large images. This fix ensures proper cleanup of PIL Image objects.
|
||||
|
||||
Fixes #456
|
||||
```
|
||||
|
||||
```
|
||||
docs(readme): update installation instructions
|
||||
|
||||
- Add pip installation method
|
||||
- Update ComfyUI integration steps
|
||||
- Fix broken links in documentation
|
||||
```
|
||||
|
||||
#### Commit Types:
|
||||
|
||||
- `feat`: New feature
|
||||
- `fix`: Bug fix
|
||||
- `docs`: Documentation only changes
|
||||
- `style`: Code style changes (formatting, semicolons, etc.)
|
||||
- `refactor`: Code refactoring
|
||||
- `test`: Adding or updating tests
|
||||
- `chore`: Maintenance tasks
|
||||
- `perf`: Performance improvements
|
||||
- `ci`: CI/CD changes
|
||||
|
||||
### 7. PR Description Template
|
||||
|
||||
Use this template for your PR description:
|
||||
|
||||
```markdown
|
||||
## Description
|
||||
Brief description of changes made.
|
||||
|
||||
## Type of Change
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Documentation update
|
||||
- [ ] Performance improvement
|
||||
- [ ] Code refactoring
|
||||
|
||||
## Related Issues
|
||||
Closes #(issue number)
|
||||
Relates to #(issue number)
|
||||
|
||||
## Changes Made
|
||||
- List of specific changes
|
||||
- Use bullet points
|
||||
- Be descriptive but concise
|
||||
|
||||
## Testing
|
||||
- [ ] Unit tests pass
|
||||
- [ ] Integration tests pass
|
||||
- [ ] Manual testing completed
|
||||
- [ ] Performance impact assessed
|
||||
|
||||
## Screenshots/Examples
|
||||
If applicable, add screenshots or code examples.
|
||||
|
||||
## Checklist
|
||||
- [ ] My code follows the project's style guidelines
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
```
|
||||
|
||||
### 8. Review Process
|
||||
|
||||
#### Automated Checks
|
||||
|
||||
All PRs must pass:
|
||||
- **Code Formatting**: Black, isort
|
||||
- **Linting**: Flake8, MyPy
|
||||
- **Tests**: pytest with minimum 80% coverage
|
||||
- **Security**: Security scanning tools
|
||||
|
||||
#### Manual Review
|
||||
|
||||
- **Code Quality**: Architecture, design patterns, best practices
|
||||
- **Performance**: Impact on existing functionality
|
||||
- **Security**: Potential security vulnerabilities
|
||||
- **Documentation**: Clarity and completeness
|
||||
- **Backward Compatibility**: Breaking changes assessment
|
||||
|
||||
#### Review Criteria
|
||||
|
||||
**Approve Criteria:**
|
||||
- All automated checks pass
|
||||
- Code meets quality standards
|
||||
- Adequate test coverage
|
||||
- Proper documentation
|
||||
- No security concerns
|
||||
|
||||
**Request Changes Criteria:**
|
||||
- Failing tests or checks
|
||||
- Poor code quality
|
||||
- Insufficient documentation
|
||||
- Security vulnerabilities
|
||||
- Breaking changes without justification
|
||||
|
||||
### 9. Merging Guidelines
|
||||
|
||||
#### Merge Requirements
|
||||
|
||||
- ✅ All CI checks pass
|
||||
- ✅ At least one approving review from maintainer
|
||||
- ✅ No unresolved conversations
|
||||
- ✅ Branch is up to date with main
|
||||
- ✅ All requested changes addressed
|
||||
|
||||
#### Merge Strategy
|
||||
|
||||
- **Squash and Merge**: For feature branches (default)
|
||||
- **Merge Commit**: For release branches
|
||||
- **Rebase and Merge**: For hotfixes (when appropriate)
|
||||
|
||||
### 10. Release Process
|
||||
|
||||
#### Version Numbering
|
||||
|
||||
Follow [Semantic Versioning](https://semver.org/):
|
||||
- `MAJOR.MINOR.PATCH`
|
||||
- `MAJOR`: Breaking changes
|
||||
- `MINOR`: New features (backward compatible)
|
||||
- `PATCH`: Bug fixes (backward compatible)
|
||||
|
||||
#### Release Workflow
|
||||
|
||||
1. **Create Release Branch**: `release/v1.2.0`
|
||||
2. **Update Version**: Update version in `pyproject.toml`
|
||||
3. **Update Changelog**: Document all changes
|
||||
4. **Create Release PR**: Merge to main
|
||||
5. **Tag Release**: Create git tag
|
||||
6. **Publish**: Publish to package registries
|
||||
|
||||
### 11. Contribution Recognition
|
||||
|
||||
All contributors are recognized in:
|
||||
- **Contributors List**: GitHub contributors page
|
||||
- **Changelog**: Credit in release notes
|
||||
- **Documentation**: Acknowledgments section
|
||||
|
||||
### 12. Getting Help
|
||||
|
||||
- **Discussions**: Use GitHub Discussions for questions
|
||||
- **Issues**: Create issues for bugs or feature requests
|
||||
- **Documentation**: Check existing documentation first
|
||||
- **Code Review**: Ask for specific feedback in PR comments
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Development Setup
|
||||
|
||||
### Quick Start
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://github.com/wawahuy/ComfyUI-HTTP.git
|
||||
cd ComfyUI-HTTP
|
||||
|
||||
# Install development dependencies
|
||||
pip install -e ".[dev]"
|
||||
|
||||
# Install pre-commit hooks
|
||||
pre-commit install
|
||||
|
||||
# Run tests
|
||||
pytest
|
||||
|
||||
# Format code
|
||||
black .
|
||||
isort .
|
||||
|
||||
# Lint code
|
||||
flake8 .
|
||||
mypy .
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```bash
|
||||
# Optional: Set up environment variables
|
||||
export COMFYUI_HTTP_DEBUG=1
|
||||
export COMFYUI_HTTP_LOG_LEVEL=DEBUG
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Thank you for contributing to ComfyUI-HTTP! 🚀**
|
||||
|
||||
*This document is living and will be updated as the project evolves.*
|
||||
@@ -0,0 +1,399 @@
|
||||
# ComfyUI-HTTP
|
||||
|
||||
[](https://www.python.org/downloads/)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://github.com/psf/black)
|
||||
[](https://github.com/wawahuy/ComfyUI-HTTP/graphs/commit-activity)
|
||||
|
||||
**Professional HTTP integration nodes for ComfyUI workflows** - Transform your ComfyUI experience with seamless web API connectivity, enabling powerful automation and data exchange capabilities.
|
||||
|
||||
## Features
|
||||
|
||||
### Core HTTP Operations
|
||||
- **HTTP GET**: Fetch data from REST APIs with advanced parameter handling
|
||||
- **HTTP POST**: Send JSON, form data, and raw payloads with comprehensive options
|
||||
- **JSON Field Extraction**: Parse and extract specific fields from JSON responses
|
||||
- **Form Data Management**: Build complex multipart form data with files and images
|
||||
|
||||
### Image Processing Integration
|
||||
- **Base64 ↔ Image Conversion**: Seamlessly convert between image formats and base64 encoding
|
||||
- **File Upload Support**: Direct file and image uploads through HTTP requests
|
||||
- **Image Pipeline Integration**: Perfect integration with ComfyUI's image processing workflows
|
||||
|
||||
### Advanced Capabilities
|
||||
- **Performance Optimized**: Efficient HTTP client with connection pooling and timeouts
|
||||
- **Error Handling**: Robust error handling with detailed feedback and retry mechanisms
|
||||
- **Flexible Configuration**: Customizable headers, parameters, and request options
|
||||
- **Comprehensive Logging**: Detailed logging for debugging and monitoring
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Installation
|
||||
|
||||
#### Method 1: ComfyUI Manager (Recommended)
|
||||
1. Open ComfyUI Manager
|
||||
2. Search for "ComfyUI-HTTP"
|
||||
3. Click Install
|
||||
|
||||
#### Method 2: Manual Installation
|
||||
```bash
|
||||
cd ComfyUI/custom_nodes/
|
||||
git clone https://github.com/wawahuy/ComfyUI-HTTP.git
|
||||
cd ComfyUI-HTTP
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Basic Usage
|
||||
|
||||
Once installed, you'll find new HTTP nodes in your ComfyUI node menu:
|
||||
|
||||
- **HTTP Get** - Perform GET requests
|
||||
- **HTTP Post JSON** - Send JSON data
|
||||
- **HTTP Post Form Data** - Send form data with files
|
||||
- **HTTP Get JSON Field** - Extract JSON fields
|
||||
- **Base64 to Image** - Convert base64 to images
|
||||
- **Image to Base64** - Convert images to base64
|
||||
|
||||
## Documentation
|
||||
|
||||
### Node Reference
|
||||
|
||||
#### HTTP Get Node
|
||||
Performs HTTP GET requests with customizable parameters and headers.
|
||||
|
||||
**Inputs:**
|
||||
- `url` (string): Target URL
|
||||
- `headers` (string, optional): JSON-formatted headers
|
||||
- `params` (string, optional): JSON-formatted query parameters
|
||||
- `timeout` (int): Request timeout in seconds
|
||||
|
||||
**Outputs:**
|
||||
- `response` (string): Response body
|
||||
- `status_code` (int): HTTP status code
|
||||
- `headers` (string): Response headers
|
||||
|
||||
**Example:**
|
||||
```json
|
||||
{
|
||||
"url": "https://api.example.com/data",
|
||||
"headers": {
|
||||
"Authorization": "Bearer your-token",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"params": {
|
||||
"limit": 10,
|
||||
"page": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### HTTP Post JSON Node
|
||||
Sends JSON data via POST requests.
|
||||
|
||||
**Inputs:**
|
||||
- `url` (string): Target URL
|
||||
- `json_data` (string): JSON payload
|
||||
- `headers` (string, optional): Custom headers
|
||||
- `timeout` (int): Request timeout
|
||||
|
||||
**Outputs:**
|
||||
- `response` (string): Response body
|
||||
- `status_code` (int): HTTP status code
|
||||
|
||||
#### HTTP Post Form Data Node
|
||||
Handles multipart form data with file uploads.
|
||||
|
||||
**Inputs:**
|
||||
- `url` (string): Target URL
|
||||
- `form_data` (HTTPFormData): Form data object
|
||||
- `headers` (string, optional): Additional headers
|
||||
- `timeout` (int): Request timeout
|
||||
|
||||
#### Form Data Builder Nodes
|
||||
|
||||
##### HTTP Form Text Item
|
||||
Creates text form fields.
|
||||
|
||||
**Inputs:**
|
||||
- `name` (string): Field name
|
||||
- `value` (string): Field value
|
||||
|
||||
##### HTTP Form File Item
|
||||
Creates file upload fields.
|
||||
|
||||
**Inputs:**
|
||||
- `name` (string): Field name
|
||||
- `file_path` (string): Path to file
|
||||
- `mime_type` (string, optional): File MIME type
|
||||
|
||||
##### HTTP Form Image Item
|
||||
Creates image upload fields from ComfyUI images.
|
||||
|
||||
**Inputs:**
|
||||
- `name` (string): Field name
|
||||
- `image` (IMAGE): ComfyUI image tensor
|
||||
- `filename` (string): Filename for upload
|
||||
- `format` (string): Image format (PNG, JPEG, etc.)
|
||||
|
||||
#### Utility Nodes
|
||||
|
||||
##### HTTP Get JSON Field
|
||||
Extracts specific fields from JSON responses.
|
||||
|
||||
**Inputs:**
|
||||
- `json_data` (string): JSON string
|
||||
- `field_path` (string): Dot-notation field path (e.g., "data.items.0.name")
|
||||
|
||||
**Outputs:**
|
||||
- `value` (string): Extracted field value
|
||||
|
||||
##### Base64 to Image
|
||||
Converts base64 encoded images to ComfyUI image tensors.
|
||||
|
||||
**Inputs:**
|
||||
- `base64_string` (string): Base64 encoded image
|
||||
|
||||
**Outputs:**
|
||||
- `image` (IMAGE): ComfyUI image tensor
|
||||
|
||||
##### Image to Base64
|
||||
Converts ComfyUI images to base64 strings.
|
||||
|
||||
**Inputs:**
|
||||
- `image` (IMAGE): ComfyUI image tensor
|
||||
- `format` (string): Output format (PNG, JPEG)
|
||||
|
||||
**Outputs:**
|
||||
- `base64_string` (string): Base64 encoded image
|
||||
|
||||
### Workflow Examples
|
||||
|
||||
#### Example 1: API Data Fetching
|
||||
```json
|
||||
{
|
||||
"workflow": "Fetch user data from API",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "HTTP Get",
|
||||
"url": "https://jsonplaceholder.typicode.com/users/1",
|
||||
"headers": "{\"Accept\": \"application/json\"}"
|
||||
},
|
||||
{
|
||||
"type": "HTTP Get JSON Field",
|
||||
"field_path": "name"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Example 2: Image Upload to API
|
||||
```json
|
||||
{
|
||||
"workflow": "Upload generated image to API",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Image to Base64",
|
||||
"format": "PNG"
|
||||
},
|
||||
{
|
||||
"type": "HTTP Form Image Item",
|
||||
"name": "image",
|
||||
"filename": "generated.png"
|
||||
},
|
||||
{
|
||||
"type": "HTTP Post Form Data",
|
||||
"url": "https://api.example.com/upload"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Example 3: AI Service Integration
|
||||
```json
|
||||
{
|
||||
"workflow": "Send image to AI service and get results",
|
||||
"nodes": [
|
||||
{
|
||||
"type": "Image to Base64"
|
||||
},
|
||||
{
|
||||
"type": "HTTP Post JSON",
|
||||
"url": "https://ai-service.com/analyze",
|
||||
"json_data": "{\"image\": \"{{base64}}\", \"model\": \"v2\"}"
|
||||
},
|
||||
{
|
||||
"type": "HTTP Get JSON Field",
|
||||
"field_path": "result.confidence"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.8+
|
||||
- ComfyUI
|
||||
- Git
|
||||
|
||||
### Development Setup
|
||||
|
||||
1. **Clone the repository:**
|
||||
```bash
|
||||
git clone https://github.com/wawahuy/ComfyUI-HTTP.git
|
||||
cd ComfyUI-HTTP
|
||||
```
|
||||
|
||||
2. **Install development dependencies:**
|
||||
```bash
|
||||
pip install -e ".[dev]"
|
||||
```
|
||||
|
||||
3. **Install pre-commit hooks:**
|
||||
```bash
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
4. **Run tests:**
|
||||
```bash
|
||||
pytest
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
|
||||
This project maintains high code quality standards:
|
||||
|
||||
- **Formatting**: [Black](https://github.com/psf/black)
|
||||
- **Import Sorting**: [isort](https://pycqa.github.io/isort/)
|
||||
- **Linting**: [Flake8](https://flake8.pycqa.org/)
|
||||
- **Type Checking**: [MyPy](https://mypy.readthedocs.io/)
|
||||
- **Testing**: [pytest](https://pytest.org/)
|
||||
|
||||
### Running Quality Checks
|
||||
|
||||
```bash
|
||||
# Format code
|
||||
black .
|
||||
isort .
|
||||
|
||||
# Lint code
|
||||
flake8 .
|
||||
|
||||
# Type checking
|
||||
mypy .
|
||||
|
||||
# Run tests with coverage
|
||||
pytest --cov=. --cov-report=html
|
||||
```
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
ComfyUI-HTTP/
|
||||
├── __init__.py # Main module initialization
|
||||
├── http_get.py # HTTP GET node implementation
|
||||
├── http_post_json.py # HTTP POST JSON node
|
||||
├── http_post_form_data.py # HTTP POST form data node
|
||||
├── http_post_raw.py # HTTP POST raw data node
|
||||
├── http_get_json_field.py # JSON field extraction
|
||||
├── http_form_data.py # Form data container
|
||||
├── http_form_data_concat.py # Form data concatenation
|
||||
├── http_form_text_item.py # Text form field
|
||||
├── http_form_file_item.py # File form field
|
||||
├── http_form_image_item.py # Image form field
|
||||
├── base64_to_image.py # Base64 to image converter
|
||||
├── image_to_base64.py # Image to base64 converter
|
||||
├── node_metadata.json # Node metadata for ComfyUI
|
||||
├── requirements.txt # Python dependencies
|
||||
├── pyproject.toml # Project configuration
|
||||
├── README.md # This file
|
||||
├── PR_RULES.md # Contribution guidelines
|
||||
└── tests/ # Test suite
|
||||
├── test_http_nodes.py # HTTP node tests
|
||||
├── test_form_data.py # Form data tests
|
||||
└── test_converters.py # Converter tests
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome contributions! Please see our [Pull Request Guidelines](PR_RULES.md) for detailed information on:
|
||||
|
||||
- Code style and standards
|
||||
- Testing requirements
|
||||
- Documentation guidelines
|
||||
- Review process
|
||||
|
||||
### Quick Contribution Guide
|
||||
|
||||
1. **Fork** the repository
|
||||
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
|
||||
3. **Commit** your changes (`git commit -m 'feat: add amazing feature'`)
|
||||
4. **Push** to the branch (`git push origin feature/amazing-feature`)
|
||||
5. **Open** a Pull Request
|
||||
|
||||
### Development Commands
|
||||
|
||||
```bash
|
||||
# Install in development mode
|
||||
pip install -e ".[dev]"
|
||||
|
||||
# Run all tests
|
||||
pytest
|
||||
|
||||
# Run tests with coverage
|
||||
pytest --cov=. --cov-report=term-missing
|
||||
|
||||
# Format code
|
||||
black . && isort .
|
||||
|
||||
# Lint code
|
||||
flake8 . && mypy .
|
||||
|
||||
# Build package
|
||||
python -m build
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
- **ComfyUI Team** - For creating an amazing platform for AI workflows
|
||||
- **Contributors** - Thank you to all who have contributed to this project
|
||||
- **Community** - For feedback, bug reports, and feature requests
|
||||
|
||||
## Support
|
||||
|
||||
- **GitHub Issues**: [Report bugs or request features](https://github.com/wawahuy/ComfyUI-HTTP/issues)
|
||||
- **GitHub Discussions**: [Ask questions or share ideas](https://github.com/wawahuy/ComfyUI-HTTP/discussions)
|
||||
- **Documentation**: Check this README and code comments for usage examples
|
||||
|
||||
## Roadmap
|
||||
|
||||
### Upcoming Features
|
||||
|
||||
- **Authentication Support**: OAuth, API keys, JWT tokens
|
||||
- **WebSocket Integration**: Real-time communication capabilities
|
||||
- **GraphQL Support**: GraphQL query and mutation nodes
|
||||
- **Testing Framework**: Built-in HTTP mocking for workflow testing
|
||||
- **Performance Monitoring**: Request timing and performance metrics
|
||||
- **Security Enhancements**: Request validation and sanitization
|
||||
- **Proxy Support**: HTTP proxy configuration options
|
||||
- **Batch Operations**: Bulk HTTP requests and parallel processing
|
||||
|
||||
### Version History
|
||||
|
||||
- **v1.0.0** - Initial release with core HTTP functionality
|
||||
- **v0.9.0** - Beta release with form data support
|
||||
- **v0.8.0** - Alpha release with basic GET/POST operations
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
|
||||
**[Star this project](https://github.com/wawahuy/ComfyUI-HTTP/stargazers) | [Fork it](https://github.com/wawahuy/ComfyUI-HTTP/fork) | [Report Issues](https://github.com/wawahuy/ComfyUI-HTTP/issues)**
|
||||
|
||||
Made with love for the ComfyUI community
|
||||
|
||||
</div>
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=61.0", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "comfyui-http"
|
||||
version = "1.0.0"
|
||||
description = "HTTP nodes for ComfyUI - enabling seamless web API integration in your ComfyUI workflows"
|
||||
readme = "README.md"
|
||||
license = {text = "MIT"}
|
||||
authors = [
|
||||
{name = "wawahuy", email = "nguyengiahuy16@gmail.com"}
|
||||
]
|
||||
maintainers = [
|
||||
{name = "wawahuy", email = "nguyengiahuy16@gmail.com"}
|
||||
]
|
||||
keywords = [
|
||||
"comfyui",
|
||||
"http",
|
||||
"api",
|
||||
"workflow",
|
||||
"automation",
|
||||
"image-processing",
|
||||
"ai",
|
||||
"machine-learning"
|
||||
]
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||
"Topic :: Multimedia :: Graphics",
|
||||
]
|
||||
requires-python = ">=3.8"
|
||||
dependencies = [
|
||||
"requests>=2.25.0",
|
||||
"pillow>=8.0.0",
|
||||
"numpy>=1.19.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=7.0.0",
|
||||
"pytest-cov>=4.0.0",
|
||||
"black>=22.0.0",
|
||||
"isort>=5.10.0",
|
||||
"flake8>=5.0.0",
|
||||
"mypy>=1.0.0",
|
||||
"pre-commit>=2.20.0",
|
||||
]
|
||||
test = [
|
||||
"pytest>=7.0.0",
|
||||
"pytest-cov>=4.0.0",
|
||||
"pytest-mock>=3.8.0",
|
||||
"requests-mock>=1.9.0",
|
||||
]
|
||||
docs = [
|
||||
"sphinx>=5.0.0",
|
||||
"sphinx-rtd-theme>=1.0.0",
|
||||
"myst-parser>=0.18.0",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/wawahuy/ComfyUI-HTTP"
|
||||
Documentation = "https://github.com/wawahuy/ComfyUI-HTTP#readme"
|
||||
Repository = "https://github.com/wawahuy/ComfyUI-HTTP"
|
||||
"Bug Tracker" = "https://github.com/wawahuy/ComfyUI-HTTP/issues"
|
||||
Changelog = "https://github.com/wawahuy/ComfyUI-HTTP/blob/main/CHANGELOG.md"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["*"]
|
||||
exclude = ["tests*", "docs*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"*" = ["*.json", "*.md"]
|
||||
|
||||
# Black configuration
|
||||
[tool.black]
|
||||
line-length = 88
|
||||
target-version = ['py38', 'py39', 'py310', 'py311']
|
||||
include = '\.pyi?$'
|
||||
extend-exclude = '''
|
||||
/(
|
||||
# directories
|
||||
\.eggs
|
||||
| \.git
|
||||
| \.hg
|
||||
| \.mypy_cache
|
||||
| \.tox
|
||||
| \.venv
|
||||
| build
|
||||
| dist
|
||||
| __pycache__
|
||||
)/
|
||||
'''
|
||||
|
||||
# isort configuration
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
multi_line_output = 3
|
||||
line_length = 88
|
||||
include_trailing_comma = true
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
ensure_newline_before_comments = true
|
||||
|
||||
# MyPy configuration
|
||||
[tool.mypy]
|
||||
python_version = "3.8"
|
||||
warn_return_any = true
|
||||
warn_unused_configs = true
|
||||
disallow_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
check_untyped_defs = true
|
||||
disallow_untyped_decorators = true
|
||||
no_implicit_optional = true
|
||||
warn_redundant_casts = true
|
||||
warn_unused_ignores = true
|
||||
warn_no_return = true
|
||||
warn_unreachable = true
|
||||
strict_equality = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = ["comfyui.*", "folder_paths.*"]
|
||||
ignore_missing_imports = true
|
||||
|
||||
# Pytest configuration
|
||||
[tool.pytest.ini_options]
|
||||
minversion = "7.0"
|
||||
addopts = "-ra -q --strict-markers --strict-config"
|
||||
testpaths = ["tests"]
|
||||
python_files = ["test_*.py", "*_test.py"]
|
||||
python_classes = ["Test*"]
|
||||
python_functions = ["test_*"]
|
||||
markers = [
|
||||
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
||||
"integration: marks tests as integration tests",
|
||||
"unit: marks tests as unit tests",
|
||||
]
|
||||
|
||||
# Coverage configuration
|
||||
[tool.coverage.run]
|
||||
source = ["."]
|
||||
omit = [
|
||||
"*/tests/*",
|
||||
"*/test_*",
|
||||
"*/__pycache__/*",
|
||||
"*/venv/*",
|
||||
"*/env/*",
|
||||
"setup.py",
|
||||
]
|
||||
|
||||
[tool.coverage.report]
|
||||
exclude_lines = [
|
||||
"pragma: no cover",
|
||||
"def __repr__",
|
||||
"if self.debug:",
|
||||
"if settings.DEBUG",
|
||||
"raise AssertionError",
|
||||
"raise NotImplementedError",
|
||||
"if 0:",
|
||||
"if __name__ == .__main__.:",
|
||||
"class .*\\bProtocol\\):",
|
||||
"@(abc\\.)?abstractmethod",
|
||||
]
|
||||
|
||||
# Flake8 configuration
|
||||
[tool.flake8]
|
||||
max-line-length = 88
|
||||
extend-ignore = ["E203", "W503"]
|
||||
per-file-ignores = [
|
||||
"__init__.py:F401",
|
||||
]
|
||||
|
||||
# Pre-commit hooks configuration
|
||||
[tool.pre-commit]
|
||||
repos = [
|
||||
{
|
||||
repo = "https://github.com/pre-commit/pre-commit-hooks",
|
||||
rev = "v4.4.0",
|
||||
hooks = [
|
||||
{id = "trailing-whitespace"},
|
||||
{id = "end-of-file-fixer"},
|
||||
{id = "check-yaml"},
|
||||
{id = "check-added-large-files"},
|
||||
{id = "check-merge-conflict"},
|
||||
]
|
||||
},
|
||||
{
|
||||
repo = "https://github.com/psf/black",
|
||||
rev = "22.12.0",
|
||||
hooks = [{id = "black"}]
|
||||
},
|
||||
{
|
||||
repo = "https://github.com/pycqa/isort",
|
||||
rev = "5.12.0",
|
||||
hooks = [{id = "isort"}]
|
||||
},
|
||||
{
|
||||
repo = "https://github.com/pycqa/flake8",
|
||||
rev = "6.0.0",
|
||||
hooks = [{id = "flake8"}]
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user