Skip to content

Commit

Permalink
Merge branch '9.2' into main
Browse files Browse the repository at this point in the history
# Conflicts:
#	eventsourcing/__init__.py
  • Loading branch information
johnbywater committed Jan 21, 2024
2 parents 3028b2a + e6b25bc commit aed6d36
Show file tree
Hide file tree
Showing 100 changed files with 3,575 additions and 848 deletions.
11 changes: 11 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[flake8]
exclude = .git,__pycache__,.eggs,*.egg,.pip-cache,.poetry,.venv,dist,*_pb2.py,*_pb2_grpc.py
max-line-length = 88
select = C,E,F,W,B,B950
ignore = C101, E203, E501, W503, B027, E704


# ignore = E203,E266,E501,W503,B907,E231
# max-complexity = 18
# select = B,C,E,F,W,T4,B9

4 changes: 2 additions & 2 deletions .github/workflows/runtests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
max-parallel: 20
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
postgres-version: ["12", "13", "14", "15"]

# Service containers to run with `runner-job`
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
max-parallel: 5
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
24 changes: 18 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ build:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- make install-poetry
# Tell poetry to not use a virtual environment
- poetry config virtualenvs.create false
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# - poetry install --with docs
- make install-packages

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand All @@ -30,9 +42,9 @@ sphinx:
# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- method: pip
path: .
extra_requirements:
- docs
#python:
# install:
# - method: pip
# path: .
# extra_requirements:
# - docs
278 changes: 136 additions & 142 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,197 +3,191 @@ DOTENV_FILE ?= dev/.env

-include $(DOTENV_FILE)

.PHONY: install
install:
@pip install -U pip
@pip install wheel
@pip install -e ".[dev]"

.PHONY: docker-pull
docker-pull:
@docker-compose pull

.PHONY: docker-build
docker-build:
@docker-compose build

.PHONY: docker-up
docker-up:
@docker-compose up -d
@docker-compose ps

.PHONY: docker-stop
docker-stop:
@docker-compose stop

.PHONY: docker-down
docker-down:
@docker-compose down -v --remove-orphans


.PHONY: docker-logs
docker-logs:
@docker-compose logs --follow --tail=1000
POETRY ?= poetry
POETRY_VERSION=1.5.1
POETRY_INSTALLER_URL ?= https://install.python-poetry.org
PYTHONUNBUFFERED=1
SAMPLES_LINE_LENGTH=70

.PHONY: install-poetry
install-poetry:
curl -sSL $(POETRY_INSTALLER_URL) | python3
$(POETRY) --version

.PHONY: install-packages
install-packages:
$(POETRY) --version
$(POETRY) install --no-root --all-extras -vv $(opts)

.PHONY: update-packages
update-packages:
$(POETRY) update -vv

.PHONY: lint
lint: lint-black lint-flake8 lint-isort lint-mypy #lint-dockerfile

.PHONY: lint-black
lint-black:
@black --check --diff eventsourcing
@black --check --diff setup.py
$(POETRY) run black --check --diff eventsourcing

.PHONY: lint-flake8
lint-flake8:
@flake8 eventsourcing
$(POETRY) run flake8 eventsourcing

.PHONY: lint-isort
lint-isort:
@isort --check-only --diff eventsourcing
$(POETRY) run isort --check-only --diff eventsourcing

.PHONY: lint-mypy
lint-mypy:
@mypy eventsourcing
$(POETRY) run mypy eventsourcing

.PHONY: lint-dockerfile
lint-dockerfile:
@docker run --rm -i replicated/dockerfilelint:ad65813 < ./dev/Dockerfile_eventsourcing_requirements

.PHONY: lint
lint: lint-isort lint-black lint-flake8 lint-mypy #lint-dockerfile
# .PHONY: lint-dockerfile
# lint-dockerfile:
# @docker run --rm -i replicated/dockerfilelint:ad65813 < ./dev/Dockerfile_eventsourcing_requirements
#

.PHONY: fmt
fmt: fmt-isort fmt-black

.PHONY: fmt-black
fmt-black:
$(POETRY) run black eventsourcing

.PHONY: fmt-isort
fmt-isort:
@isort eventsourcing
$(POETRY) run isort eventsourcing

.PHONY: fmt-black
fmt-black:
@black eventsourcing
@black setup.py

.PHONY: fmt
fmt: fmt-isort fmt-black
.PHONY: test
test: coveragetest coverage100 timeit

.PHONY: coveragetest
coveragetest:
$(POETRY) run coverage run -m unittest discover . -v

.PHONY: coverage100
coverage100:
$(POETRY) run coverage report --fail-under=100 --show-missing

.PHONY: unittest
unittest:
@python -m unittest discover . -v
$(POETRY) run python -m unittest discover . -v



.PHONY: timeit
timeit: timeit_popo timeit_sqlite timeit_postgres

.PHONY: timeit_popo
timeit_popo:
TEST_TIMEIT_FACTOR=500 python -m unittest eventsourcing.tests.application_tests.test_application_with_popo
TEST_TIMEIT_FACTOR=500 $(POETRY) run python -m unittest eventsourcing.tests.application_tests.test_application_with_popo

.PHONY: timeit_sqlite
timeit_sqlite:
TEST_TIMEIT_FACTOR=500 python -m unittest eventsourcing.tests.application_tests.test_application_with_sqlite
TEST_TIMEIT_FACTOR=500 $(POETRY) run python -m unittest eventsourcing.tests.application_tests.test_application_with_sqlite

.PHONY: timeit_postgres
timeit_postgres:
TEST_TIMEIT_FACTOR=500 python -m unittest eventsourcing.tests.application_tests.test_application_with_postgres

