---
title: "Contributing"
description: "Set up the Rust and Python development environment, run the checks, and follow the release flow."
---

> Documentation Index
> Fetch the complete documentation index at: https://luozhouyang.github.io/python-string-similarity/llms.txt
> Use this file to discover all available pages before exploring further.

# Contributing

Contributions are welcome: bug reports, algorithm corrections, documentation improvements and pull requests. Start with the [issue tracker](https://github.com/luozhouyang/python-string-similarity/issues) to see what is already reported or requested.

## Development setup

You need Python 3.10 or newer, Rust 1.85 or newer and a C compiler.

### 1. Clone and create a virtual environment

```bash
git clone https://github.com/luozhouyang/python-string-similarity.git
cd python-string-similarity
python3 -m venv .venv
source .venv/bin/activate
```

### 2. Install the build and test tools

```bash
python -m pip install -U pip
pip install maturin pytest "black==26.10.1" "ruff==0.17.3"
```

### 3. Build and install the extension

```bash
maturin develop --release
```

`maturin develop` builds the Rust extension and installs it into the active virtual environment. The release profile is closer to the published wheels than a debug build. As an alternative, `pip install -e .` also builds an editable install through the maturin backend.

## Run the tests

```bash
cargo test --workspace
pytest
```

Rust unit tests live beside their implementations in `crates/strsimpy-core/src`. Python integration tests live in `tests/`. Run the full pair before opening a pull request.

## Formatting and linting

| Task | Command |
| --- | --- |
| Format Rust code | `cargo fmt --all` |
| Verify Rust formatting | `cargo fmt --all -- --check` |
| Lint Rust code | `cargo clippy --workspace --all-targets -- -D warnings` |
| Format Python code | `black python tests` |
| Verify Python formatting | `black --check python tests` |
| Check `__all__` ordering | `ruff check --select RUF022 python tests` |
| Build the docs site | `cd docs && pnpm run build` |
| Check the docs site | `cd docs && pnpm run check:docs` |
| Lint the docs site | `cd docs && pnpm run lint:docs` |

Black is configured for 88-column lines in `pyproject.toml`. Ruff's `RUF022` rule checks that `__all__` lists are sorted. CI runs the formatting and ordering checks, along with the Rust and Python test suites.

> **Clippy warnings are errors in CI**
>
> The `-D warnings` flag turns every Clippy warning into a failure. Fix warnings locally rather than relying on CI to report them.

## Making a change

- Add a Rust unit test for algorithm behavior and a Python test when the public API changes.
- Keep the public Python API and the historical import paths stable.
- Document user-facing behavior changes and limitations in `README.md`, the
  relevant docs page under `docs/src/content/docs/`, and the docs changelog
  when the release is user-visible.
- Run the test, formatting and lint commands above before submitting a pull request.
- For algorithms with deliberate semantic choices, explain the expected results in the test or documentation.

## Release flow

1. Bump `workspace.package.version` in the root `Cargo.toml` and refresh `Cargo.lock`.
2. Update the changelog in `README.md`,
   `docs/src/content/docs/reference/changelog.mdx` and any affected
   documentation.
3. Run the full check suite and, optionally, build artifacts locally:

   ```bash
   maturin build --release --out dist
   maturin sdist --out dist
   ```

4. Commit the release and create a GitHub Release. The `release: created` event triggers `.github/workflows/python-publish.yml`; the workflow also supports manual dispatch.
5. The workflow builds Linux manylinux and musllinux wheels for x86_64 and aarch64, macOS wheels for x86_64 and arm64, a Windows x64 wheel and a source distribution. It then publishes them to PyPI with OIDC Trusted Publishing, so no PyPI token is stored in the repository.

## Reporting issues

Open an issue at [github.com/luozhouyang/python-string-similarity/issues](https://github.com/luozhouyang/python-string-similarity/issues). Please include:

- The `strsimpy` version, from `python -c "import strsimpy; print(strsimpy.__version__)"`.
- Your Python version, operating system and CPU architecture.
- A minimal reproduction and the actual versus expected output.

For algorithm semantics, mention the reference implementation or definition you are comparing against so the behavior can be evaluated as a bug or a documented divergence.

Source: https://luozhouyang.github.io/python-string-similarity/contributing/index.mdx
