Skip to content

Commit 2d5efb2

Browse files
authored
Merge pull request #47 from akhundMurad/fix/core/32
feat: Add support of Uv :D
2 parents b1b5d50 + fb63be2 commit 2d5efb2

File tree

8 files changed

+1134
-88
lines changed

8 files changed

+1134
-88
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,50 @@
11
name: CI
22

3-
on: [pull_request]
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
47

58
jobs:
69
lint:
710
runs-on: ubuntu-latest
811
steps:
9-
- uses: actions/checkout@v3
12+
- name: Checkout
13+
uses: actions/checkout@v4
1014

11-
- name: Install Poetry
12-
uses: snok/install-poetry@v1
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.12"
1319

14-
- name: Install Dependencies
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v3
22+
23+
- name: Sync dependencies (locked)
1524
run: |
16-
poetry install --with dev
25+
uv sync --locked --all-groups
1726
1827
- name: Run linters
1928
run: |
2029
make check-linting
30+
2131
test:
2232
runs-on: ubuntu-latest
2333
steps:
24-
- uses: actions/checkout@v3
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: "3.12"
2541

26-
- name: Install Poetry
27-
uses: snok/install-poetry@v1
42+
- name: Install uv
43+
uses: astral-sh/setup-uv@v3
2844

29-
- name: Install Dependencies
45+
- name: Sync dependencies (locked)
3046
run: |
31-
poetry install --with dev
47+
uv sync --locked --all-groups
3248
3349
- name: Run tests
3450
run: |

.github/workflows/setup.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,28 @@ jobs:
1717
build:
1818
runs-on: ubuntu-latest
1919
strategy:
20+
fail-fast: false
2021
matrix:
2122
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
2223

2324
steps:
24-
- uses: actions/checkout@v3
25+
- name: Checkout
26+
uses: actions/checkout@v4
2527
with:
2628
fetch-depth: 9
2729
submodules: false
2830

29-
- name: Use Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v4
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v5
3133
with:
3234
python-version: ${{ matrix.python-version }}
3335

34-
- name: Install Poetry
35-
uses: snok/install-poetry@v1
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v3
3638

37-
- name: Install Dependencies
39+
- name: Sync dependencies (locked)
3840
run: |
39-
poetry install --with dev
41+
uv sync --locked --all-groups
4042
4143
- name: Run tests
4244
run: |

CONTRIBUTING.md

Lines changed: 103 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,130 @@
11
# Contributing
22

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 ❤️
46

57
## Requirements
68

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
912

1013
## Installation
1114

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):
1540

1641
```bash
17-
curl -sSL https://install.python-poetry.org | python3 -
42+
uv sync --all-groups
1843
```
1944

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
2152

2253
```bash
23-
poetry config virtualenvs.in-project true
54+
make test
55+
```
56+
57+
or directly:
2458

25-
poetry install --with dev
59+
```bash
60+
uv run pytest -v
2661
```
2762

28-
## Formatters
63+
## Formatters & linters
2964

30-
We are using the following linters:
65+
We use the following tools:
3166

32-
- black
33-
- mypy
34-
- isort
35-
- ruff
67+
- **ruff** – linting & import sorting
68+
- **black** – code formatting
69+
- **mypy** – static type checking
3670

37-
`Makefile` supports a task to run linters:
71+
Run all linters:
3872

3973
```bash
4074
make check-linting
4175
```
4276

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+
43108
## How to name branches
44109

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.

Makefile

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
check-linting:
2-
poetry run ruff check typeid/ tests/
3-
poetry run black --check --diff typeid/ tests/ --line-length 119
4-
poetry run mypy typeid/ --pretty
2+
uv run ruff check typeid/ tests/
3+
uv run black --check --diff typeid/ tests/ --line-length 119
4+
uv run mypy typeid/ --pretty
55

66

77
fix-linting:
8-
poetry run ruff check --fix typeid/ tests/
9-
poetry run black typeid/ tests/ --line-length 119
10-
8+
uv run ruff check --fix typeid/ tests/
9+
uv run black typeid/ tests/ --line-length 119
1110

1211

12+
# Build sdist + wheel using the configured PEP517 backend
1313
artifacts: test
14-
python -m build
14+
uv build
1515

1616

1717
clean:
18-
rm -rf dist build *.egg-info
18+
rm -rf dist build *.egg-info .venv
1919

2020

21+
# Ensure local dev env is ready (installs deps according to uv.lock / pyproject)
2122
prepforbuild:
22-
pip install build
23+
uv sync --all-groups
2324

2425

26+
# Alias if you still want a 'build' target name
2527
build:
26-
poetry build
28+
uv build
2729

2830

2931
test-release:
30-
twine upload --repository testpypi dist/* --verbose
32+
uv run twine upload --repository testpypi dist/* --verbose
3133

3234

3335
release:
34-
twine upload --repository pypi dist/* --verbose
36+
uv run twine upload --repository pypi dist/* --verbose
3537

3638

3739
test:
38-
poetry run pytest -v
40+
uv run pytest -v

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ This particular implementation provides an pip package that can be used by any P
2424

2525
## Installation
2626

27-
- PyPI:
27+
- Pip:
2828

2929
```console
3030
pip install typeid-python
3131
```
3232

33+
- Uv:
34+
35+
```console
36+
uv add typeid-python
37+
```
38+
3339
- Poetry:
3440

3541
```console

poetry.lock

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)