markdown-include-variants 0.0.4__tar.gz → 0.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/workflows/issue-manager.yml +1 -1
  2. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/workflows/labeler.yml +1 -1
  3. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/workflows/latest-changes.yml +2 -2
  4. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/workflows/publish.yml +4 -4
  5. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/workflows/smokeshow.yml +4 -4
  6. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/workflows/test.yml +12 -12
  7. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/PKG-INFO +1 -1
  8. markdown_include_variants-0.0.6/docs_src/all_variants/tutorial001_an_py311.py +10 -0
  9. markdown_include_variants-0.0.6/docs_src/all_variants/tutorial001_py311.py +10 -0
  10. markdown_include_variants-0.0.6/docs_src/all_variants_folder/app_an_py311/tutorial001.py +10 -0
  11. markdown_include_variants-0.0.6/docs_src/all_variants_folder/app_py311/tutorial001.py +10 -0
  12. markdown_include_variants-0.0.6/docs_src/only_py310/tutorial001_an_py310.py +10 -0
  13. markdown_include_variants-0.0.6/docs_src/only_py_no_an/tutorial001_py310.py +10 -0
  14. markdown_include_variants-0.0.6/docs_src/only_py_no_an/tutorial001_py311.py +10 -0
  15. markdown_include_variants-0.0.6/docs_src/up_to_py39/tutorial001.py +10 -0
  16. markdown_include_variants-0.0.6/docs_src/up_to_py39/tutorial001_an.py +10 -0
  17. markdown_include_variants-0.0.6/docs_src/up_to_py39/tutorial001_an_py39.py +10 -0
  18. markdown_include_variants-0.0.6/docs_src/up_to_py39/tutorial001_py39.py +10 -0
  19. markdown_include_variants-0.0.6/release-notes.md +76 -0
  20. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/src/markdown_include_variants/_main.py +100 -13
  21. markdown_include_variants-0.0.6/src/markdown_include_variants/_version.py +1 -0
  22. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_all_variants.py +74 -23
  23. markdown_include_variants-0.0.6/tests/test_all_variants_folder.py +296 -0
  24. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_another_preferred_variant.py +12 -1
  25. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_only_py_no_an.py +8 -4
  26. markdown_include_variants-0.0.4/release-notes.md +0 -42
  27. markdown_include_variants-0.0.4/src/markdown_include_variants/_version.py +0 -1
  28. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/DISCUSSION_TEMPLATE/questions.yml +0 -0
  29. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/FUNDING.yml +0 -0
  30. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  31. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/ISSUE_TEMPLATE/privileged.yml +0 -0
  32. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/dependabot.yml +0 -0
  33. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.github/labeler.yml +0 -0
  34. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.gitignore +0 -0
  35. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.pre-commit-config.yaml +0 -0
  36. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/.python-version +0 -0
  37. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/CITATION.cff +0 -0
  38. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/LICENSE +0 -0
  39. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/README.md +0 -0
  40. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/docs_src/all_variants/tutorial001.py +0 -0
  41. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/docs_src/all_variants/tutorial001_an.py +0 -0
  42. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/docs_src/all_variants/tutorial001_an_py310.py +0 -0
  43. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/docs_src/all_variants/tutorial001_an_py39.py +0 -0
  44. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/docs_src/all_variants/tutorial001_py310.py +0 -0
  45. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/docs_src/all_variants/tutorial001_py39.py +0 -0
  46. {markdown_include_variants-0.0.4/docs_src/no_py39 → markdown_include_variants-0.0.6/docs_src/all_variants_folder/app}/tutorial001.py +0 -0
  47. /markdown_include_variants-0.0.4/docs_src/no_py39/tutorial001_an.py → /markdown_include_variants-0.0.6/docs_src/all_variants_folder/app_an/tutorial001.py +0 -0
  48. /markdown_include_variants-0.0.4/docs_src/no_py39/tutorial001_an_py310.py → /markdown_include_variants-0.0.6/docs_src/all_variants_folder/app_an_py310/tutorial001.py +0 -0
  49. /markdown_include_variants-0.0.4/docs_src/up_to_py39/tutorial001_an_py39.py → /markdown_include_variants-0.0.6/docs_src/all_variants_folder/app_an_py39/tutorial001.py +0 -0
  50. /markdown_include_variants-0.0.4/docs_src/no_py39/tutorial001_py310.py → /markdown_include_variants-0.0.6/docs_src/all_variants_folder/app_py310/tutorial001.py +0 -0
  51. /markdown_include_variants-0.0.4/docs_src/only_py_no_an/tutorial001_py39.py → /markdown_include_variants-0.0.6/docs_src/all_variants_folder/app_py39/tutorial001.py +0 -0
  52. {markdown_include_variants-0.0.4/docs_src/only_py_no_an → markdown_include_variants-0.0.6/docs_src/no_py39}/tutorial001.py +0 -0
  53. {markdown_include_variants-0.0.4/docs_src/up_to_py39 → markdown_include_variants-0.0.6/docs_src/no_py39}/tutorial001_an.py +0 -0
  54. {markdown_include_variants-0.0.4/docs_src/only_py310 → markdown_include_variants-0.0.6/docs_src/no_py39}/tutorial001_an_py310.py +0 -0
  55. {markdown_include_variants-0.0.4/docs_src/only_py310 → markdown_include_variants-0.0.6/docs_src/no_py39}/tutorial001_py310.py +0 -0
  56. {markdown_include_variants-0.0.4/docs_src/only_py_no_an → markdown_include_variants-0.0.6/docs_src/only_py310}/tutorial001_py310.py +0 -0
  57. {markdown_include_variants-0.0.4/docs_src/simple → markdown_include_variants-0.0.6/docs_src/only_py_no_an}/tutorial001.py +0 -0
  58. {markdown_include_variants-0.0.4/docs_src/up_to_py39 → markdown_include_variants-0.0.6/docs_src/only_py_no_an}/tutorial001_py39.py +0 -0
  59. {markdown_include_variants-0.0.4/docs_src/up_to_py39 → markdown_include_variants-0.0.6/docs_src/simple}/tutorial001.py +0 -0
  60. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/pyproject.toml +0 -0
  61. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/scripts/format.sh +0 -0
  62. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/scripts/lint.sh +0 -0
  63. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/scripts/test.sh +0 -0
  64. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/src/markdown_include_variants/__init__.py +0 -0
  65. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/src/markdown_include_variants/py.typed +0 -0
  66. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_no_py39.py +0 -0
  67. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_only_preview.py +0 -0
  68. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_only_py310.py +0 -0
  69. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_simple_hl.py +0 -0
  70. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_simple_ln.py +0 -0
  71. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_simple_ln_hl.py +0 -0
  72. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_simple_no_configs.py +0 -0
  73. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/tests/test_up_to_py39.py +0 -0
  74. {markdown_include_variants-0.0.4 → markdown_include_variants-0.0.6}/uv.lock +0 -0
@@ -27,7 +27,7 @@ jobs:
27
27
  env:
28
28
  GITHUB_CONTEXT: ${{ toJson(github) }}
29
29
  run: echo "$GITHUB_CONTEXT"
30
- - uses: tiangolo/issue-manager@0.5.1
30
+ - uses: tiangolo/issue-manager@0.6.0
31
31
  with:
32
32
  token: ${{ secrets.GITHUB_TOKEN }}
33
33
  config: >
@@ -16,7 +16,7 @@ jobs:
16
16
  pull-requests: write
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
- - uses: actions/labeler@v5
19
+ - uses: actions/labeler@v6
20
20
  if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }}
21
21
  - run: echo "Done adding labels"
22
22
  # Run this after labeler applied labels
@@ -20,7 +20,7 @@ jobs:
20
20
  latest-changes:
21
21
  runs-on: ubuntu-latest
22
22
  steps:
23
- - uses: actions/checkout@v4
23
+ - uses: actions/checkout@v6
24
24
  with:
25
25
  # To allow latest-changes to commit to the main branch
26
26
  token: ${{ secrets.LATEST_CHANGES }}
@@ -30,7 +30,7 @@ jobs:
30
30
  if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
31
31
  with:
32
32
  limit-access-to-actor: true
33
- - uses: tiangolo/latest-changes@0.3.2
33
+ - uses: tiangolo/latest-changes@0.4.1
34
34
  with:
35
35
  token: ${{ secrets.GITHUB_TOKEN }}
36
36
  latest_changes_file: release-notes.md
@@ -3,7 +3,7 @@ name: Publish
3
3
  on:
4
4
  release:
5
5
  types:
6
- - created
6
+ - released
7
7
  workflow_dispatch:
8
8
  inputs:
9
9
  debug_enabled:
@@ -17,9 +17,9 @@ jobs:
17
17
  permissions:
18
18
  id-token: write
19
19
  steps:
20
- - uses: actions/checkout@v4
20
+ - uses: actions/checkout@v6
21
21
  - name: Set up Python
22
- uses: actions/setup-python@v5
22
+ uses: actions/setup-python@v6
23
23
  with:
24
24
  python-version: "3.11"
25
25
  - name: Install build dependencies
@@ -27,4 +27,4 @@ jobs:
27
27
  - name: Build distribution
28
28
  run: python -m build
29
29
  - name: Publish
30
- uses: pypa/gh-action-pypi-publish@v1.12.3
30
+ uses: pypa/gh-action-pypi-publish@v1.13.0
@@ -23,18 +23,18 @@ jobs:
23
23
  env:
24
24
  GITHUB_CONTEXT: ${{ toJson(github) }}
25
25
  run: echo "$GITHUB_CONTEXT"
26
- - uses: actions/checkout@v4
27
- - uses: actions/setup-python@v5
26
+ - uses: actions/checkout@v6
27
+ - uses: actions/setup-python@v6
28
28
  with:
29
29
  python-version: '3.9'
30
30
  - name: Setup uv
31
- uses: astral-sh/setup-uv@v5
31
+ uses: astral-sh/setup-uv@v7
32
32
  with:
33
33
  version: "0.4.15"
34
34
  enable-cache: true
35
35
  - name: Install Dependencies
36
36
  run: uv sync
37
- - uses: actions/download-artifact@v4
37
+ - uses: actions/download-artifact@v6
38
38
  with:
39
39
  name: coverage-html
40
40
  path: htmlcov
@@ -20,13 +20,13 @@ jobs:
20
20
  env:
21
21
  GITHUB_CONTEXT: ${{ toJson(github) }}
22
22
  run: echo "$GITHUB_CONTEXT"
23
- - uses: actions/checkout@v4
23
+ - uses: actions/checkout@v6
24
24
  - name: Set up Python
25
- uses: actions/setup-python@v5
25
+ uses: actions/setup-python@v6
26
26
  with:
27
27
  python-version: "3.11"
28
28
  - name: Setup uv
29
- uses: astral-sh/setup-uv@v5
29
+ uses: astral-sh/setup-uv@v7
30
30
  with:
31
31
  version: "0.4.15"
32
32
  enable-cache: true
@@ -47,13 +47,13 @@ jobs:
47
47
  env:
48
48
  GITHUB_CONTEXT: ${{ toJson(github) }}
49
49
  run: echo "$GITHUB_CONTEXT"
50
- - uses: actions/checkout@v4
50
+ - uses: actions/checkout@v6
51
51
  - name: Set up Python
52
- uses: actions/setup-python@v5
52
+ uses: actions/setup-python@v6
53
53
  with:
54
54
  python-version: ${{ matrix.python-version }}
55
55
  - name: Setup uv
56
- uses: astral-sh/setup-uv@v5
56
+ uses: astral-sh/setup-uv@v7
57
57
  with:
58
58
  version: "0.4.15"
59
59
  enable-cache: true
@@ -66,7 +66,7 @@ jobs:
66
66
  COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
67
67
  CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
68
68
  - name: Store coverage files
69
- uses: actions/upload-artifact@v4
69
+ uses: actions/upload-artifact@v5
70
70
  with:
71
71
  name: coverage-${{ matrix.python-version }}
72
72
  path: coverage
@@ -81,17 +81,17 @@ jobs:
81
81
  env:
82
82
  GITHUB_CONTEXT: ${{ toJson(github) }}
83
83
  run: echo "$GITHUB_CONTEXT"
84
- - uses: actions/checkout@v4
85
- - uses: actions/setup-python@v5
84
+ - uses: actions/checkout@v6
85
+ - uses: actions/setup-python@v6
86
86
  with:
87
87
  python-version: '3.11'
88
88
  - name: Setup uv
89
- uses: astral-sh/setup-uv@v5
89
+ uses: astral-sh/setup-uv@v7
90
90
  with:
91
91
  version: "0.4.15"
92
92
  enable-cache: true
93
93
  - name: Get coverage files
94
- uses: actions/download-artifact@v4
94
+ uses: actions/download-artifact@v6
95
95
  with:
96
96
  pattern: coverage-*
97
97
  path: coverage
@@ -102,7 +102,7 @@ jobs:
102
102
  - run: uv run coverage report
103
103
  - run: uv run coverage html --title "Coverage for ${{ github.sha }}"
104
104
  - name: Store coverage HTML
105
- uses: actions/upload-artifact@v4
105
+ uses: actions/upload-artifact@v5
106
106
  with:
107
107
  name: coverage-html
108
108
  path: htmlcov
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-include-variants
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Markdown extension to expand directives to include source example files to also include their variants. Only useful to tiangolo's projets. Don't use it. 😅
5
5
  Project-URL: Homepage, https://github.com/tiangolo/markdown-include-variants
6
6
  Project-URL: Repository, https://github.com/tiangolo/markdown-include-variants
@@ -0,0 +1,10 @@
1
+ print("an py311 line 1")
2
+ print("an py311 line 2")
3
+ print("an py311 line 3")
4
+ print("an py311 line 4")
5
+ print("an py311 line 5")
6
+ print("an py311 line 6")
7
+ print("an py311 line 7")
8
+ print("an py311 line 8")
9
+ print("an py311 line 9")
10
+ print("an py311 line 10")
@@ -0,0 +1,10 @@
1
+ print("py311 line 1")
2
+ print("py311 line 2")
3
+ print("py311 line 3")
4
+ print("py311 line 4")
5
+ print("py311 line 5")
6
+ print("py311 line 6")
7
+ print("py311 line 7")
8
+ print("py311 line 8")
9
+ print("py311 line 9")
10
+ print("py311 line 10")
@@ -0,0 +1,10 @@
1
+ print("an py311 line 1")
2
+ print("an py311 line 2")
3
+ print("an py311 line 3")
4
+ print("an py311 line 4")
5
+ print("an py311 line 5")
6
+ print("an py311 line 6")
7
+ print("an py311 line 7")
8
+ print("an py311 line 8")
9
+ print("an py311 line 9")
10
+ print("an py311 line 10")
@@ -0,0 +1,10 @@
1
+ print("py311 line 1")
2
+ print("py311 line 2")
3
+ print("py311 line 3")
4
+ print("py311 line 4")
5
+ print("py311 line 5")
6
+ print("py311 line 6")
7
+ print("py311 line 7")
8
+ print("py311 line 8")
9
+ print("py311 line 9")
10
+ print("py311 line 10")
@@ -0,0 +1,10 @@
1
+ print("an py310 line 1")
2
+ print("an py310 line 2")
3
+ print("an py310 line 3")
4
+ print("an py310 line 4")
5
+ print("an py310 line 5")
6
+ print("an py310 line 6")
7
+ print("an py310 line 7")
8
+ print("an py310 line 8")
9
+ print("an py310 line 9")
10
+ print("an py310 line 10")
@@ -0,0 +1,10 @@
1
+ print("py310 line 1")
2
+ print("py310 line 2")
3
+ print("py310 line 3")
4
+ print("py310 line 4")
5
+ print("py310 line 5")
6
+ print("py310 line 6")
7
+ print("py310 line 7")
8
+ print("py310 line 8")
9
+ print("py310 line 9")
10
+ print("py310 line 10")
@@ -0,0 +1,10 @@
1
+ print("py311 line 1")
2
+ print("py311 line 2")
3
+ print("py311 line 3")
4
+ print("py311 line 4")
5
+ print("py311 line 5")
6
+ print("py311 line 6")
7
+ print("py311 line 7")
8
+ print("py311 line 8")
9
+ print("py311 line 9")
10
+ print("py311 line 10")
@@ -0,0 +1,10 @@
1
+ print("simple line 1")
2
+ print("simple line 2")
3
+ print("simple line 3")
4
+ print("simple line 4")
5
+ print("simple line 5")
6
+ print("simple line 6")
7
+ print("simple line 7")
8
+ print("simple line 8")
9
+ print("simple line 9")
10
+ print("simple line 10")
@@ -0,0 +1,10 @@
1
+ print("an line 1")
2
+ print("an line 2")
3
+ print("an line 3")
4
+ print("an line 4")
5
+ print("an line 5")
6
+ print("an line 6")
7
+ print("an line 7")
8
+ print("an line 8")
9
+ print("an line 9")
10
+ print("an line 10")
@@ -0,0 +1,10 @@
1
+ print("an py39 line 1")
2
+ print("an py39 line 2")
3
+ print("an py39 line 3")
4
+ print("an py39 line 4")
5
+ print("an py39 line 5")
6
+ print("an py39 line 6")
7
+ print("an py39 line 7")
8
+ print("an py39 line 8")
9
+ print("an py39 line 9")
10
+ print("an py39 line 10")
@@ -0,0 +1,10 @@
1
+ print("py39 line 1")
2
+ print("py39 line 2")
3
+ print("py39 line 3")
4
+ print("py39 line 4")
5
+ print("py39 line 5")
6
+ print("py39 line 6")
7
+ print("py39 line 7")
8
+ print("py39 line 8")
9
+ print("py39 line 9")
10
+ print("py39 line 10")
@@ -0,0 +1,76 @@
1
+ # Release Notes
2
+
3
+ ## Latest Changes
4
+
5
+ ## 0.0.6
6
+
7
+ ### Features
8
+
9
+ * ✨ Search for variants by folder name if no variants by file name found. PR [#38](https://github.com/tiangolo/markdown-include-variants/pull/38) by [@YuriiMotov](https://github.com/YuriiMotov).
10
+
11
+ ### Internal
12
+
13
+ * ⬆ Bump actions/checkout from 5 to 6. PR [#37](https://github.com/tiangolo/markdown-include-variants/pull/37) by [@dependabot[bot]](https://github.com/apps/dependabot).
14
+ * ⬆ Bump actions/checkout from 5 to 6. PR [#34](https://github.com/tiangolo/markdown-include-variants/pull/34) by [@dependabot[bot]](https://github.com/apps/dependabot).
15
+ * 👷 Upgrade `latest-changes` GitHub Action and pin `actions/checkout@v5`. PR [#35](https://github.com/tiangolo/markdown-include-variants/pull/35) by [@tiangolo](https://github.com/tiangolo).
16
+ * ⬆ Bump actions/upload-artifact from 4 to 5. PR [#32](https://github.com/tiangolo/markdown-include-variants/pull/32) by [@dependabot[bot]](https://github.com/apps/dependabot).
17
+ * ⬆ Bump actions/download-artifact from 5 to 6. PR [#33](https://github.com/tiangolo/markdown-include-variants/pull/33) by [@dependabot[bot]](https://github.com/apps/dependabot).
18
+ * ⬆ Bump astral-sh/setup-uv from 6 to 7. PR [#31](https://github.com/tiangolo/markdown-include-variants/pull/31) by [@dependabot[bot]](https://github.com/apps/dependabot).
19
+ * ⬆ Bump tiangolo/issue-manager from 0.5.1 to 0.6.0. PR [#30](https://github.com/tiangolo/markdown-include-variants/pull/30) by [@dependabot[bot]](https://github.com/apps/dependabot).
20
+ * ⬆ Bump actions/labeler from 5 to 6. PR [#29](https://github.com/tiangolo/markdown-include-variants/pull/29) by [@dependabot[bot]](https://github.com/apps/dependabot).
21
+ * ⬆ Bump actions/setup-python from 5 to 6. PR [#27](https://github.com/tiangolo/markdown-include-variants/pull/27) by [@dependabot[bot]](https://github.com/apps/dependabot).
22
+ * ⬆ Bump pypa/gh-action-pypi-publish from 1.12.4 to 1.13.0. PR [#26](https://github.com/tiangolo/markdown-include-variants/pull/26) by [@dependabot[bot]](https://github.com/apps/dependabot).
23
+ * ⬆ Bump actions/checkout from 4 to 5. PR [#25](https://github.com/tiangolo/markdown-include-variants/pull/25) by [@dependabot[bot]](https://github.com/apps/dependabot).
24
+ * ⬆ Bump actions/download-artifact from 4 to 5. PR [#24](https://github.com/tiangolo/markdown-include-variants/pull/24) by [@dependabot[bot]](https://github.com/apps/dependabot).
25
+ * ⬆ Bump tiangolo/latest-changes from 0.3.2 to 0.4.0. PR [#23](https://github.com/tiangolo/markdown-include-variants/pull/23) by [@dependabot[bot]](https://github.com/apps/dependabot).
26
+
27
+ ## 0.0.5
28
+
29
+ ### Features
30
+
31
+ * ✨ Support Python 3.11. PR [#28](https://github.com/tiangolo/markdown-include-variants/pull/28) by [@svlandeg](https://github.com/svlandeg).
32
+
33
+ ### Internal
34
+
35
+ * ⬆ Bump astral-sh/setup-uv from 5 to 6. PR [#22](https://github.com/tiangolo/markdown-include-variants/pull/22) by [@dependabot[bot]](https://github.com/apps/dependabot).
36
+ * ⬆ Bump pypa/gh-action-pypi-publish from 1.12.3 to 1.12.4. PR [#21](https://github.com/tiangolo/markdown-include-variants/pull/21) by [@dependabot[bot]](https://github.com/apps/dependabot).
37
+ * 👷 Publish on release released. PR [#20](https://github.com/tiangolo/markdown-include-variants/pull/20) by [@tiangolo](https://github.com/tiangolo).
38
+
39
+ ## 0.0.4
40
+
41
+ ### Features
42
+
43
+ * ✨ Include variant tab in full file preview. PR [#19](https://github.com/tiangolo/markdown-include-variants/pull/19) by [@tiangolo](https://github.com/tiangolo).
44
+ * ✨ Support including only a file preview. PR [#18](https://github.com/tiangolo/markdown-include-variants/pull/18) by [@tiangolo](https://github.com/tiangolo).
45
+
46
+ ### Internal
47
+
48
+ * ⬆ Bump astral-sh/setup-uv from 3 to 5. PR [#17](https://github.com/tiangolo/markdown-include-variants/pull/17) by [@dependabot[bot]](https://github.com/apps/dependabot).
49
+ * ⬆ Bump tiangolo/latest-changes from 0.3.1 to 0.3.2. PR [#14](https://github.com/tiangolo/markdown-include-variants/pull/14) by [@dependabot[bot]](https://github.com/apps/dependabot).
50
+ * ⬆ Bump pypa/gh-action-pypi-publish from 1.11.0 to 1.12.3. PR [#16](https://github.com/tiangolo/markdown-include-variants/pull/16) by [@dependabot[bot]](https://github.com/apps/dependabot).
51
+ * ⬆ Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0. PR [#11](https://github.com/tiangolo/markdown-include-variants/pull/11) by [@dependabot[bot]](https://github.com/apps/dependabot).
52
+
53
+ ## 0.0.3
54
+
55
+ ### Features
56
+
57
+ * ✨ Add highlight for full file preview. PR [#10](https://github.com/tiangolo/markdown-include-variants/pull/10) by [@tiangolo](https://github.com/tiangolo).
58
+
59
+ ## 0.0.2
60
+
61
+ ### Refactors
62
+
63
+ * ♻️ Make the preferred variant the one used in the include. PR [#9](https://github.com/tiangolo/markdown-include-variants/pull/9) by [@tiangolo](https://github.com/tiangolo).
64
+
65
+ ### Docs
66
+
67
+ * 📝 Fix MkDocs config example. PR [#8](https://github.com/tiangolo/markdown-include-variants/pull/8) by [@tiangolo](https://github.com/tiangolo).
68
+ * 📝 Update README with mkdocs.yml configs. PR [#6](https://github.com/tiangolo/markdown-include-variants/pull/6) by [@tiangolo](https://github.com/tiangolo).
69
+
70
+ ### Internal
71
+
72
+ * ⬆ Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.3. PR [#1](https://github.com/tiangolo/markdown-include-variants/pull/1) by [@dependabot[bot]](https://github.com/apps/dependabot).
73
+ * 👷 Tweak labeler GitHub Action. PR [#7](https://github.com/tiangolo/markdown-include-variants/pull/7) by [@tiangolo](https://github.com/tiangolo).
74
+ * 👷 Fix smokeshow setup. PR [#4](https://github.com/tiangolo/markdown-include-variants/pull/4) by [@tiangolo](https://github.com/tiangolo).
75
+ * 👷 Tweak labeler GitHub Action to not change labels on manual labels. PR [#5](https://github.com/tiangolo/markdown-include-variants/pull/5) by [@tiangolo](https://github.com/tiangolo).
76
+ * 👷 Tweak CI and types. PR [#2](https://github.com/tiangolo/markdown-include-variants/pull/2) by [@tiangolo](https://github.com/tiangolo).
@@ -6,13 +6,20 @@ from typing import Any, Literal, Union
6
6
  from markdown import Extension, Markdown
7
7
  from markdown.preprocessors import Preprocessor
8
8
 
9
+ AN = "_an"
10
+ PY39 = "_py39"
11
+ PY310 = "_py310"
12
+ PY311 = "_py311"
13
+
14
+ SUFFIXES_TO_REMOVE = ["_an", "_py39", "_py310", "_py311"]
15
+
9
16
 
10
17
  @dataclass(frozen=True)
11
18
  class Variant:
12
19
  path: Path
13
20
  title: str
14
21
  is_annotated: Union[bool, None]
15
- version: Literal["py38", "py39", "py310"]
22
+ version: Literal["py38", "py39", "py310", "py311"]
16
23
 
17
24
 
18
25
  def remove_suffixes(base_name: str, suffixes: list[str]) -> str:
@@ -25,18 +32,94 @@ def remove_suffixes(base_name: str, suffixes: list[str]) -> str:
25
32
 
26
33
  def calculate_variants(base_path: Path) -> dict[tuple[str, Union[bool, None]], Variant]:
27
34
  preferred_name = base_path.stem
28
- base_name = remove_suffixes(preferred_name, ["_an", "_py39", "_py310"])
35
+ base_name = remove_suffixes(preferred_name, SUFFIXES_TO_REMOVE)
29
36
  base_dir = base_path.parent
30
- variants: dict[tuple[str, Union[bool, None]], Variant] = {}
31
- an = "_an"
32
- py39 = "_py39"
33
- py310 = "_py310"
34
- an_p310_path = base_dir / f"{base_name}{an}{py310}.py"
35
- an_p39_path = base_dir / f"{base_name}{an}{py39}.py"
36
- an_p38_path = base_dir / f"{base_name}{an}.py"
37
- p310_path = base_dir / f"{base_name}{py310}.py"
38
- p39_path = base_dir / f"{base_name}{py39}.py"
37
+
38
+ an_p311_path = base_dir / f"{base_name}{AN}{PY311}.py"
39
+ an_p310_path = base_dir / f"{base_name}{AN}{PY310}.py"
40
+ an_p39_path = base_dir / f"{base_name}{AN}{PY39}.py"
41
+ an_p38_path = base_dir / f"{base_name}{AN}.py"
42
+ p311_path = base_dir / f"{base_name}{PY311}.py"
43
+ p310_path = base_dir / f"{base_name}{PY310}.py"
44
+ p39_path = base_dir / f"{base_name}{PY39}.py"
39
45
  p38_path = base_dir / f"{base_name}.py"
46
+
47
+ return _create_variants(
48
+ an_p311_path=an_p311_path,
49
+ an_p310_path=an_p310_path,
50
+ an_p39_path=an_p39_path,
51
+ an_p38_path=an_p38_path,
52
+ p311_path=p311_path,
53
+ p310_path=p310_path,
54
+ p39_path=p39_path,
55
+ p38_path=p38_path,
56
+ )
57
+
58
+
59
+ def calculate_variants_folder(
60
+ base_path: Path,
61
+ ) -> dict[tuple[str, Union[bool, None]], Variant]:
62
+ file_name = base_path.name
63
+ folder = base_path.parent
64
+ base_dir = folder.parent
65
+ base_name = remove_suffixes(folder.name, SUFFIXES_TO_REMOVE)
66
+
67
+ an_p311_path = base_dir / f"{base_name}{AN}{PY311}" / file_name
68
+ an_p310_path = base_dir / f"{base_name}{AN}{PY310}" / file_name
69
+ an_p39_path = base_dir / f"{base_name}{AN}{PY39}" / file_name
70
+ an_p38_path = base_dir / f"{base_name}{AN}" / file_name
71
+ p311_path = base_dir / f"{base_name}{PY311}" / file_name
72
+ p310_path = base_dir / f"{base_name}{PY310}" / file_name
73
+ p39_path = base_dir / f"{base_name}{PY39}" / file_name
74
+ p38_path = base_dir / f"{base_name}" / file_name
75
+
76
+ return _create_variants(
77
+ an_p311_path=an_p311_path,
78
+ an_p310_path=an_p310_path,
79
+ an_p39_path=an_p39_path,
80
+ an_p38_path=an_p38_path,
81
+ p311_path=p311_path,
82
+ p310_path=p310_path,
83
+ p39_path=p39_path,
84
+ p38_path=p38_path,
85
+ )
86
+
87
+
88
+ def _create_variants(
89
+ an_p311_path: Path,
90
+ an_p310_path: Path,
91
+ an_p39_path: Path,
92
+ an_p38_path: Path,
93
+ p311_path: Path,
94
+ p310_path: Path,
95
+ p39_path: Path,
96
+ p38_path: Path,
97
+ ) -> dict[tuple[str, Union[bool, None]], Variant]:
98
+ variants: dict[tuple[str, Union[bool, None]], Variant] = {}
99
+ if an_p311_path.exists():
100
+ v = Variant(
101
+ path=an_p311_path,
102
+ title="Python 3.11+",
103
+ is_annotated=True,
104
+ version="py311",
105
+ )
106
+ variants[(v.version, v.is_annotated)] = v
107
+ if p311_path.exists():
108
+ v = Variant(
109
+ path=p311_path,
110
+ title="Python 3.11+ - non-Annotated",
111
+ is_annotated=False,
112
+ version="py311",
113
+ )
114
+ variants[(v.version, v.is_annotated)] = v
115
+ elif p311_path.exists():
116
+ v = Variant(
117
+ path=p311_path,
118
+ title="Python 3.11+",
119
+ is_annotated=None,
120
+ version="py311",
121
+ )
122
+ variants[(v.version, v.is_annotated)] = v
40
123
  if an_p310_path.exists():
41
124
  v = Variant(
42
125
  path=an_p310_path,
@@ -218,10 +301,14 @@ class IncludeVariantsPreprocessor(Preprocessor):
218
301
  variants = calculate_variants(base_path)
219
302
  if len(variants) == 0:
220
303
  raise FileNotFoundError(f"Could not find any variants for {base_path}")
304
+ if len(variants) == 1:
305
+ folder_variants = calculate_variants_folder(base_path)
306
+ if len(folder_variants) > 1:
307
+ variants = folder_variants
221
308
  sorted_variants: list[Variant] = []
222
309
  preferred_variant = None
223
310
  for an in [True, False, None]:
224
- for version in ["py310", "py39", "py38"]:
311
+ for version in ["py311", "py310", "py39", "py38"]:
225
312
  v = variants.get((version, an))
226
313
  if v:
227
314
  if v.path == base_path:
@@ -272,7 +359,7 @@ class IncludeVariantsPreprocessor(Preprocessor):
272
359
 
273
360
  block_lines.extend(
274
361
  [
275
- f"//// tab | {preferred_variant.title}" "",
362
+ f"//// tab | {preferred_variant.title}",
276
363
  first_line,
277
364
  *internal_block_lines,
278
365
  "```",
@@ -0,0 +1 @@
1
+ __version__ = "0.0.6"