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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
title: PyLintPro
|
| 4 |
+
sdk: gradio
|
| 5 |
+
emoji: 👁
|
| 6 |
+
colorFrom: green
|
| 7 |
+
colorTo: yellow
|
| 8 |
+
short_description: A Gradio-based web application
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# PyLintPro
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+

|
| 15 |
+

|
| 16 |
+

|
| 17 |
+
[](https://huggingface.co/spaces/Canstralian/PyLintPro)
|
| 18 |
+
|
| 19 |
+
PyLintPro is a Gradio-based web application designed to help developers improve Python code by making it adhere to [Flake8](https://flake8.pycqa.org/) and [PEP 8](https://pep8.org/) standards. Simply paste your code or upload a `.py` file, and PyLintPro will return a linted version along with a detailed report of fixes. Whether you're working on personal projects or professional codebases, PyLintPro streamlines the process of cleaning and optimizing your Python code.
|
| 20 |
+
|
| 21 |
+
## Features
|
| 22 |
+
|
| 23 |
+
- **Code Linting**: Checks Python code against Flake8 rules to identify common issues such as style violations, potential bugs, and complexity problems.
|
| 24 |
+
- **PEP 8 Compliance**: Ensures your code follows the PEP 8 style guide, improving readability and maintainability.
|
| 25 |
+
- **File Upload Support**: Upload `.py` files and get the linted code and report back.
|
| 26 |
+
- **Real-time Linting**: Paste code into the textbox for immediate feedback and a fixed version of your code.
|
| 27 |
+
- **Customizable Linting Rules**: Choose which Flake8 rules to apply by selecting from a dropdown menu.
|
| 28 |
+
- **Code Fixing with autopep8**: Automatically fix common style issues in your Python code using the `autopep8` tool.
|
| 29 |
+
- **Linting Reports**: Get a detailed report on your code’s style issues, including statistics on what was fixed and what still needs attention.
|
| 30 |
+
- **Minimalist, User-friendly Interface**: Powered by Gradio, with a clean and intuitive interface that’s easy to navigate.
|
| 31 |
+
|
| 32 |
+
## Getting Started
|
| 33 |
+
|
| 34 |
+
### Prerequisites
|
| 35 |
+
|
| 36 |
+
Before using PyLintPro, ensure you have the following installed:
|
| 37 |
+
|
| 38 |
+
- **Python 3.9+**: PyLintPro works with Python 3.9 and above.
|
| 39 |
+
- **Flake8**: A Python tool for enforcing PEP 8 coding style.
|
| 40 |
+
- **autopep8**: A tool to automatically fix PEP 8 issues in Python code.
|
| 41 |
+
|
| 42 |
+
### Installation
|
| 43 |
+
|
| 44 |
+
1. Clone the repository:
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
git clone https://github.com/canstralian/PyLintPro.git
|
| 48 |
+
cd PyLintPro
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
2. Install the required dependencies:
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
pip install -r requirements.txt
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
3. Run the app locally:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
python app.py
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
4. Navigate to the local address in your browser (e.g., `http://127.0.0.1:7860`) to start linting your Python code.
|
| 64 |
+
|
| 65 |
+
### Usage
|
| 66 |
+
|
| 67 |
+
1. **Paste Code**: In the text input box, paste your Python code.
|
| 68 |
+
2. **Upload File**: Click the "Upload Code File" button to select a `.py` file from your computer. The app will process the file and display the linted code.
|
| 69 |
+
3. **Select Linting Rules**: Choose which Flake8 rules to apply by selecting from the provided list of common rules.
|
| 70 |
+
4. **Submit**: Click the "Submit" button to run the linting process. The app will display:
|
| 71 |
+
- The **linted code** with improvements.
|
| 72 |
+
- A **linting report** showing the issues identified and fixed.
|
| 73 |
+
|
| 74 |
+
### Example
|
| 75 |
+
|
| 76 |
+
Here's an example of how to use the app:
|
| 77 |
+
|
| 78 |
+
1. Paste this Python code into the input box:
|
| 79 |
+
```python
|
| 80 |
+
import os
|
| 81 |
+
import sys
|
| 82 |
+
def main():
|
| 83 |
+
print('Hello World')
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
2. After clicking "Submit", the app will return the following linted version:
|
| 87 |
+
```python
|
| 88 |
+
import os
|
| 89 |
+
import sys
|
| 90 |
+
|
| 91 |
+
def main():
|
| 92 |
+
print('Hello World')
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
**Linting Report**:
|
| 96 |
+
- `E701`: Multiple statements on one line.
|
| 97 |
+
- `W292`: No newline at end of file.
|
| 98 |
+
|
| 99 |
+
### Options & Customization
|
| 100 |
+
|
| 101 |
+
- **Choose Linting Rules**: Select multiple Flake8 rules to customize which issues should be flagged. You can choose to ignore specific warnings such as line length issues (`E501`) or unused imports (`F401`).
|
| 102 |
+
- **File Upload Support**: If you have an existing `.py` file, simply upload it, and the app will automatically lint the code.
|
| 103 |
+
|
| 104 |
+
### Advanced Configuration
|
| 105 |
+
|
| 106 |
+
PyLintPro also supports several advanced configurations:
|
| 107 |
+
|
| 108 |
+
- **Ignore Specific Rules**: You can specify which Flake8 rules to ignore when running the linting process.
|
| 109 |
+
- **Custom PEP 8 Guidelines**: If your project requires custom coding standards, you can configure PyLintPro to enforce those standards by modifying the `flake8` configuration file.
|
| 110 |
+
|
| 111 |
+
## Contributing
|
| 112 |
+
|
| 113 |
+
We welcome contributions to PyLintPro! If you'd like to contribute, please fork the repository and submit a pull request. Here are some ways you can help:
|
| 114 |
+
|
| 115 |
+
- Report bugs or issues.
|
| 116 |
+
- Suggest new features or enhancements.
|
| 117 |
+
- Submit code fixes or improvements.
|
| 118 |
+
|
| 119 |
+
### How to Contribute
|
| 120 |
+
|
| 121 |
+
1. Fork the repository.
|
| 122 |
+
2. Create a new branch (`git checkout -b feature-name`).
|
| 123 |
+
3. Make your changes and commit them (`git commit -m 'Add feature'`).
|
| 124 |
+
4. Push to the branch (`git push origin feature-name`).
|
| 125 |
+
5. Create a pull request.
|
| 126 |
+
|
| 127 |
+
Please ensure that your code adheres to the following:
|
| 128 |
+
|
| 129 |
+
- Follow PEP 8 and Flake8 standards.
|
| 130 |
+
- Ensure that tests pass and linting is successful.
|
| 131 |
+
|
| 132 |
+
## License
|
| 133 |
+
|
| 134 |
+
PyLintPro is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
| 135 |
+
|
| 136 |
+
## Acknowledgements
|
| 137 |
+
|
| 138 |
+
- [Gradio](https://gradio.app/): Used for building the user-friendly interface.
|
| 139 |
+
- [Flake8](https://flake8.pycqa.org/): Linting tool used to check code against PEP 8.
|
| 140 |
+
- [autopep8](https://github.com/hhatto/autopep8): Used to auto-correct PEP 8 violations.
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
### Example Code Snippet for Reference
|
| 145 |
+
|
| 146 |
+
Here’s an example Python code snippet that can be used with PyLintPro:
|
| 147 |
+
|
| 148 |
+
```python
|
| 149 |
+
import sys
|
| 150 |
+
|
| 151 |
+
def hello_world():
|
| 152 |
+
print("Hello, World!")
|
| 153 |
+
|
| 154 |
+
if __name__ == "__main__":
|
| 155 |
+
hello_world()
|
| 156 |
+
|
| 157 |
+
Known Issues
|
| 158 |
+
• File Upload Limit: Currently, the maximum file size for uploads is 10 MB.
|
| 159 |
+
• Performance on Large Files: The app may take longer to process large files or files with many lines of code.
|
| 160 |
+
|
| 161 |
+
Contact
|
| 162 |
+
|
| 163 |
+
For more information, contact us at [email protected].
|
| 164 |
+
|
| 165 |
+
Footer
|
| 166 |
+
|
| 167 |
+
PyLintPro is powered by Flake8 and autopep8, designed to enhance Python code quality with minimal effort.
|