Skip to content

Commit 50813e1

Browse files
Fixed mkdocsignore and improved DevExp (#24)
- improved dev experience - pre-commit and better linting handling - fixed mkdocsignore (close #28) - added 3rd party plugins compatibility - poetry-dynamic-versioning support - added GitHub Dependency Review support
1 parent d67714b commit 50813e1

57 files changed

Lines changed: 2359 additions & 452 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"ms-python.python",
3737
"ms-python.vscode-pylance",
3838
"ms-python.isort",
39-
"yzhang.markdown-all-in-one"
39+
"yzhang.markdown-all-in-one",
40+
"charliermarsh.ruff"
4041
]
4142
}
4243
}

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@ end_of_line = lf
66
trim_trailing_whitespace = true
77
insert_final_newline = true
88
indent_style = tab
9+
indent_size = 2
910

1011
[*.{cmd,bat}]
1112
end_of_line = crlf
1213

1314
[*.{yml,yaml,pages,md,markdown}]
1415
indent_style = space
15-
indent_size = 2
1616

1717
[*.py]
1818
indent_style = space
1919
indent_size = 4
20-
21-
[*.json]
22-
indent_size = 2

.file-filter.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@
22
# include_glob:
33
# - "test/test.md"
44
# - "**/draft-*.md"
5-
# exclude_glob:
6-
# - "Contributions/**"
75
# include_tag:
86
# - foo
97
# - "#bar"
108
# exclude_tag:
11-
# - test
9+
# - "#bar"
1210

13-
only_doc_pages: true # default value is false
14-
exclude_regex:
15-
- '.*\.md$'
16-
include_regex:
17-
- "tags.md"
11+
# INCLUDE ONLY DOC TAGED WITH 'released'
12+
# only_doc_pages: true
13+
# exclude_regex:
14+
# - '.*\.md$'
15+
# include_tag:
16+
# - released
17+
18+
only_doc_pages: true
19+
mkdocsignore: true
20+
exclude_glob:
21+
- "**/draft-*.md"
22+
- "**/preview-*.md"
1823
include_tag:
1924
- released
25+
- public preview
26+
exclude_tag:
27+
- draft
28+
include_regex:
29+
- "tags.md"

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[flake8]
2-
max-line-length = 88
2+
max-line-length = 120
33
exclude = .git,__pycache__,.tox,.eggs,*.egg,.venv

.github/workflows/workflow.ci.yml

Lines changed: 80 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,30 @@ on:
2121

2222
# Allow one concurrent
2323
concurrency:
24-
group: pr-${{ github.ref }}
24+
group: ${{ format('{0}-{1}', github.event_name, github.ref) }}
2525
cancel-in-progress: true
2626

27+
permissions:
28+
contents: read
29+
2730
jobs:
31+
dependency-review:
32+
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
33+
name: Dependency Review
34+
runs-on: ubuntu-latest
35+
permissions:
36+
pull-requests: write
37+
steps:
38+
- name: Checkout Repo
39+
uses: actions/checkout@v3
40+
41+
- name: Run Dependency Review
42+
uses: actions/dependency-review-action@v3
43+
with:
44+
comment-summary-in-pr: true
45+
2846
lint:
29-
if: ${{ !github.event.pull_request.draft }}
47+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) }}
3048
name: Lint
3149
runs-on: ubuntu-latest
3250
steps:
@@ -39,29 +57,41 @@ jobs:
3957
- name: Setup Python
4058
uses: actions/setup-python@v4
4159
with:
42-
python-version: "3.10"
43-
cache: "poetry"
60+
python-version-file: .python-version
61+
cache: poetry
4462

4563
- name: Install dependencies
46-
run: poetry install --verbose --only=dev
64+
run: |
65+
poetry self add "poetry-dynamic-versioning[plugin]"
66+
poetry install --verbose --all-extras --only=dev
67+
68+
# - name: Run ruff
69+
# run: poetry run ruff -v check .
4770

48-
- name: Check imports sort
49-
run: poetry run isort --profile black --check-only .
71+
- name: Run mypy
72+
run: poetry run mypy --config-file pyproject.toml
5073

51-
- name: Check formatting
52-
run: poetry run black --check .
74+
- name: Run isort
75+
run: poetry run isort --settings-path pyproject.toml --check-only .
5376

54-
- name: Check formatting
77+
- name: Run black
78+
run: poetry run black --config pyproject.toml --check .
79+
80+
- name: Run flake8
5581
run: poetry run flake8 --count .
5682

