This repository is a template for creating Python tools with a consistent structure and standard features like linting, testing, and packaging.
- Python Package Structure: Includes a basic Python package setup (
search-pathfinding
). - Testing Setup: Example test files (
search-pathfinding_tests
) for unit testing. - Development Tools: Shell scripts to automate formatting, linting, testing (
run_format.sh
,run_lint.sh
,run_tests.sh
), and renaming (rename.sh
). - Project Configuration: Uses
pyproject.toml
for dependency management with Poetry.
- Python 3.8+
- Poetry for dependency and project management
The project uses several dependencies defined in pyproject.toml
. Below is a summary of the main dependencies and their purposes:
- Poetry: Used for dependency management and packaging.
- Linting and Formatting: Includes tools like
pylint
andblack
to ensure code quality and consistency. - Testing: Uses
pytest
for unit testing to ensure the functionality of the code.
To install the dependencies, use:
poetry install
This project relies on the following dependencies to ensure functionality, development efficiency, and maintainability:
- rich: For rendering rich text, tables, and progress bars in the terminal, enhancing the user experience of the CLI.
- rich-click: Combines Rich and Click to add rich-text formatting and improve the usability of the command-line interface.
- click: A framework for building flexible and easy-to-use command-line interfaces (CLI).
- black: Automatically formats code to ensure consistent style across the project.
- pylint: Provides static code analysis to enforce coding standards and detect potential bugs.
- coverage: Measures the coverage of unit tests, helping to ensure all code paths are tested.
- sphinx: Generates project documentation in formats such as HTML and PDF.
- sphinx-rtd-theme: Provides a clean, responsive theme for documentation, styled like Read the Docs.
These dependencies help streamline development, testing, and documentation while ensuring a user-friendly command-line interface.
-
Clone the repository:
git clone https://github.com/yourusername/search-pathfinding.git cd search-pathfinding
-
Install the dependencies:
poetry install
To run the main script:
poetry run python -m search-pathfinding
To format the codebase:
./run_format.sh
To lint the codebase:
./run_lint.sh
To run the tests:
./run_tests.sh
To rename the project (e.g., change the package name from search-pathfinding
to something else):
./rename.sh new_project_name
search-pathfinding/
: The main package containing the tool's source code.search-pathfinding_tests/
: Contains unit tests for the package..gitignore
: Specifies files and folders to be ignored by Git.pyproject.toml
: Project configuration and dependency management file.LICENSE
: The license for this project.
This project is licensed under the terms of the MIT license. See the LICENSE file for details.
Feel free to open issues or submit pull requests for new features, bug fixes, or improvements.
This template is inspired by best practices for Python tool development, making it easy to start a new project with a consistent and productive setup.