|
1 | 1 | # Contributing |
2 | 2 |
|
3 | | -This page discribes how to contribute to typeid-python. |
| 3 | +This document describes how to contribute to **typeid-python**. |
| 4 | + |
| 5 | +Thank you for taking the time to contribute ❤️ |
4 | 6 |
|
5 | 7 | ## Requirements |
6 | 8 |
|
7 | | -- Linux, since all development proccess adapted for Linux machines. |
8 | | -- supported Python version (e.g. Python 3.14). |
| 9 | +- Linux or macOS (the development workflow is primarily tested on Unix-like systems) |
| 10 | +- A supported Python version (e.g. Python 3.10+; latest tested: Python 3.14) |
| 11 | +- [`uv`](https://astral.sh/uv/) – fast Python package manager and environment tool |
9 | 12 |
|
10 | 13 | ## Installation |
11 | 14 |
|
12 | | -1. Fork the [repository](https://github.com/akhundMurad/typeid-python). |
13 | | -2. Clone the forked repository. |
14 | | -3. Install [Poetry Packaging Manager](https://python-poetry.org/): |
| 15 | +### 1. Fork & clone |
| 16 | + |
| 17 | +1. Fork the repository on GitHub. |
| 18 | +2. Clone your fork locally: |
| 19 | + |
| 20 | +```bash |
| 21 | +git clone https://github.com/<your-username>/typeid-python.git |
| 22 | +cd typeid-python |
| 23 | +``` |
| 24 | + |
| 25 | +### 2. Install `uv` |
| 26 | + |
| 27 | +```bash |
| 28 | +curl -LsSf https://astral.sh/uv/install.sh | sh |
| 29 | +``` |
| 30 | + |
| 31 | +Verify installation: |
| 32 | + |
| 33 | +```bash |
| 34 | +uv --version |
| 35 | +``` |
| 36 | + |
| 37 | +### 3. Set up the development environment |
| 38 | + |
| 39 | +Create and sync the virtual environment (including dev dependencies): |
15 | 40 |
|
16 | 41 | ```bash |
17 | | -curl -sSL https://install.python-poetry.org | python3 - |
| 42 | +uv sync --all-groups |
18 | 43 | ``` |
19 | 44 |
|
20 | | -4. Configure virtual environment: |
| 45 | +This will: |
| 46 | + |
| 47 | +- create a local `.venv/` |
| 48 | +- install dependencies according to `uv.lock` |
| 49 | +- keep the environment reproducible |
| 50 | + |
| 51 | +## Running tests |
21 | 52 |
|
22 | 53 | ```bash |
23 | | -poetry config virtualenvs.in-project true |
| 54 | +make test |
| 55 | +``` |
| 56 | + |
| 57 | +or directly: |
24 | 58 |
|
25 | | -poetry install --with dev |
| 59 | +```bash |
| 60 | +uv run pytest -v |
26 | 61 | ``` |
27 | 62 |
|
28 | | -## Formatters |
| 63 | +## Formatters & linters |
29 | 64 |
|
30 | | -We are using the following linters: |
| 65 | +We use the following tools: |
31 | 66 |
|
32 | | -- black |
33 | | -- mypy |
34 | | -- isort |
35 | | -- ruff |
| 67 | +- **ruff** – linting & import sorting |
| 68 | +- **black** – code formatting |
| 69 | +- **mypy** – static type checking |
36 | 70 |
|
37 | | -`Makefile` supports a task to run linters: |
| 71 | +Run all linters: |
38 | 72 |
|
39 | 73 | ```bash |
40 | 74 | make check-linting |
41 | 75 | ``` |
42 | 76 |
|
| 77 | +Auto-fix formatting issues where possible: |
| 78 | + |
| 79 | +```bash |
| 80 | +make fix-linting |
| 81 | +``` |
| 82 | + |
| 83 | +## Building the package |
| 84 | + |
| 85 | +Build wheel and source distribution: |
| 86 | + |
| 87 | +```bash |
| 88 | +make build |
| 89 | +``` |
| 90 | + |
| 91 | +This uses `uv build` under the hood. |
| 92 | + |
| 93 | +## Testing extras (CLI) |
| 94 | + |
| 95 | +To test the CLI extra locally: |
| 96 | + |
| 97 | +```bash |
| 98 | +uv sync --all-groups --extra cli |
| 99 | +uv run typeid new -p test |
| 100 | +``` |
| 101 | + |
| 102 | +## Lockfile discipline |
| 103 | + |
| 104 | +- `uv.lock` **must be committed** |
| 105 | +- Always run dependency changes via `uv add` / `uv remove` |
| 106 | +- CI uses `uv sync --locked`, so lockfile drift will fail builds |
| 107 | + |
43 | 108 | ## How to name branches |
44 | 109 |
|
45 | | -It doesn't matter, as long as branch names don't contain anything that violates the Code of Conduct included in the project's repository. As a general rule of thumb, branch names should have a descriptive name, or refer the number of an issue in their name. |
| 110 | +Branch names are flexible, as long as they are respectful and descriptive. |
| 111 | + |
| 112 | +Recommended patterns: |
| 113 | + |
| 114 | +- `fix/core/32` |
| 115 | +- `feature/cli-support` |
| 116 | +- `docs/readme-update` |
| 117 | +- `chore/ci-cleanup` |
| 118 | + |
| 119 | +Referencing an issue number in the branch name is encouraged but not required. |
| 120 | + |
| 121 | +## Submitting a Pull Request |
| 122 | + |
| 123 | +1. Create a feature branch |
| 124 | +2. Make sure tests and linters pass |
| 125 | +3. Commit with a clear message |
| 126 | +4. Open a pull request against `main` |
| 127 | +5. Describe **what** changed and **why** |
| 128 | + |
| 129 | +Happy hacking 🚀 |
| 130 | +If something is unclear, feel free to open an issue or discussion. |
0 commit comments