57-
test:
58-
if: ${{ !github.event.pull_request.draft }}
59-
name: Test
60-
needs: lint
83+
- name: Run bandit
84+
run: poetry run bandit --configfile pyproject.toml --recursive .
85+
86+
test-self:
87+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) }}
88+
name: Test (self)
89+
needs:
90+
- lint
6191
strategy:
6292
fail-fast: false
6393
matrix:
64-
python-version: ["3.8", "3.9", "3.10"]
94+
python-version: ["3.8", "3.9", "3.10", "3.11"]
6595
os: [ubuntu-latest, macos-latest, windows-latest]
6696
runs-on: ${{ matrix.os }}
6797
steps:
@@ -75,18 +105,45 @@ jobs:
75105
uses: actions/setup-python@v4
76106
with:
77107
python-version: ${{ matrix.python-version }}
78-
cache: "poetry"
108+
cache: poetry
79109

80110
- name: Install dependencies
81-
run: poetry install --verbose
111+
run: |
112+
poetry self add "poetry-dynamic-versioning[plugin]"
113+
poetry install --verbose --without=dev
82114
83115
- name: Test Build
84-
run: |
85-
poetry version --verbose
86-
poetry build --verbose
116+
run: poetry build --verbose
87117

88118
- name: Test MkDocs build
119+
run: poetry run mkdocs build --verbose
120+
121+
test-plugins:
122+
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
123+
name: Test (plugins)
124+
needs:
125+
- test-self
126+
runs-on: ubuntu-latest
127+
steps:
128+
- name: Checkout Repo
129+
uses: actions/checkout@v3
130+
131+
- name: Install Poetry
132+
run: pipx install poetry
133+
134+
- name: Setup Python
135+
uses: actions/setup-python@v4
136+
with:
137+
python-version-file: .python-version
138+
cache: poetry
139+
140+
- name: Install dependencies
89141
run: |
90-
pip uninstall -y mkdocs_file_filter_plugin
91-
pip install dist/mkdocs_file_filter_plugin-0.0.1.tar.gz
92-
poetry run mkdocs build --verbose
142+
poetry self add "poetry-dynamic-versioning[plugin]"
143+
poetry install --verbose --without=dev
144+
145+
- name: Test Build
146+
run: poetry build --verbose
147+
148+
- name: Test MkDocs build
149+
run: poetry run mkdocs build --verbose --config-file mkdocs.plugins.yml

.github/workflows/workflow.release.draft.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: release-drafter/release-drafter@v5
2222
id: release-drafter
2323
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
GITHUB_TOKEN: ${{ github.token }}
2525

2626
- name: Release URL
2727
run: |

.github/workflows/workflow.release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ jobs:
2626
- name: Setup Python
2727
uses: actions/setup-python@v4
2828
with:
29-
python-version: "3.10"
30-
cache: "poetry"
29+
python-version: .python-version
30+
cache: poetry
3131

3232
- name: Install dependencies
33-
run: poetry install --verbose
33+
run: |
34+
poetry self add "poetry-dynamic-versioning[plugin]"
35+
poetry install --verbose --without=dev
3436
35-
- name: Set Version
36-
run: poetry version ${GITHUB_REF_NAME/v/}
37+
# - name: Set Version
38+
# run: poetry version ${GITHUB_REF_NAME/v/}
3739

3840
- name: Build
3941
run: poetry build --verbose

.gitignore

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ profile_default/
8888
ipython_config.py
8989

9090
# pyenv
91-
.python-version
91+
# .python-version
9292

9393
# pipenv
9494
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -108,13 +108,13 @@ celerybeat.pid
108108
*.sage.py
109109

110110
# Environments
111-
.env
112-
.venv
113-
env/
114-
venv/
115-
ENV/
116-
env.bak/
117-
venv.bak/
111+
# .env
112+
# .venv
113+
# env/
114+
# venv/
115+
# ENV/
116+
# env.bak/
117+
# venv.bak/
118118

119119
# Spyder project settings
120120
.spyderproject
@@ -133,3 +133,6 @@ dmypy.json
133133

134134
# Pyre type checker
135135
.pyre/
136+
137+
# Ruff cache
138+
.ruff_cache

.markdownlint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"ignore_front_matter": true,
33
"MD013": false
4-
}
4+
}

.mkdocsignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# MkDocs
2-
# docs/test/**
32
docs/**/draft-*.md

0 commit comments

Comments
 (0)