Skip to content

Commit 6d8087c

Browse files
authored
Merge pull request #5 from IMIO/uv
Update Makefile with uv tools and .gitignore
2 parents 5a8e851 + 17e5a8d commit 6d8087c

File tree

4 files changed

+68
-110
lines changed

4 files changed

+68
-110
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ pyvenv.cfg
2828
eggs/
2929
.vscode
3030
.lock
31+
.DS_Store
32+
resources/

.pre-commit-config.yaml

Lines changed: 30 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,36 @@
1+
---
2+
default_stages:
3+
- pre-commit
4+
- pre-push
15
repos:
2-
- repo: https://github.com/chriskuehl/puppet-pre-commit-hooks.git
3-
rev: v2.0.1
6+
- repo: "https://github.com/pre-commit/pre-commit-hooks"
7+
rev: v5.0.0
48
hooks:
5-
- id: puppet-validate
6-
stages: [commit, push]
7-
- id: erb-validate
8-
stages: [commit, push]
9-
- id: epp-validate
10-
stages: [commit, push]
11-
- id: puppet-lint
12-
stages: [commit, push]
13-
- repo: git://github.com/pre-commit/pre-commit-hooks
14-
rev: v1.2.3
9+
- id: check-json
10+
- id: check-merge-conflict
11+
- id: check-symlinks
12+
- id: check-yaml
13+
- repo: "https://github.com/asottile/yesqa"
14+
rev: v1.5.0
1515
hooks:
16-
- id: trailing-whitespace
17-
stages: [commit, push]
18-
- id: check-json
19-
stages: [commit, push]
20-
- id: flake8
21-
stages: [commit, push]
22-
- id: check-yaml
23-
stages: [commit, push]
24-
- id: check-xml
25-
stages: [commit, push]
26-
- id: check-merge-conflict
27-
stages: [commit, push]
28-
- id: debug-statements
29-
stages: [commit, push]
30-
- id: fix-encoding-pragma
31-
stages: [commit, push]
32-
- id: check-symlinks
33-
stages: [commit, push]
34-
- id: debug-statements
35-
stages: [commit, push]
36-
- repo: https://github.com/jumanjihouse/pre-commit-hooks.git
37-
rev: 1.6.0
16+
- id: yesqa
17+
- repo: "https://github.com/adrienverge/yamllint"
18+
rev: v1.37.1
3819
hooks:
39-
- id: shellcheck
40-
stages: [commit, push]
41-
- id: shfmt
42-
stages: [commit, push]
43-
- repo: https://github.com/pre-commit/mirrors-csslint.git
44-
rev: 845a4fd9e41e6227b237ddd6054c33b5a08f9fb0
20+
- id: yamllint
21+
args: ["-d", "relaxed"]
22+
- repo: "https://github.com/jorisroovers/gitlint.git"
23+
rev: v0.19.1
4524
hooks:
46-
- id: csslint
47-
stages: [commit, push]
48-
- repo: https://github.com/asottile/yesqa
49-
rev: f657d64b0ca01f7f44ee0006c2990af988139c28
25+
- id: gitlint
26+
stages:
27+
- commit-msg
28+
- repo: local
5029
hooks:
51-
- id: yesqa
52-
stages: [commit, push]
53-
- repo: https://github.com/adrienverge/yamllint
54-
rev: 506e066410052c42da36c237b8ba3c661448c86b
55-
hooks:
56-
- id: yamllint
57-
stages: [commit, push]
58-
#- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
59-
# rev: 8535cb046711121d3591fa31843e2be3f3a26813
60-
# hooks:
61-
# - id: dockerfile_lint
62-
# stages: [commit, push]
63-
- repo: https://github.com/jorisroovers/gitlint.git
64-
rev: e4e627dd5b5f1dbc1168782ea6fd9874242fa41a
65-
hooks:
66-
- id: gitlint
67-
stages: [commit-msg]
68-
69-
#- repo: local
70-
# hooks:
71-
# - id: run-tests
72-
# name: Running local test
73-
# entry: make test
74-
# language: system
75-
# stages: [commit, push]
30+
- id: check-dockerfile
31+
name: "Check dockerfile"
32+
entry: 'bash -c "docker run --rm -i hadolint/hadolint < Dockerfile"'
33+
pass_filenames: false
34+
language: system
35+
types:
36+
- dockerfile

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

