Skip to content

Commit 459c4e1

Browse files
authored
Merge pull request #15 from render-engine/fixes/chores
add dev container, run formatter, fix workflows
2 parents 821c2ff + b0cce70 commit 459c4e1

File tree

9 files changed

+79
-39
lines changed

9 files changed

+79
-39
lines changed

.devcontainer/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ARG IMAGE="python:3.12"
2+
FROM --platform=amd64 mcr.microsoft.com/vscode/devcontainers/${IMAGE}
3+
RUN apt-get update \
4+
&& export DEBIAN_FRONTEND=noninteractive \
5+
&& apt-get -y install --no-install-recommends build-essential libssl-dev gdb cmake

.devcontainer/devcontainer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "Render Engine",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
"context": "..",
9+
"args": {
10+
"IMAGE": "python:3.12"
11+
}
12+
},
13+
"postCreateCommand": ". .devcontainer/setup.sh",
14+
"customizations": {
15+
"vscode": {
16+
"settings": {
17+
"python.formatting.provider": "charliermarsh.ruff",
18+
"python.testing.pytestEnabled": true,
19+
"python.testing.pytestPath": "pytest",
20+
"python.testing.unittestEnabled": false,
21+
"python.editor.formatOnSave": true,
22+
"python.editor.codeActionsOnSave": {"source.fixAll": true},
23+
"python.testing.pytestArgs": [
24+
"tests"
25+
],
26+
".markdownlint-cli2.ignores": [".gitignore"]
27+
28+
},
29+
"extensions": [
30+
"ms-python.python",
31+
"charliermarsh.ruff",
32+
"github.github-actions",
33+
"github.github",
34+
"yzhang.markdown-all-in-one",
35+
"DavidAnson.vscode-markdownlint"
36+
]
37+
}
38+
}
39+
}

.devcontainer/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
python -m pip install --user --upgrade pip
2+
python -m pip install --user pip-tools
3+
python -m piptools compile --upgrade -o requirements.txt pyproject.toml
4+
python -m pip install --user -r requirements.txt
5+
python -m pip install -e .
6+
pre-commit install

.github/workflows/lint.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Format and Lint with Ruff and MarkdownLint
2-
on:
2+
on:
33
pull_request:
44
branches: [main]
55
workflow_dispatch:
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616
- name: Install Python
17-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.12"
2020
- name: Install dependencies
@@ -24,25 +24,17 @@ jobs:
2424
# Update output format to enable automatic inline annotations.
2525
- name: Run Ruff
2626
run: |
27-
ruff check --fix --output-format=github render_engine_parser
28-
29-
ruff format render_engine_parser
27+
ruff check . --fix --output-format=github
28+
ruff format .
3029
3130
- name: Markdown Lint base-files
32-
uses: DavidAnson/markdownlint-cli2-action@v14
31+
uses: DavidAnson/markdownlint-cli2-action@v16
3332
with:
3433
fix: true
3534
globs: |
3635
*.md
3736
.github/**/*.md
3837
continue-on-error: true
39-
- name: Markdown Lint Docs
40-
uses: DavidAnson/markdownlint-cli2-action@v14
41-
with:
42-
fix: true
43-
globs: docs/**/*.md
44-
config: docs/.markdownlint.json
45-
continue-on-error: true
4638
- name: Commit changes
4739
run: |
4840
if [ -n "$(git status --porcelain)" ]; then
@@ -52,6 +44,3 @@ jobs:
5244
git commit -m "Format and lint with Ruff"
5345
git push origin HEAD:${{ github.event.pull_request.head.ref }}
5446
fi
55-
56-
57-

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Build distribution
22

3-
on:
3+
on:
44
release:
55
types: [created]
66

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
default_language_version:
4+
python: python3.12
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.5.0
8+
hooks:
9+
- id: check-yaml
10+
- id: check-toml
11+
- id: end-of-file-fixer
12+
- id: trailing-whitespace
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.3.7
15+
hooks:
16+
- id: ruff
17+
args: ["--fix"]
18+
# Run the formatter.
19+
- id: ruff-format

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dev = [
1717
"pytest",
1818
"pytest-cov",
1919
"ruff",
20-
]
20+
]
2121

2222

2323
[tool.setuptools_scm]
@@ -37,8 +37,7 @@ version_toml = "pyproject.toml:project.version"
3737
branch = "main"
3838

3939
[tool.ruff]
40-
select = ["E", "F", "I", "UP"]
40+
lint.select = ["E", "F", "I", "UP"]
4141
target-version = "py311"
4242
line-length = 120
4343
src = ["src"]
44-
ignore-init-module-imports = true

requirements.txt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.13
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
5-
# pip-compile --extra=dev
5+
# pip-compile --output-file=requirements.txt pyproject.toml
66
#
7-
coverage[toml]==7.6.1
8-
# via pytest-cov
9-
iniconfig==2.0.0
10-
# via pytest
11-
packaging==24.1
12-
# via pytest
13-
pluggy==1.5.0
14-
# via pytest
15-
pytest==8.3.2
16-
# via
17-
# pytest-cov
18-
# render_engine_parser (pyproject.toml)
19-
pytest-cov==5.0.0
20-
# via render_engine_parser (pyproject.toml)
217
python-frontmatter==1.1.0
228
# via render_engine_parser (pyproject.toml)
239
pyyaml==6.0.2
2410
# via python-frontmatter
25-
ruff==0.6.4
26-
# via render_engine_parser (pyproject.toml)

tests/test_base_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import frontmatter
22
import pytest
3-
43
from render_engine_parser.base_parsers import BasePageParser, parse_content
54

65

0 commit comments

Comments
 (0)