File size: 4,833 Bytes
69fec20 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# Contributing to gcli2api
First off, thank you for considering contributing to gcli2api! It's people like you that make gcli2api such a great tool.
## Code of Conduct
This project is intended for personal learning and research purposes only. By participating, you are expected to uphold this code and respect the CNC-1.0 license restrictions on commercial use.
## How Can I Contribute?
### Reporting Bugs
Before creating bug reports, please check the existing issues to avoid duplicates. When you create a bug report, include as many details as possible:
* **Use a clear and descriptive title**
* **Describe the exact steps to reproduce the problem**
* **Provide specific examples** - Include code snippets, configuration files, or log outputs
* **Describe the behavior you observed** and what you expected to see
* **Include environment details**: OS, Python version, Docker version (if applicable)
### Suggesting Enhancements
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
* **Use a clear and descriptive title**
* **Provide a detailed description** of the suggested enhancement
* **Explain why this enhancement would be useful**
* **List any alternative solutions** you've considered
### Pull Requests
1. Fork the repo and create your branch from `master`
2. If you've added code that should be tested, add tests
3. If you've changed APIs, update the documentation
4. Ensure the test suite passes
5. Make sure your code follows the existing style
6. Write a clear commit message
## Development Setup
### Prerequisites
* Python 3.12 or higher
* pip or uv package manager
### Setting Up Your Development Environment
```bash
# Clone your fork
git clone https://github.com/YOUR_USERNAME/gcli2api.git
cd gcli2api
# Install development dependencies
make install-dev
# or
pip install -e ".[dev]"
# Copy environment example
cp .env.example .env
# Edit .env with your configuration
```
### Development Workflow
```bash
# Run tests
make test
# Format code
make format
# Run linters
make lint
# Run the application locally
make run
```
### Testing
We use pytest for testing. All new features should include appropriate tests.
```bash
# Run all tests
make test
# Run with coverage
make test-cov
# Run specific test file
python -m pytest test_tool_calling.py -v
```
### Code Style
* We use [Black](https://black.readthedocs.io/) for code formatting (line length: 100)
* We use [flake8](https://flake8.pycqa.org/) for linting
* We use [mypy](http://mypy-lang.org/) for type checking (optional, but encouraged)
```bash
# Format your code before committing
make format
# Check if code is properly formatted
make format-check
# Run linters
make lint
```
## Project Structure
```
gcli2api/
βββ src/ # Main source code
β βββ auth.py # Authentication and OAuth
β βββ credential_manager.py # Credential rotation
β βββ openai_router.py # OpenAI-compatible endpoints
β βββ gemini_router.py # Gemini native endpoints
β βββ openai_transfer.py # Format conversion
β βββ storage/ # Storage backends (Redis, MongoDB, Postgres, File)
β βββ ...
βββ front/ # Frontend static files
βββ tests/ # Test directory (to be created)
βββ test_*.py # Test files (root level)
βββ web.py # Main application entry point
βββ config.py # Configuration management
βββ requirements.txt # Production dependencies
```
## Coding Guidelines
### Python Style
* Follow PEP 8 guidelines
* Use type hints where appropriate
* Write docstrings for classes and functions
* Keep functions focused and concise
### Commit Messages
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally after the first line
### Documentation
* Update the README.md if you change functionality
* Comment your code where necessary
* Update the .env.example if you add new configuration options
## License
By contributing to gcli2api, you agree that your contributions will be licensed under the CNC-1.0 license. This is a strict anti-commercial license - see [LICENSE](LICENSE) for details.
### Important License Restrictions
* β No commercial use
* β No use by companies with revenue > $1M USD
* β No use by VC-backed or publicly traded companies
* β
Personal learning, research, and educational use only
* β
Open source integration (must follow same license)
## Questions?
Feel free to open an issue with your question or reach out to the maintainers.
Thank you for contributing! π
|