Skip to content
This repository was archived by the owner on Jun 25, 2026. It is now read-only.
Closed
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
66 changes: 19 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,45 @@ on:
name: CI

jobs:

test:
runs-on: ubuntu-latest
strategy:
matrix:
python:
- '3.12'
- '3.11'
- '3.10'
- '3.9'
- '3.8'
- "3.14"
- "3.13"
- "3.12"
- "3.11"
name: Python ${{ matrix.python }}
steps:
# Python
- name: Setup python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- uses: actions/checkout@v4

# Check out code
- uses: actions/checkout@v2
- name: Install uv
uses: astral-sh/setup-uv@v5

# Cached dependencies
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-py${{ matrix.python }}-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python }}-
- name: Install dev dependencies
# There's no virtual env in CI environment, just bypass it with a dummy
# env var value
run: VIRTUAL_ENV=none make install
- name: Setup Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}

- name: Install dependencies
run: uv sync

# Tests
- name: Run tests
run: pytest --ignore=tests/test_pattern_matching.py --ignore=tests/type_checking/test_result.yml
- name: Run tests (type checking)
if: matrix.python != '3.8' && matrix.python != '3.9'
# These started breaking for <= 3.9, due to the type checker using a
# '|' for unions rather than 'Union[...]', so it's not possible to run
# the tests without maintaining two duplicate files (one for <= 3.9 and
# one for > 3.9)
run: pytest tests/type_checking/test_result.yml
- name: Run tests (pattern matching)
if: matrix.python == '3.10' || matrix.python == '3.11' || matrix.python == '3.12'
run: pytest tests/test_pattern_matching.py
run: uv run pytest

# Linters
- name: Run flake8 (Python >= 3.10)
run: make lint-flake
if: matrix.python != '3.9' && matrix.python != '3.8'
- name: Run flake8 (Python < 3.10)
run: make lint-flake-pre310
if: matrix.python == '3.9' || matrix.python == '3.8'
- name: Run ruff
run: uv run ruff check .
- name: Run mypy
run: make lint-mypy
run: uv run mypy

# Packaging
- name: Build packages
run: |
pip install --upgrade build pip setuptools wheel
python -m build
run: uv build

# Coverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v1
if: matrix.python == '3.9'
uses: codecov/codecov-action@v4
if: matrix.python == '3.12'
with:
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ build/
.idea/
.mypy_cache/
venv/
/.tox/
.vscode
pyrightconfig.json
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (C) 2015-2020 Danilo Bargen and contributors
Copyright (C) 2025 Roman Kitaev <802.11g@bk.ru>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

82 changes: 0 additions & 82 deletions MIGRATING.md

This file was deleted.

31 changes: 0 additions & 31 deletions Makefile

This file was deleted.

14 changes: 7 additions & 7 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export VERSION={VERSION BEING RELEASED}
export GPG={YOUR GPG}
```

2) Update version numbers to match the version being released:
2) Update version number in `pyproject.toml` and update `CHANGELOG.md`:
```
vim -p src/result/__init__.py CHANGELOG.md
vim -p pyproject.toml CHANGELOG.md
```

3) Update diff link in CHANGELOG.md ([see example][diff-link-update-pr-example]):
Expand All @@ -21,20 +21,20 @@ vim CHANGELOG.md

4) Do a signed commit and signed tag of the release:
```
git add src/result/__init__.py CHANGELOG.md
git add pyproject.toml CHANGELOG.md
git commit -S${GPG} -m "Release v${VERSION}"
git tag -u ${GPG} -m "Release v${VERSION}" v${VERSION}
```

5) Build source and binary distributions:
```
rm -rf ./dist
python3 -m build
just build
```

6) Upload package to PyPI:
```
twine upload dist/result-${VERSION}*
uv publish
git push
git push --tags
```
Expand All @@ -43,9 +43,9 @@ git push --tags
- https://github.com/rustedpy/result/tags
- https://pypi.org/project/result/#history

8) Update version number to next dev version (for example after `v0.9.0` this should be set to `0.10.0.dev0`:
8) Update version number in `pyproject.toml` to next dev version (for example after `v0.9.0` this should be set to `0.10.0.dev0`):
```
vim -p src/result/__init__.py
vim pyproject.toml
```

[diff-link-update-pr-example]: https://github.com/rustedpy/result/pull/77/files
21 changes: 21 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
default: lint test

install:
uv sync

lint: lint-ruff lint-mypy

lint-ruff:
uv run ruff check .

lint-mypy:
uv run mypy

test:
uv run pytest

test-cov:
uv run pytest --cov=result --cov-report=term-missing

build:
uv build
Loading
Loading