|
| 1 | +# Contributing to Flask MySQL Template |
| 2 | + |
| 3 | +Thank you for considering contributing to the Flask MySQL Template! We welcome contributions to improve this project and make it even more useful for the community. Please follow the guidelines below to ensure a smooth and productive collaboration. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. Fork the Repository: |
| 8 | +• Click the “Fork” button on the top-right corner of this repository to create your own copy. |
| 9 | +2. Clone the Forked Repository: |
| 10 | +```bash |
| 11 | +git clone https://github.com/<your-username>/flask-mysql-template.git |
| 12 | +cd flask-mysql-template |
| 13 | +``` |
| 14 | + |
| 15 | +3. Set Up the Environment: |
| 16 | +• Install Python 3.9+ and Docker if not already installed. |
| 17 | +• Install project dependencies: |
| 18 | +```bash |
| 19 | +pip install -r requirements.txt |
| 20 | +``` |
| 21 | + |
| 22 | +4. Set Up the Database: |
| 23 | +• Create a `.env` file in the root directory with the necessary database configurations: |
| 24 | +```bash |
| 25 | +MYSQL_USER=root |
| 26 | +MYSQL_PASSWORD=password |
| 27 | +MYSQL_HOST=localhost |
| 28 | +MYSQL_PORT=3306 |
| 29 | +MYSQL_DATABASE=flask_app |
| 30 | +``` |
| 31 | + |
| 32 | +• Start the MySQL container: |
| 33 | +```bash |
| 34 | +docker-compose up -d |
| 35 | +``` |
| 36 | + |
| 37 | +5. Run the Application: |
| 38 | +```bash |
| 39 | +python run.py |
| 40 | +``` |
| 41 | + |
| 42 | +6. Run the Tests: |
| 43 | +```bash |
| 44 | +pytest |
| 45 | +``` |
| 46 | +## How to Contribute |
| 47 | + |
| 48 | +### Reporting Issues |
| 49 | + |
| 50 | +• Search the issue tracker to check if the issue has already been reported. |
| 51 | +• If not, create a new issue and provide as much detail as possible: |
| 52 | +• Steps to reproduce the issue |
| 53 | +• Expected and actual behavior |
| 54 | +• Environment details (OS, Python version, etc.) |
| 55 | + |
| 56 | +### Submitting Code |
| 57 | + |
| 58 | +1. Create a Feature Branch: |
| 59 | +```bash |
| 60 | +git checkout -b feature/your-feature-name |
| 61 | +``` |
| 62 | + |
| 63 | +2. Write Clear, Readable Code: |
| 64 | +• Follow Python best practices and conventions (e.g., PEP 8). |
| 65 | +• Ensure that the code is modular, documented, and includes tests. |
| 66 | +3. Run Tests Locally: |
| 67 | +• Add or update tests for new features or fixes. |
| 68 | +• Ensure all tests pass locally before submitting. |
| 69 | +4. Commit Changes: |
| 70 | +```bash |
| 71 | +git add . |
| 72 | +git commit -m "Add description of changes" |
| 73 | +``` |
| 74 | + |
| 75 | +5. Push Changes: |
| 76 | +```bash |
| 77 | +git push origin feature/your-feature-name |
| 78 | +``` |
| 79 | + |
| 80 | +6. Create a Pull Request: |
| 81 | +• Go to the original repository and click New Pull Request. |
| 82 | +• Provide a detailed description of your changes and link any related issues. |
| 83 | + |
| 84 | +### Code Guidelines |
| 85 | + |
| 86 | +1. Follow PEP 8: |
| 87 | +• Use meaningful variable names and write concise, clear code. |
| 88 | +2. Keep It Modular: |
| 89 | +• Split large functions into smaller, reusable functions. |
| 90 | +• Group related functionality into appropriate modules. |
| 91 | +3. Document Your Code: |
| 92 | +• Add docstrings to functions and classes. |
| 93 | +• Update relevant sections of the README or other documentation files. |
| 94 | +4. Write Tests: |
| 95 | +• Add unit tests for any new functionality. |
| 96 | +• Ensure full test coverage for critical code paths. |
| 97 | + |
| 98 | +### Workflow for Maintainers |
| 99 | + |
| 100 | +1. Review incoming pull requests for code quality, tests, and adherence to guidelines. |
| 101 | +2. Suggest changes or improvements if necessary. |
| 102 | +3. Merge approved pull requests into the main branch. |
| 103 | +4. Tag and release stable updates. |
| 104 | + |
| 105 | +### Community Guidelines |
| 106 | + |
| 107 | +• Be respectful and constructive in all interactions. |
| 108 | +• Provide clear, actionable feedback when reviewing contributions. |
| 109 | +• Respect differing opinions and approaches. |
| 110 | + |
| 111 | +# Thank you for contributing! 🎉 |
0 commit comments