Skip to content
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

save temp #53

Closed
wants to merge 2 commits into from
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
21 changes: 11 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.13.2
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.8
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.4.2
- id: uv-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.4
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.1.0
hooks:
- id: flake8
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.12
hooks:
Expand Down
49 changes: 28 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
.PHONY: list
list:
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

migrate:
@python manage.py migrate
# .PHONY: list
# list:
# @LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
.PHONY: help
help:
@echo "Usage: make [target]"
@echo ""
@echo "Commands for development"
@echo "====================================================================="
@echo " admin: Create superuser"
@echo " mail: Start mail server"
@echo " migrate: Apply migrations"
@echo " run: Run the development server"
@echo " test: Run tests"

admin:
@echo "Creating superuser"
@echo "from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('admin', '', 'admin')" | python manage.py shell
@echo "from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('test', '[email protected]', 'test')" | uv run manage.py shell
@echo "Created superuser with username 'test' and password 'test'"

mail:
@echo "Starting mail server"
@docker rm -f mailhog
@cp tests/local.py.example tests/local.py
@docker run -it -p 8025:8025 -p 1025:1025 --name mailhog mailhog/mailhog

migrate:
@uv run manage.py migrate

run:
@python manage.py runserver 0.0.0.0:8000
@uv run manage.py runserver 0.0.0.0:8000

test:
@echo "Running tests..."
@coverage run manage.py test --deprecation all
@coverage report -m

mail:
@echo "Starting mail server"
@cp tests/local.py.example tests/local.py
@docker run -d -p 8025:8025 -p 1025:1025 --name mailhog mailhog/mailhog
@make run
@uv run coverage run manage.py test --deprecation all
@uv run coverage report -m

mail-stop:
@echo "Stopping mail server"
@docker stop mailhog
@docker rm mailhog
12 changes: 6 additions & 6 deletions docs/contrubute.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ git clone https://github.com/nickmoreton/wagtail-qrcode
## Setup a virtual environment

```bash
python3 -m venv venv
source venv/bin/activate
uv sync
source .venv/bin/activate
```

## Install the package into your virtual environment
## Setup the testing app

```bash
pip install -e ".[development,testing]"
make migrate && make admin
```

## Setup the testing app
## Run the development server

```bash
make migrate && make admin && make run
make run
```

The app can be viewed at <http://localhost:8000>
Expand Down
41 changes: 10 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,46 +28,25 @@ classifiers = [
"Framework :: Wagtail :: 5",
"Framework :: Wagtail :: 6",
]

requires-python = ">=3.9"

dependencies =[
"Wagtail>=4.1",
"PyQRCode>=1,<2"
]

[project.optional-dependencies]
development = [
"black==24.4.2",
"flake8==7.1.0",
"isort==5.13.0",
]
testing = [
"coverage"
[dependency-groups]
dev = [
"coverage>=7.6.9",
"ruff>=0.8.4",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project.urls]
Repository = "https://github.com/wagtail-packages/wagtail-qrcode"
Issues = "https://github.com/wagtail-packages/wagtail-qrcode/issues"
Changelog = "https://github.com/wagtail-packages/wagtail-qrcode/blob/release/CHANGELOG.md"


[tool.black]
line-length = 88
target-version = ['py39']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''

[tool.isort]
profile = "black"
Loading
Loading