Skip to content
Open
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: 17 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,43 @@ jobs:
exclude-pattern-matching: true
name: Python ${{ matrix.python.version }}
steps:
# Check out code
- uses: actions/checkout@v4

# Python
- name: Setup python ${{ matrix.python.version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python.version }}
cache: pip
cache-dependency-path: requirements-dev.txt

- name: Install dev dependencies
run: pip install --root-user-action=ignore --upgrade pip --requirement requirements-dev.txt

# Install library
- name: Install maybe
run: pip install --root-user-action=ignore --editable .[result]

- name: Install deps
run: uv sync --frozen

# Tests
- name: Run tests (excluding pattern matching)
if: ${{ matrix.python.exclude-pattern-matching }}
run: pytest --ignore=tests/test_pattern_matching.py
run: uv run pytest --ignore=tests/test_pattern_matching.py
- name: Run tests (including pattern matching)
if: ${{ ! matrix.python.exclude-pattern-matching }}
run: pytest
run: uv run pytest

# Linters
- name: Ruff
run: uv run ruff check

- name: Ruff format
run: uv run ruff format --check

- name: Run flake8 (excluding pattern matching)
if: ${{ matrix.python.exclude-pattern-matching }}
run: flake8 --extend-exclude tests/test_pattern_matching.py
run: uv run flake8 --extend-exclude tests/test_pattern_matching.py
- name: Run flake8 (including pattern matching)
if: ${{ ! matrix.python.exclude-pattern-matching }}
run: flake8
run: uv run flake8
- name: Run mypy
run: mypy
run: uv run mypy

# Packaging
- name: Build packages
run: |
pip install --root-user-action=ignore --upgrade build pip setuptools wheel
python -m build
uv build

# Coverage
- name: Upload coverage to codecov.io
Expand Down
65 changes: 63 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
[project]
name = "rustedpy-maybe"
version = "0.0.0"
description = "A Rust-like option type for Python"
readme = "README.md"
requires-python = ">=3.8, <=3.12"
keywords = ["rust", "option", "maybe", "enum"]
authors = [
{name = "francium", email = "[email protected]"}
]
maintainers = [
{name = "rustedpy github org members"}
]
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only"
]


dependencies = []

[project.optional-dependencies]
result = ["result"]


[dependency-groups]
dev = [
"build>=1.2.2.post1",
"flake8>=5.0.4",
"lazydocs>=0.4.8",
"mypy>=1.13.0",
"pytest-asyncio>=0.24.0",
"pytest>=8.3.4",
"pytest-cov>=5.0.0",
"pytest-mypy-plugins>=3.1.2",
"twine>=6.0.1",
"result>=0.17.0",
]

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/maybe"]

[tool.mypy]
python_version = "3.11"
Expand Down Expand Up @@ -45,3 +95,14 @@ addopts = [
# By default, ignore tests that only run on Python 3.10+
"--ignore=tests/test_pattern_matching.py",
]
[tool.ruff.lint]
select = ["ALL"]
exclude = ["alembic/versions/*"]
ignore = ["TID252", "E501", "S101", "S102", "S104", "S324", "EXE002", "D100", "D102","D200","D401", "D203","D415","D400","D205", "D206", "D103", "D104", "D105", "D106", "D101", "D107", "D212", "D211", "PGH003", "PGH004", "N811", "N804", "N818", "N806", "N815", "ARG001", "ARG002", "DTZ003", "DTZ005", "RSE102", "SLF001", "PLR", "INP", "TRY", "SIM300", "SIM114", "DJ008", "FIX002", "S603", "S607", "TD002", "TD003", "W191", "COM812", "ISC001"]

[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["input", "filter", "id"]

[tool.ruff.lint.isort]
combine-as-imports = true

9 changes: 0 additions & 9 deletions requirements-dev.txt

This file was deleted.

51 changes: 0 additions & 51 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

10 changes: 6 additions & 4 deletions src/maybe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
from .maybe import (
NOTHING,
Maybe,
Nothing,
Some,
SomeNothing,
Maybe,
UnwrapError,
is_some,
is_nothing,
is_some,
)

__all__ = [
"NOTHING",
"Maybe",
"Nothing",
"Some",
"SomeNothing",
"Maybe",
"UnwrapError",
"is_some",
"is_nothing",
"is_some",
]
__version__ = "0.0.0"
Loading