Linting & Formatting
To maintain code quality and consistency across the Meteostat Python library, we use Ruff, a Python linter and code formatter, written in Rust. Ruff helps us identify and fix common issues in our codebase, ensuring that our code adheres to best practices and style guidelines. Contributors are encouraged to run Ruff locally before submitting pull requests to catch any potential issues early. If available for your IDE, consider installing the Ruff extension (VS Code) to get real-time feedback while coding.
Linting
To lint the codebase, run the following command in the root directory of the repository:
poetry run ruff check
This command will analyze the code and report any linting issues it finds. You can also specify a particular file or directory to lint by providing its path as an argument:
poetry run ruff check path/to/file_or_directory
Formatting
Linting issues can often be automatically fixed using Ruff's formatting capabilities. To format the codebase, run the following command:
poetry run ruff format