Skip to content

feat: 83 replace poetry co by uv and ruff #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
13a46d2
modify makefile
atstaeff Jun 8, 2025
583bb59
add uv
atstaeff Jun 8, 2025
c68600a
remove poetry
atstaeff Jun 8, 2025
0882a34
modify pyproject.toml and remove other config files
atstaeff Jun 8, 2025
3365bb9
modify pyproject.toml and remove other config files
atstaeff Jun 8, 2025
b2c53be
modify auto format with ruff linting
atstaeff Jun 8, 2025
0ab0b53
fix project.toml
atstaeff Jun 8, 2025
5037de2
add ignore linting rules to have the same result like before with pyl…
atstaeff Jun 8, 2025
816458c
add uv add ... --dev to makefile. dependencies are going to be instal…
atstaeff Jun 8, 2025
75de95c
add py.typed and add to pyproject.toml
atstaeff Jun 8, 2025
dd42606
fix typo issues
atstaeff Jun 9, 2025
66dcbdb
modify github action. migrate poetry to uv
atstaeff Jun 9, 2025
fb801ee
modify github action uv migration
atstaeff Jun 9, 2025
eec02b9
fix uv migration in github action package dependencies
atstaeff Jun 9, 2025
1c4acaa
Udpate pytest -> 8.4.0 and aiohttp -> 3.12.11
atstaeff Jun 9, 2025
2fa0180
add editorconfig in pyproject.toml
atstaeff Jun 12, 2025
c1070d9
modify exceptions
atstaeff Jun 12, 2025
e3cf851
fix exception message
atstaeff Jun 12, 2025
fd66094
remove unnecessary test files
atstaeff Jun 12, 2025
42a3d29
remove manually uv packages in github action
atstaeff Jun 12, 2025
1d95a12
remove comments
atstaeff Jun 12, 2025
eccadbc
remove blank lines
atstaeff Jun 12, 2025
1f51dd3
fix short to long
atstaeff Jun 12, 2025
48d8c52
fixing short to long, remove empty lines and manually packages
atstaeff Jun 12, 2025
8849ae6
add points.
atstaeff Jun 12, 2025
7224826
misspelling fixed
atstaeff Jun 12, 2025
86155aa
add blank line
atstaeff Jun 12, 2025
2326784
remove comments __hash__
atstaeff Jun 12, 2025
49e8cd9
remove comments and qa first, help remove
atstaeff Jun 12, 2025
3d7d8b3
fix issues
atstaeff Jun 12, 2025
1b45d24
add clean to Makefile
atstaeff Jun 16, 2025
42e29d2
Merge branch 'main' into 83-replace-poetry-co-by-uv-and-ruff
atstaeff Jun 16, 2025
12149c5
Merge branch 'main' into 83-replace-poetry-co-by-uv-and-ruff
atstaeff Jun 24, 2025
8282338
remove poetry.lock
atstaeff Jun 27, 2025
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
18 changes: 0 additions & 18 deletions .editorconfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die sollte nicht gelöscht werden.

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
python-version: ${{ matrix.version }}
- name: Install dependencies
run: |
pip install poetry
poetry install
curl --location --silent --show-error --fail https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
uv sync
uv sync --dev
Comment on lines +26 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv sync --dev genügt hier, da es nicht nur die Dev-Dependencies installiert, sondern auch die eigentlichen Dependencies.

- name: Run QA
run: make qa
10 changes: 4 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ jobs:
python-version: '3.13'
- name: Install dependencies
run: |
# First install Poetry in latest version, then install
# build and twine in matching versions. The following
# commands should not be run in a single line.
pip install poetry
pip install build twine
poetry install
curl --location --silent --show-error --fail https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
uv sync
uv sync --dev
Comment on lines +32 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Siehe oben.

- name: Run QA
run: make qa
- name: Get next version
Expand Down
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Python folders
__pycache__/
*.pyc
*.pyo
*.pyd
*.egg-info/
*.egg/
.pytest_cache/
.mypy_cache/
.ruff_cache/
.pytype/

# Package managers
.uv/
__pypackages__/
pip-wheel-metadata/

# Virtual environments
venv/
env/
.venv/
.env/

# Build and distribution
build/
dist/

# Testing and coverage
.coverage
.coverage.*
htmlcov/
.tox/

# IDE
.idea/
.vscode/
.ipynb_checkpoints/
Comment on lines +34 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das gehört hier IMHO nicht rein – das sollte in der globalen .gitignore jeder Entwicklerin und jedes Entwicklers liegen (ansonsten sammelt sich hier im Lauf der Zeit nämlich eine Unmenge an Zeugs an, für IDEs, die keiner mehr benutzt).