.PHONY: rate
rate: rate_popo rate_sqlite rate_postgres

.PHONY: rate_popo
rate_popo:
python -m unittest eventsourcing.tests.persistence_tests.test_popo.TestPOPOApplicationRecorder.test_concurrent_throughput
TEST_TIMEIT_FACTOR=500 $(POETRY) run python -m unittest eventsourcing.tests.application_tests.test_application_with_postgres

.PHONY: rate_sqlite
rate_sqlite:
python -m unittest eventsourcing.tests.persistence_tests.test_sqlite.TestSQLiteApplicationRecorder.test_concurrent_throughput
python -m unittest eventsourcing.tests.persistence_tests.test_sqlite.TestSQLiteApplicationRecorder.test_concurrent_throughput_in_memory_db
.PHONY: build
build:
$(POETRY) build
# $(POETRY) build -f sdist # build source distribution only

.PHONY: rate_postgres
rate_postgres:
python -m unittest eventsourcing.tests.persistence_tests.test_postgres.TestPostgresApplicationRecorder.test_concurrent_throughput
.PHONY: publish
publish:
$(POETRY) publish

.PHONY: coveragetest
coveragetest:
@coverage run -m unittest discover . -v
# @coverage run \
# --concurrency=multiprocessing \
# -m unittest discover \
eventsourcing -vv --failfast
# @coverage combine
# @coverage report
# @coverage html
.PHONY: docker-pull
docker-pull:
@docker-compose pull

.PHONY: coverage100
coverage100:
@coverage report --fail-under=100 --show-missing
.PHONY: docker-build
docker-build:
@docker-compose build

.PHONY: coveragehtml
coveragehtml:
@coverage html
.PHONY: docker-up
docker-up:
@docker-compose up -d
@docker-compose ps

.PHONY: test
test: coveragetest coverage100 timeit
.PHONY: docker-stop
docker-stop:
@docker-compose stop

.PHONY: coverage
coverage: coveragetest coveragehtml coverage100
.PHONY: docker-down
docker-down:
@docker-compose down -v --remove-orphans

.PHONY: prepush
prepush: drop_postgres_db create_postgres_db updatetools lint docs test

.PHONY: drop_postgres_db
drop_postgres_db:
dropdb eventsourcing
.PHONY: docker-logs
docker-logs:
@docker-compose logs --follow --tail=1000

.PHONY: create_postgres_db
create_postgres_db:
createdb eventsourcing
psql eventsourcing -c "CREATE SCHEMA myschema AUTHORIZATION eventsourcing"

.PHONY: updatetools
updatetools:
pip install -U pip
pip install -U black mypy flake8 flake8-bugbear isort
#
#
# .PHONY: coverage
# coverage: coveragetest coveragehtml coverage100
#
# .PHONY: prepush
# prepush: drop_postgres_db create_postgres_db updatetools lint docs test
#
# .PHONY: drop_postgres_db
# drop_postgres_db:
# dropdb eventsourcing
#
# .PHONY: create_postgres_db
# create_postgres_db:
# createdb eventsourcing
# psql eventsourcing -c "CREATE SCHEMA myschema AUTHORIZATION eventsourcing"
#
# .PHONY: updatetools
# updatetools:
# pip install -U pip
# pip install -U black mypy flake8 flake8-bugbear isort python-coveralls coverage orjson pydantic
#

.PHONY: docs
docs:
cd docs && make html


.PHONY: brew-services-start
brew-services-start:
# brew services start mysql
brew services start postgresql
# brew services start redis
# ~/axonserver/axonserver.jar &
# cassandra -f &


.PHONY: brew-services-stop
brew-services-stop:
# brew services stop mysql || echo "Mysql couldn't be stopped"
brew services stop postgresql || echo "PostgreSQL couldn't be stopped"
# brew services stop redis || echo "Redis couldn't be stopped"
# pkill -15 java


.PHONY: prepare-dist
prepare-dist:
python ./dev/prepare-distribution.py


.PHONY: release-dist
release-dist:
python ./dev/release-distribution.py


.PHONY: test-released-distribution
test-released-distribution:
python ./dev/test-released-distribution.py

#.PHONY: generate-grpc-protos
#generate-grpc-protos:
# python -m grpc_tools.protoc \
# --proto_path=./eventsourcing/system/grpc \
# --python_out=eventsourcing/system/grpc \
# --grpc_python_out=eventsourcing/system/grpc \
# eventsourcing/system/grpc/processor.proto

.PHONY: ramdisk
ramdisk:
diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://204800`
#
# .PHONY: brew-services-start
# brew-services-start:
# # brew services start mysql
# brew services start postgresql
# # brew services start redis
# # ~/axonserver/axonserver.jar &
# # cassandra -f &
#
#
# .PHONY: brew-services-stop
# brew-services-stop:
# # brew services stop mysql || echo "Mysql couldn't be stopped"
# brew services stop postgresql || echo "PostgreSQL couldn't be stopped"
# # brew services stop redis || echo "Redis couldn't be stopped"
# # pkill -15 java
#
#
# .PHONY: prepare-dist
# prepare-dist:
# python ./dev/prepare-distribution.py
#
#
# .PHONY: release-dist
# release-dist:
# python ./dev/release-distribution.py
#
#
# .PHONY: test-released-distribution
# test-released-distribution:
# python ./dev/test-released-distribution.py
#
#
# .PHONY: ramdisk
# ramdisk:
# diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://204800`
Loading

0 comments on commit aed6d36

Please sign in to comment.