Makefile

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,48 @@
1-
#!/usr/bin/make
2-
all: buildout
1+
VENV_FOLDER=.venv
32

4-
IMAGE_NAME="harbor.imio.be/web/library/mutual:latest"
5-
MID=couvin
3+
ifeq (, $(shell which uv ))
4+
$(error "[ERROR] The 'uv' command is missing from your PATH. Install it from: https://docs.astral.sh/uv/getting-started/installation/")
5+
endif
66

7-
buildout.cfg:
8-
ln -fs dev.cfg buildout.cfg
9-
10-
bin/buildout: bin/pip buildout.cfg
11-
bin/uv pip install -r requirements.txt
12-
13-
buildout: bin/instance
7+
.PHONY: help
8+
help: ## Display this help message
9+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
1410

15-
bin/instance: bin/buildout
16-
bin/buildout
11+
.PHONY: install
12+
install: $(VENV_FOLDER)/bin/buildout .git/hooks/pre-commit ## Install development environment
13+
$(VENV_FOLDER)/bin/buildout
1714

18-
bin/pip:
19-
python3.10 -m venv .
20-
bin/pip install uv
21-
22-
run: bin/instance
15+
.PHONY: start
16+
start: bin/instance .git/hooks/pre-commit ## Start the instance
2317
bin/instance fg
2418

25-
docker-image:
26-
docker build --pull -t library/mutual:latest .
27-
28-
eggs: ## Copy eggs from docker image to speed up docker build
29-
-docker run --entrypoint='' $(IMAGE_NAME) tar -c -C /plone eggs | tar x
30-
mkdir -p eggs
19+
.PHONY: cleanall
20+
cleanall: ## Clean development environment
21+
rm -fr .git/hooks/pre-commit .installed.cfg .mr.developer.cfg .venv bin buildout.cfg develop-eggs downloads eggs include lib lib64 local parts pyvenv.cfg
3122

32-
cleanall:
33-
rm -fr develop-eggs downloads eggs parts .installed.cfg lib lib64 include bin .mr.developer.cfg local/
23+
.PHONY: upgrade-steps
24+
upgrade-steps: ## Run upgrade steps
25+
bin/instance -O Plone run scripts/run_portal_upgrades.py
3426

35-
rsync:
36-
rsync -P imio@bibliotheca.imio.be:/srv/instances/$(MID)/filestorage/Data.fs var/filestorage/Data.fs
37-
rsync -r --info=progress2 imio@bibliotheca.imio.be:/srv/instances/$(MID)/blobstorage/ var/blobstorage/
27+
.PHONY: lint
28+
lint: ## Run pre-commit hooks
29+
uvx pre-commit run --all
3830

39-
bash:
40-
docker-compose run --rm -p 8080:8080 -u imio instance bash
31+
.venv:
32+
@echo "Creating virtual environment with uv"
33+
uv venv
4134

42-
chown-docker-dev:
43-
sudo chown 913:209 -R var
35+
buildout.cfg:
36+
ln -fs dev.cfg buildout.cfg
4437

45-
chown-local-dev:
46-
sudo chown $(USER):$(USER) -R src/plone.app.contenttypes
47-
sudo chown $(USER):$(USER) -R src/plone.outputfilters
48-
sudo chown $(USER):$(USER) -R var
38+
$(VENV_FOLDER)/bin/buildout: .venv buildout.cfg
39+
@echo "Installing requirements with uv pip interface"
40+
uv pip install -r requirements.txt
4941

50-
upgrade-steps:
51-
bin/instance -O plone run scripts/run_portal_upgrades.py
42+
bin/instance: $(VENV_FOLDER)/bin/buildout
43+
@echo "Bootstrapping environment with buildout"
44+
$(VENV_FOLDER)/bin/buildout
5245

53-
test-image:
54-
echo "todo"
46+
.git/hooks/pre-commit: .venv
47+
@echo "Installing pre-commit hooks"
48+
uvx pre-commit install

0 commit comments

Comments
 (0)