# OS generated files and folders
.DS_Store
39 changes: 0 additions & 39 deletions .pylintrc

This file was deleted.

55 changes: 45 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,54 @@
qa: analyze test
PACKAGE := eventsourcingdb
TEST_DIR := tests
PYTHON_DIRS := $(PACKAGE) $(TEST_DIR)

qa: analyze typecheck security test

analyze:
@poetry run pylint eventsourcingdb tests
@echo "Running code analysis..."
@uv run ruff check $(PYTHON_DIRS)

build: qa clean
@echo "Build prepared."

clean:
@echo "Cleaning up..."
@find . -type d -name __pycache__ -exec rm -rf {} +
@find . -type f -name "*.pyc" -delete
@find . -type f -name "*.pyo" -delete
@find . -type f -name "*.pyd" -delete
@find . -type f -name ".coverage" -delete
@find . -type d -name "*.egg-info" -exec rm -rf {} +
@find . -type d -name "*.egg" -exec rm -rf {} +
@find . -type d -name ".pytest_cache" -exec rm -rf {} +
@find . -type d -name ".mypy_cache" -exec rm -rf {} +
@find . -type d -name ".pyright" -exec rm -rf {} +
@find . -type d -name ".ruff_cache" -exec rm -rf {} +
@rm -rf build/ dist/ .coverage htmlcov/ .venv/

coverage:
@echo "Checking test coverage..."
@uv run pytest --cov=$(PACKAGE) --cov-report=term-missing $(TEST_DIR)

format:
@poetry run autopep8 --in-place --aggressive --max-line-length=100 --recursive eventsourcingdb tests

@echo "Formatting code..."
@uv run ruff format $(PYTHON_DIRS)

lock:
@poetry lock
@echo "Updating dependency lock..."
@uv run uv lock

test:
@poetry run pytest --maxfail=1
security:
@echo "Running security checks..."
@uv run bandit -r $(PACKAGE) -c pyproject.toml

clean:
test:
@echo "Running tests..."
@uv run pytest --maxfail=1

build: qa clean
typecheck:
@uv add pyright --dev
@echo "Running type checking..."
@uv run pyright $(PACKAGE)

.PHONY: analyze build clean format lock qa test
.PHONY: analyze build coverage format help lock qa security test typecheck clean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Da das jetzt hier ja ein bisschen länger wird, sollten wir das umbrechen (siehe zB hier: https://github.com/thenativeweb/eventsourcingdb-client-dotnet/blob/main/Makefile#L35-L40).

40 changes: 26 additions & 14 deletions eventsourcingdb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
from .bound import Bound, BoundType
from .client import Client
from .container import Container
from .event import Event, EventCandidate
from .errors import ClientError, CustomError, InternalError, ServerError, ValidationError
from .event import Event, EventCandidate
from .observe_events import (
IfEventIsMissingDuringObserve,
ObserveEventsOptions,
ObserveFromLatestEvent,
IfEventIsMissingDuringObserve
)
from .read_events import ReadEventsOptions, ReadFromLatestEvent, IfEventIsMissingDuringRead, Order
from .read_event_types import EventType
from .write_events import Precondition, IsSubjectOnEventId, IsSubjectPristine

from .read_events import IfEventIsMissingDuringRead, Order, ReadEventsOptions, ReadFromLatestEvent
from .write_events import IsSubjectOnEventId, IsSubjectPristine, Precondition

__all__ = [
'Bound', 'BoundType',
'Client',
'Container',
'Event', 'EventCandidate',
'EventType',
'ObserveEventsOptions', 'ObserveFromLatestEvent', 'IfEventIsMissingDuringObserve',
'Precondition', 'IsSubjectOnEventId', 'IsSubjectPristine',
'ReadEventsOptions', 'ReadFromLatestEvent', 'IfEventIsMissingDuringRead', 'Order',
'ClientError', 'CustomError', 'InternalError', 'ServerError', 'ValidationError',
"Bound",
"BoundType",
"Client",
"ClientError",
"Container",
"CustomError",
"Event",
"EventCandidate",
"EventType",
"IfEventIsMissingDuringObserve",
"IfEventIsMissingDuringRead",
"InternalError",
"IsSubjectOnEventId",
"IsSubjectPristine",
"ObserveEventsOptions",
"ObserveFromLatestEvent",
"Order",
"Precondition",
"ReadEventsOptions",
"ReadFromLatestEvent",
"ServerError",
"ValidationError",
]
5 changes: 1 addition & 4 deletions eventsourcingdb/bound.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ class Bound:
type: BoundType

def to_json(self) -> dict[str, str]:
return {
'id': self.id,
'type': self.type.value
}
return {"id": self.id, "type": self.type.value}
Loading