Skip to content

Commit

Permalink
docs: update the development.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pplmx committed Sep 30, 2024
1 parent cd3f3b7 commit 4e5fcbe
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 59 deletions.
36 changes: 18 additions & 18 deletions template/rs/{{cookiecutter.project_slug}}/Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
.PHONY: help build test ruff image clean
.PHONY: help build test fmt clippy doc image clean
.DEFAULT_GOAL := help

APP_NAME := {{cookiecutter.project_slug}}

# Init the venv
init: sync
@uvx pre-commit install --hook-type commit-msg --hook-type pre-push

# Sync the project with the venv
sync:
@uv sync

# Build wheel
# Build the project
build:
@uvx hatch build
@cargo build --release

# Test
# Run tests
test:
@uvx hatch test
@cargo test

# Format code
fmt:
@cargo fmt

# Run clippy
clippy:
@cargo clippy -- -D warnings

# Ruff
ruff:
@uvx ruff format .
@uvx ruff check . --fix
# Generate documentation
doc:
@cargo doc --no-deps

# Build image
image:
Expand All @@ -38,7 +37,8 @@ compose-down:

# Clean build artifacts
clean:
@rm -rf build dist *.egg-info htmlcov .coverage coverage.xml coverage.lcov
@cargo clean
@rm -rf target
@docker compose -f ./compose.yml down -v
@docker image rm -f $(APP_NAME)

Expand Down
79 changes: 38 additions & 41 deletions template/rs/{{cookiecutter.project_slug}}/docs/development.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development Guide for {{cookiecutter.project_slug}}
# Development Guide for {{cookiecutter.project_name}}

Welcome to the development guide for `{{cookiecutter.project_slug}}`!
Welcome to the development guide for `{{cookiecutter.project_name}}`!
This document will walk you through setting up your development environment, running tests, building the project, and maintaining code quality.

## Table of Contents
Expand All @@ -11,50 +11,23 @@ This document will walk you through setting up your development environment, run
- [Running Tests](#running-tests)
- [Building the Project](#building-the-project)
- [Code Style and Linting](#code-style-and-linting)
- [Generating Documentation](#generating-documentation)

## Setting Up the Development Environment

### Prerequisites

Before you start, make sure you have the following installed on your system:

- **Python {{cookiecutter.python_version}}+**: Ensure you have the correct version of Python. You can check your Python version with:

```bash
python --version
```

- **`uv` tool**: This tool helps manage your Python environment.

- **macOS and Linux**:

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

- **Windows**:

```bash
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
```

### Installation Steps

1. **Clone the Repository**: Start by cloning the project repository to your local machine and navigate to the project directory:

```bash
git clone https://github.com/{{cookiecutter.__gh_slug}}.git
cd {{cookiecutter.project_slug}}
cd {{cookiecutter.project_name}}
```

2. **Initialize the Development Environment**: This command sets up a virtual environment and installs all necessary dependencies.
2. **Build the Project**: This command compiles the project and its dependencies:

```bash
make init
make build
```

This step will also install any pre-commit hooks, ensuring your code adheres to the project’s coding standards before each commit.

## Running Tests

Tests are crucial to ensure the stability of the project. To run all tests, use the following command:
Expand All @@ -63,30 +36,54 @@ Tests are crucial to ensure the stability of the project. To run all tests, use
make test
```

This command will execute the test suite using `pytest`, ensuring all components work as expected.
This command will compile the code and run all tests, ensuring all components work as expected.

[Consider adding specific details on the structure of tests, testing strategy, or how to add new tests.]

## Building the Project

To build the project and create a distributable package, use:
To build the project in release mode, use:

```bash
make build
```

This command will generate a `.whl` file in the `dist` directory, which can be used to distribute and install the project.
This command will generate an optimized executable in the `target/release` directory.

## Code Style and Linting

Maintaining consistent code style is essential. We use `ruff` for linting and formatting. To check for any style issues, run:
Maintaining consistent code style is essential. We use `rustfmt` for formatting and `clippy` for linting.

To format your code, run:

```bash
make ruff
make fmt
```

This command will automatically check and optionally fix any code style issues according to the project's style guide.
To run the linter:

---
```bash
make clippy
```

These commands will automatically check and optionally fix any code style issues according to the project's style guide.
## Generating Documentation
To generate the project documentation, run:
```bash
make doc
```
This will create the documentation for your project and its dependencies.
## Cleaning Up
To clean up build artifacts and other generated files, you can use:
```bash
make clean
```
By following this guide, you'll be well on your way to contributing to `{{cookiecutter.project_slug}}`. Thank you for your efforts in maintaining and improving this project!
This will remove the `target` directory and clean up any Docker-related resources.

0 comments on commit 4e5fcbe

Please sign in to comment.