Skip to content

Commit 5264f95

Browse files
committed
Standardised pyproject.toml and adjusted Makefile.
Also removed unused lines from .readthedocs.yaml.
1 parent 80ccb39 commit 5264f95

File tree

6 files changed

+230
-270
lines changed

6 files changed

+230
-270
lines changed

.github/workflows/runtests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: make install-poetry
5252

5353
- name: Install packages
54-
run: make install-packages
54+
run: make install
5555

5656
- name: Lint
5757
run: make lint

.readthedocs.yaml

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
11
# Read the Docs configuration file for Sphinx projects
22
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
33

4-
# Required
54
version: 2
6-
7-
# Set the OS, Python version and other tools you might need
85
build:
96
os: ubuntu-22.04
107
tools:
118
python: "3.11"
12-
# jobs:
13-
# post_create_environment:
14-
# # Install poetry
15-
# # https://python-poetry.org/docs/#installing-manually
16-
# - POETRY=/home/docs/.local/bin/poetry make install-poetry
17-
## - pip install poetry
18-
# post_install:
19-
# # Install dependencies with 'docs' dependency group
20-
# # https://python-poetry.org/docs/managing-dependencies/#dependency-groups
21-
# # VIRTUAL_ENV needs to be set manually for now.
22-
# # See https://github.com/readthedocs/readthedocs.org/pull/11152/
23-
# - POETRY=/home/docs/.local/bin/poetry VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make install-packages
24-
## - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --extras "crypto" --with docs
25-
26-
# commands:
27-
# - POETRY=/home/docs/.local/bin/poetry make install-poetry
28-
# - POETRY=/home/docs/.local/bin/poetry make install
29-
# - POETRY=/home/docs/.local/bin/poetry make docs
30-
# - ls -l ./docs/_build/html/*
31-
# - mkdir --parents $READTHEDOCS_OUTPUT/html/
32-
# - cp --recursive ./docs/_build/html/* $READTHEDOCS_OUTPUT/html/
33-
349
jobs:
3510
install:
3611
- python --version
@@ -57,49 +32,8 @@ build:
5732
- ls -l ./docs/_build/latex/*
5833
- mkdir -p $READTHEDOCS_OUTPUT/pdf/
5934
- cp ./docs/_build/latex/eventsourcing.pdf $READTHEDOCS_OUTPUT/pdf/
60-
# htmlzip:
61-
# - echo "Override default build command for htmlzip format"
62-
# - mkdir -p $READTHEDOCS_OUTPUT/htmlzip/
63-
64-
65-
66-
# jobs:
67-
# pre_create_environment:
68-
# # Select Python version (keep in sync with other versions):
69-
# - asdf install python 3.11.5
70-
# - asdf global python 3.11.5
71-
# - python -m pip install --upgrade --no-cache-dir virtualenv
72-
#
73-
# # Install poetry:
74-
# - asdf plugin add poetry
75-
# - asdf install poetry 1.5.1
76-
# - asdf global poetry 1.5.1
77-
# - poetry config virtualenvs.create false
78-
# post_install:
79-
# # Install dependencies with 'docs' dependency group
80-
# # https://python-poetry.org/docs/managing-dependencies/#dependency-groups
81-
## - poetry install --with docs
82-
# - make install
83-
84-
# Build documentation in the "docs/" directory with Sphinx
8535
sphinx:
8636
configuration: docs/conf.py
87-
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
88-
# builder: "dirhtml"
89-
# Fail on all warnings to avoid broken references
90-
# fail_on_warning: true
91-
92-
# Optionally build your docs in additional formats such as PDF and ePub
9337
formats:
9438
- pdf
9539
- epub
96-
97-
# Optional but recommended, declare the Python requirements required
98-
# to build your documentation
99-
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
100-
#python:
101-
# install:
102-
# - method: pip
103-
# path: .
104-
# extra_requirements:
105-
# - docs

Makefile

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,35 @@ python-version:
2222

2323
.PHONY: install
2424
install:
25-
$(POETRY) sync --extras "crypto cryptography" --with "docs" -vv $(opts)
25+
$(POETRY) sync --all-extras --with "docs" $(opts)
2626

27-
.PHONY: install-packages
28-
install-packages:
29-
$(POETRY) sync --no-root --extras "crypto cryptography" --with "docs" -vv $(opts)
27+
.PHONY: update
28+
update: update-lock install
3029

31-
.PHONY: poetry-update
32-
poetry-update:
33-
$(POETRY) update
30+
.PHONY: update-lock
31+
update-lock:
32+
$(POETRY) update --lock -v
33+
34+
35+
.PHONY: fmt
36+
fmt: fmt-isort fmt-black
37+
38+
.PHONY: fmt-ruff
39+
fmt-ruff:
40+
$(POETRY) run ruff check --fix eventsourcing tests examples
41+
42+
.PHONY: fmt-ruff-unsafe
43+
fmt-ruff-unsafe:
44+
$(POETRY) run ruff --fix --unsafe-fixes eventsourcing
45+
46+
.PHONY: fmt-black
47+
fmt-black:
48+
$(POETRY) run black eventsourcing tests examples
49+
50+
.PHONY: fmt-isort
51+
fmt-isort:
52+
$(POETRY) run isort eventsourcing tests examples
3453

35-
.PHONY: update
36-
update: poetry-update install-packages
3754

3855
.PHONY: lint
3956
lint: lint-black lint-ruff lint-isort lint-mypy lint-pyright #lint-dockerfile
@@ -68,26 +85,6 @@ lint-mypy:
6885
# @docker run --rm -i replicated/dockerfilelint:ad65813 < ./dev/Dockerfile_eventsourcing_requirements
6986
#
7087

71-
.PHONY: fmt
72-
fmt: fmt-isort fmt-black
73-
74-
.PHONY: fmt-ruff
75-
fmt-ruff:
76-
$(POETRY) run ruff check --fix eventsourcing tests examples
77-
78-
.PHONY: fmt-ruff-unsafe
79-
fmt-ruff-unsafe:
80-
$(POETRY) run ruff --fix --unsafe-fixes eventsourcing
81-
82-
.PHONY: fmt-black
83-
fmt-black:
84-
$(POETRY) run black eventsourcing tests examples
85-
86-
.PHONY: fmt-isort
87-
fmt-isort:
88-
$(POETRY) run isort eventsourcing tests examples
89-
90-
9188

9289
.PHONY: test
9390
test: coveragetest coverage100 timeit

docs/topics/installing.rst

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,22 @@ fork and clone the GitHub repository.
157157
Once you have cloned the project's GitHub repository, change into the root folder,
158158
or open the project in an IDE. You should see a Makefile.
159159

160-
If you don't already have Poetry installed, run `make install-poetry`.
160+
If you don't already have the required version of Poetry installed, running
161+
`make install-poetry` will install it with pipx, using a suffix to indicate
162+
the version e.g. 'poetry@2.1.2'.
161163

162164
::
163165

164166
$ make install-poetry
165167

166168

167-
Run `make install-packages` to create a new virtual environment and
168-
install packages that are needed for development, such as Sphinx, Coverage.py, Black,
169-
mypy, ruff, and isort.
169+
Run `make install` to create a new virtual environment and install packages that
170+
are needed for development, such as sphinx, coverage, black, ruff, isort, mypy,
171+
and pyright.
170172

171173
::
172174

173-
$ make install-packages
175+
$ make install
174176

175177

176178
Once installed, check the project's test suite passes by running `make test`.
@@ -200,20 +202,20 @@ and user. You may prefer to run PostgreSQL in a Docker container.
200202
postgres=# CREATE SCHEMA myschema AUTHORIZATION eventsourcing;
201203

202204

203-
Check the syntax and static types are correct by running `make lint`.
205+
The code can be automatically reformatted using the following command
206+
(which uses isort and Black). Ruff and mypy errors will often need
207+
to be fixed by hand.
204208

205209
::
206210

207-
$ make lint
211+
$ make fmt
208212

209213

210-
The code can be automatically reformatted using the following command
211-
(which uses isort and Black). Ruff and mypy errors will often need
212-
to be fixed by hand.
214+
Check the syntax and static types are correct by running `make lint`.
213215

214216
::
215217

216-
$ make fmt
218+
$ make lint
217219

218220

219221
You can build the docs (and check they build) with `make docs`.
@@ -224,3 +226,7 @@ You can build the docs (and check they build) with `make docs`.
224226

225227
Before submitting Pull Requests on GitHub, please make sure everything is working
226228
by running `make docs lint test`.
229+
230+
::
231+
232+
$ make docs lint test

0 commit comments

Comments
 (0)