Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,50 @@
name: CI

on: [pull_request]
on:
pull_request:
push:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Dependencies
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Sync dependencies (locked)
run: |
poetry install --with dev
uv sync --locked --all-groups

- name: Run linters
run: |
make check-linting

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install Dependencies
- name: Sync dependencies (locked)
run: |
poetry install --with dev
uv sync --locked --all-groups

- name: Run tests
run: |
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 9
submodules: false

- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install Dependencies
- name: Sync dependencies (locked)
run: |
poetry install --with dev
uv sync --locked --all-groups

- name: Run tests
run: |
Expand Down
121 changes: 103 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,130 @@
# Contributing

This page discribes how to contribute to typeid-python.
This document describes how to contribute to **typeid-python**.

Thank you for taking the time to contribute ❤️

## Requirements

- Linux, since all development proccess adapted for Linux machines.
- supported Python version (e.g. Python 3.14).
- Linux or macOS (the development workflow is primarily tested on Unix-like systems)
- A supported Python version (e.g. Python 3.10+; latest tested: Python 3.14)
- [`uv`](https://astral.sh/uv/) – fast Python package manager and environment tool

## Installation

1. Fork the [repository](https://github.com/akhundMurad/typeid-python).
2. Clone the forked repository.
3. Install [Poetry Packaging Manager](https://python-poetry.org/):
### 1. Fork & clone

1. Fork the repository on GitHub.
2. Clone your fork locally:

```bash
git clone https://github.com/<your-username>/typeid-python.git
cd typeid-python
```

### 2. Install `uv`

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

Verify installation:

```bash
uv --version
```

### 3. Set up the development environment

Create and sync the virtual environment (including dev dependencies):

```bash
curl -sSL https://install.python-poetry.org | python3 -
uv sync --all-groups
```

4. Configure virtual environment:
This will:

- create a local `.venv/`
- install dependencies according to `uv.lock`
- keep the environment reproducible

## Running tests

```bash
poetry config virtualenvs.in-project true
make test
```

or directly:

poetry install --with dev
```bash
uv run pytest -v
```

## Formatters
## Formatters & linters

We are using the following linters:
We use the following tools:

- black
- mypy
- isort
- ruff
- **ruff** – linting & import sorting
- **black** – code formatting
- **mypy** – static type checking

`Makefile` supports a task to run linters:
Run all linters:

```bash
make check-linting
```

Auto-fix formatting issues where possible:

```bash
make fix-linting
```

## Building the package

Build wheel and source distribution:

```bash
make build
```

This uses `uv build` under the hood.

## Testing extras (CLI)

To test the CLI extra locally:

```bash
uv sync --all-groups --extra cli
uv run typeid new -p test
```

## Lockfile discipline

- `uv.lock` **must be committed**
- Always run dependency changes via `uv add` / `uv remove`
- CI uses `uv sync --locked`, so lockfile drift will fail builds

## How to name branches

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.
Branch names are flexible, as long as they are respectful and descriptive.

Recommended patterns:

- `fix/core/32`
- `feature/cli-support`
- `docs/readme-update`
- `chore/ci-cleanup`

Referencing an issue number in the branch name is encouraged but not required.

## Submitting a Pull Request

1. Create a feature branch
2. Make sure tests and linters pass
3. Commit with a clear message
4. Open a pull request against `main`
5. Describe **what** changed and **why**

Happy hacking 🚀
If something is unclear, feel free to open an issue or discussion.
28 changes: 15 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
check-linting:
poetry run ruff check typeid/ tests/
poetry run black --check --diff typeid/ tests/ --line-length 119
poetry run mypy typeid/ --pretty
uv run ruff check typeid/ tests/
uv run black --check --diff typeid/ tests/ --line-length 119
uv run mypy typeid/ --pretty


fix-linting:
poetry run ruff check --fix typeid/ tests/
poetry run black typeid/ tests/ --line-length 119

uv run ruff check --fix typeid/ tests/
uv run black typeid/ tests/ --line-length 119


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


clean:
rm -rf dist build *.egg-info
rm -rf dist build *.egg-info .venv


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


# Alias if you still want a 'build' target name
build:
poetry build
uv build


test-release:
twine upload --repository testpypi dist/* --verbose
uv run twine upload --repository testpypi dist/* --verbose


release:
twine upload --repository pypi dist/* --verbose
uv run twine upload --repository pypi dist/* --verbose


test:
poetry run pytest -v
uv run pytest -v
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ This particular implementation provides an pip package that can be used by any P

## Installation

- PyPI:
- Pip:

```console
pip install typeid-python
```

- Uv:

```console
uv add typeid-python
```

- Poetry:

```console
Expand Down
15 changes: 8 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading