Skip to content

Commit 506c3bf

Browse files
committed
Merge branch 'master' into 3.0.0
Docs migrated to Markdown and MkDocs Material
2 parents 9290ccf + 9d3f227 commit 506c3bf

File tree

151 files changed

+4698
-7161
lines changed

Some content is hidden

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

151 files changed

+4698
-7161
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cmd2/table_creator.py @kmvanbrunt
4141
cmd2/transcript.py @kotfu
4242
cmd2/utils.py @tleonhardt @kotfu @kmvanbrunt
4343

44-
# Sphinx documentation
44+
# Documentation
4545
docs/* @tleonhardt @kotfu
4646

4747
# Examples

.github/CONTRIBUTING.md

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ We welcome pull requests from cmd2 users and seasoned Python developers alike! F
1111

1212
Remember to feel free to ask for help by leaving a comment within the Issue.
1313

14-
Working on your first pull request? You can learn how from the
14+
Working on your first pull request? You can learn how from the
1515
[GitHub Docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
1616

1717
###### If you've found a bug that is not on the board, [follow these steps](../README.md#found-a-bug).
1818

19-
--------------------------------------------------------------------------------
19+
---
2020

2121
## Contribution guidelines
2222

@@ -64,22 +64,21 @@ The tables below list all prerequisites along with the minimum required version
6464

6565
#### Additional prerequisites for developing cmd2
6666

67-
| Prerequisite | Minimum Version | Purpose |
68-
|----------------------------------------------------------------------|-----------------|----------------------------|
69-
| [codecov](http://doc.pytest.org/en/latest/) | `2.1.13` | Cover coverage reporting |
70-
| [doc8](https://github.com/PyCQA/doc8) | `1.1.2` | Sphinx style checker |
71-
| [invoke](https://www.pyinvoke.org/) | `2.2.0` | Command automation |
72-
| [mypy](https://mypy-lang.org/) | `1.13.0` | Static type checker |
73-
| [pytest](https://docs.pytest.org/en/stable/) | `3.0.6` | Unit and integration tests |
74-
| [pytest-cov](http://doc.pytest.org/en/latest/) | `6.0.0` | Pytest code coverage |
75-
| [pytest-mock](https://pypi.org/project/pytest-mock/) | `3.14.0` | Pytest mocker fixture |
76-
| [sphinx](https://www.sphinx-doc.org/en/master/) | `8.1.3` | Documentation |
77-
| [sphinx-autobuild](hhttps://pypi.org/project/sphinx-autobuild/) | `2024.10.3` | Rebuild docs on changes |
78-
| [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme ) | `3.0.1` | Sphinx theme for RTD |
79-
| [ruff](https://github.com/astral-sh/ruff) | `0.7.3` | Fast linter and formatter |
80-
| [uv](https://github.com/astral-sh/uv) | `0.5.1` | Python package management |
81-
82-
67+
| Prerequisite | Minimum Version | Purpose |
68+
| ------------------------------------------------------------------------------------------ | --------------- | --------------------------------- |
69+
| [codecov](http://doc.pytest.org/en/latest/) | `2.1.13` | Cover coverage reporting |
70+
| [invoke](https://www.pyinvoke.org/) | `2.2.0` | Command automation |
71+
| [griffe_typingdoc](https://github.com/mkdocstrings/griffe-typingdoc) | `0.2.7` | mkdocstrings extension for typing |
72+
| [mypy](https://mypy-lang.org/) | `1.13.0` | Static type checker |
73+
| [pytest](https://docs.pytest.org/en/stable/) | `3.0.6` | Unit and integration tests |
74+
| [pytest-cov](http://doc.pytest.org/en/latest/) | `6.0.0` | Pytest code coverage |
75+
| [pytest-mock](https://pypi.org/project/pytest-mock/) | `3.14.0` | Pytest mocker fixture |
76+
| [mkdocs-include-markdown-plugin](https://pypi.org/project/mkdocs-include-markdown-plugin/) | `7.1.2` | MkDocs Plugin include MkDn |
77+
| [mkdocs-macros-plugin](https://mkdocs-macros-plugin.readthedocs.io/) | `1.3.7` | MkDocs Plugin for macros |
78+
| [mkdocs-material](https://squidfunk.github.io/mkdocs-material/) | `9.5.49` | Documentation |
79+
| [mkdocstrings[python]](https://mkdocstrings.github.io/) | `0.27.0` | MkDocs Plugin for Python AutoDoc |
80+
| [ruff](https://github.com/astral-sh/ruff) | `0.7.3` | Fast linter and formatter |
81+
| [uv](https://github.com/astral-sh/uv) | `0.5.1` | Python package management |
8382

8483
If Python is already installed in your machine, run the following commands to validate the versions:
8584

@@ -90,11 +89,12 @@ $ pip freeze | grep pyperclip
9089

9190
If your versions are lower than the prerequisite versions, you should update.
9291

93-
If you do not already have Python installed on your machine, we recommend using [uv](https://github.com/astral-sh/uv)
92+
If you do not already have Python installed on your machine, we recommend using [uv](https://github.com/astral-sh/uv)
9493
for all of your Python needs because it is extremely fast, meets all Python installation and packaging needs, and works
95-
on all platforms (Windows, Mac, and Linux). You can install `uv` using instructions at the link above.
94+
on all platforms (Windows, Mac, and Linux). You can install `uv` using instructions at the link above.
9695

9796
You can then install multiple versions of Python using `uv` like so:
97+
9898
```sh
9999
uv python install 3.9 3.10 3.11 3.12 3.13
100100
```
@@ -148,31 +148,31 @@ Do this prior to every time you create a branch for a PR:
148148
1. Make sure you are on the `master` branch
149149

150150
> ```sh
151-
> $ git status
152-
> On branch master
153-
> Your branch is up-to-date with 'origin/master'.
154-
> ```
151+
> $ git status
152+
> On branch master
153+
> Your branch is up-to-date with 'origin/master'.
154+
> ```
155155
156156
> If your aren't on `master`, resolve outstanding files and commits and checkout the `master` branch
157157
158158
> ```sh
159-
> $ git checkout master
160-
> ```
159+
> $ git checkout master
160+
> ```
161161
162162
2. Do a pull with rebase against `upstream`
163163
164164
> ```sh
165-
> $ git pull --rebase upstream master
166-
> ```
165+
> $ git pull --rebase upstream master
166+
> ```
167167
168168
> This will pull down all of the changes to the official master branch, without making an additional commit in your
169169
> local repo.
170170
171171
3. (_Optional_) Force push your updated master branch to your GitHub fork
172172
173173
> ```sh
174-
> $ git push origin master --force
175-
> ```
174+
> $ git push origin master --force
175+
> ```
176176
177177
> This will overwrite the master branch of your fork.
178178
@@ -214,8 +214,8 @@ package from the source.
214214

215215
`cmd2` has support for using [uv](https://github.com/astral-sh/uv) for development.
216216

217-
`uv` is single tool to replace `pip`, `pip-tools`, `pipx`, `poetry`, `pyenv`, `twine`, `virtualenv`, and more. `cmd2`
218-
contains configuration for using `uv` in it's `pyproject.toml` file which makes it extremely easy to setup a `cmd2`
217+
`uv` is single tool to replace `pip`, `pip-tools`, `pipx`, `poetry`, `pyenv`, `twine`, `virtualenv`, and more. `cmd2`
218+
contains configuration for using `uv` in it's `pyproject.toml` file which makes it extremely easy to setup a `cmd2`
219219
development environment using `uv`.
220220

221221
To create a virtual environment and install everything needed for `cmd2` development using `uv`, do the following
@@ -239,6 +239,7 @@ uv run examples/basic.py
239239
```
240240

241241
Alternatively you can activate the virtual environment using the OS-specific command such as this on Linux or macOS:
242+
242243
```sh
243244
source .venv/bin/activate
244245
```
@@ -317,7 +318,7 @@ primarily related to continuous integration and release deployment.
317318
#### Changes to the documentation files
318319

319320
If you made changes to any file in the `/docs` directory, you need to build the
320-
Sphinx documentation and make sure your changes look good:
321+
MkDocs documentation and make sure your changes look good:
321322

322323
```sh
323324
$ uv inv docs
@@ -338,7 +339,7 @@ served (usually [http://localhost:8000](http://localhost:8000)).
338339
### Code Quality Checks
339340

340341
You should have some sort of [PEP 8](https://www.python.org/dev/peps/pep-0008/)-based linting running in your editor or
341-
IDE or at the command line before you commit code. `cmd2` uses [ruff](https://github.com/astral-sh/ruff) as part of
342+
IDE or at the command line before you commit code. `cmd2` uses [ruff](https://github.com/astral-sh/ruff) as part of
342343
its continuous integration (CI) process for both linting and auto-formatting.
343344

344345
> Please do not ignore any linting errors in code you write or modify, as they are meant to **help** you and to ensure a
@@ -441,7 +442,7 @@ nothing to commit, working directory clean
441442
any outstanding files/commits and checkout master `git checkout master`
442443

443444
2. Create a branch off of `master` with git: `git checkout -B
444-
branch/name-here` **Note:** Branch naming is important. Use a name like
445+
branch/name-here` **Note:** Branch naming is important. Use a name like
445446
`fix/short-fix-description` or `feature/short-feature-description`. Review
446447
the [Contribution Guidelines](#contribution-guidelines) for more detail.
447448

@@ -450,7 +451,7 @@ nothing to commit, working directory clean
450451
4. Check your `git status` to see unstaged files
451452

452453
5. Add your edited files: `git add path/to/filename.ext` You can also do: `git
453-
add .` to add all unstaged files. Take care, though, because you can
454+
add .` to add all unstaged files. Take care, though, because you can
454455
accidentally add files you don't want added. Review your `git status` first.
455456

456457
6. Commit your edits: `git commit -m "Brief description of commit"`. Do not add the issue number in the commit message.
@@ -483,17 +484,17 @@ how to do it.
483484
4. The title (also called the subject) of your PR should be descriptive of your
484485
changes and succinctly indicate what is being fixed
485486

486-
- **Do not add the issue number in the PR title or commit message**
487+
- **Do not add the issue number in the PR title or commit message**
487488

488-
- Examples: `Add test cases for Unicode support`; `Correct typo in overview documentation`
489+
- Examples: `Add test cases for Unicode support`; `Correct typo in overview documentation`
489490

490491
5. In the body of your PR include a more detailed summary of the changes you
491492
made and why
492493

493-
- If the PR is meant to fix an existing bug/issue, then, at the end of
494-
your PR's description, append the keyword `closes` and #xxxx (where xxxx
495-
is the issue number). Example: `closes #1337`. This tells GitHub to
496-
close the existing issue if the PR is merged.
494+
- If the PR is meant to fix an existing bug/issue, then, at the end of
495+
your PR's description, append the keyword `closes` and #xxxx (where xxxx
496+
is the issue number). Example: `closes #1337`. This tells GitHub to
497+
close the existing issue if the PR is merged.
497498

498499
6. Indicate what local testing you have done (e.g. what OS and version(s) of Python did you run the
499500
unit test suite with)
@@ -633,8 +634,8 @@ mostly automated. The manual steps are all git operations. Here's the checklist:
633634
1. Make sure all the unit tests pass with `invoke pytest` or `py.test`
634635
1. Make sure latest year in `LICENSE` matches current year
635636
1. Make sure `CHANGELOG.md` describes the version and has the correct release date
636-
1. Add a git tag representing the version number using ``invoke tag x.y.z``
637-
* Where x, y, and z are all small non-negative integers
637+
1. Add a git tag representing the version number using `invoke tag x.y.z`
638+
- Where x, y, and z are all small non-negative integers
638639
1. (Optional) Run `invoke pypi-test` to clean, build, and upload a new release to [Test PyPi](https://test.pypi.org)
639640
1. Run `invoke pypi` to clean, build, and upload a new release to [PyPi](https://pypi.org/)
640641

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# Set fetch-depth: 0 to fetch all history for all branches and tags.
2020
fetch-depth: 0 # Needed for setuptools_scm to work correctly
2121
- name: Install uv
22-
uses: astral-sh/setup-uv@v4
22+
uses: astral-sh/setup-uv@v5
2323

2424
- name: Set up Python ${{ matrix.python-version }}
2525
uses: actions/setup-python@v5

.github/workflows/doc.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
33
name: Doc
44

5-
on: [ push, pull_request, workflow_dispatch ]
5+
on: [push, pull_request, workflow_dispatch]
66

77
permissions:
88
contents: read
@@ -11,21 +11,21 @@ jobs:
1111
doc:
1212
strategy:
1313
matrix:
14-
os: [ ubuntu-latest ]
15-
python-version: [ "3.12" ]
14+
os: [ubuntu-latest]
15+
python-version: ["3.12"]
1616
fail-fast: false
1717
runs-on: ${{ matrix.os }}
1818
steps:
19-
- uses: actions/checkout@v4 # https://github.com/actions/checkout
19+
- uses: actions/checkout@v4 # https://github.com/actions/checkout
2020
with:
2121
# Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
2222
# Set fetch-depth: 0 to fetch all history for all branches and tags.
2323
fetch-depth: 0 # Needed for setuptools_scm to work correctly
2424
- name: Set up Python
25-
uses: actions/setup-python@v5 # https://github.com/actions/setup-python
25+
uses: actions/setup-python@v5 # https://github.com/actions/setup-python
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install python prerequisites
29-
run: pip install -U --user pip setuptools setuptools-scm sphinx sphinx-autobuild sphinx-rtd-theme . plugins/ext_test
30-
- name: Sphinx documentation build
31-
run: python -m sphinx -M html docs docs/_build -nvWT
29+
run: pip install -U --user pip setuptools setuptools-scm griffe_typingdoc mkdocs-include-markdown-plugin mkdocs-macros-plugin mkdocs-material mkdocstrings[python] . plugins/ext_test
30+
- name: MkDocs documentation build
31+
run: mkdocs build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Python development, test, and build
22
__pycache__
3+
target
34
build
45
dist
56
*.egg-info

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Markdown documentation files with non-standards syntax for mkdocstrings that Prettier should not auto-format
2+
docs/features/initialization.md

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"overrides": [
3+
{
4+
"files": "*.md",
5+
"options": {
6+
"tabWidth": 4
7+
}
8+
}
9+
]
10+
}

.readthedocs.yaml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
# Read the Docs configuration file for Sphinx projects
2-
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
1+
# Read the Docs configuration file for MkDocs projects
2+
# See https://docs.readthedocs.io/en/stable/intro/mkdocs.html for details
33

44
# Required
55
version: 2
66

77
# Set the OS, Python version and other tools you might need
88
build:
9-
os: ubuntu-22.04
9+
os: ubuntu-24.04
1010
tools:
11-
python: "3.12"
11+
python: "3"
1212

13-
# Build documentation in the "docs/" directory with Sphinx
14-
sphinx:
15-
configuration: docs/conf.py
16-
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
17-
# builder: "dirhtml"
18-
# Fail on all warnings to avoid broken references
19-
# fail_on_warning: true
13+
# Build documentation in the "docs/" directory with MkDocs
14+
mkdocs:
15+
configuration: mkdocs.yml
2016

2117
# Optionally build your docs in additional formats such as PDF and ePub
2218
# formats:

Pipfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ build = "*"
1515
cmd2 = { editable = true, path = "." }
1616
cmd2_ext_test = { editable = true, path = "plugins/ext_test" }
1717
codecov = "*"
18-
doc8 = "*"
1918
gnureadline = { version = "*", sys_platform = "== 'darwin'" }
19+
griffe-typingdoc = "*"
2020
invoke = "*"
2121
ipython = "*"
2222
mypy = "*"
@@ -26,9 +26,10 @@ pytest-cov = "*"
2626
pytest-mock = "*"
2727
ruff = "*"
2828
setuptools-scm = "*"
29-
sphinx = "*"
30-
sphinx-autobuild = "*"
31-
sphinx-rtd-theme = "*"
29+
mkdocs-include-markdown-plugin = "*"
30+
mkdocs-macros-plugin = "*"
31+
mkdocs-material = "*"
32+
mkdocstrings[python] = "*"
3233
twine = ">=1.11"
3334

3435
[pipenv]

cmd2/ansi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,13 +1042,13 @@ def style(
10421042
# These can be altered to suit an application's needs and only need to be a
10431043
# function with the following structure: func(str) -> str
10441044
style_success = functools.partial(style, fg=Fg.GREEN)
1045-
"""Partial function supplying arguments to :meth:`cmd2.ansi.style()` which colors text to signify success"""
1045+
"""Partial function supplying arguments to [cmd2.ansi.style][] which colors text to signify success"""
10461046

10471047
style_warning = functools.partial(style, fg=Fg.LIGHT_YELLOW)
1048-
"""Partial function supplying arguments to :meth:`cmd2.ansi.style()` which colors text to signify a warning"""
1048+
"""Partial function supplying arguments to [cmd2.ansi.style][] which colors text to signify a warning"""
10491049

10501050
style_error = functools.partial(style, fg=Fg.LIGHT_RED)
1051-
"""Partial function supplying arguments to :meth:`cmd2.ansi.style()` which colors text to signify an error"""
1051+
"""Partial function supplying arguments to [cmd2.ansi.style][] which colors text to signify an error"""
10521052

10531053

10541054
def async_alert_str(*, terminal_columns: int, prompt: str, line: str, cursor_offset: int, alert_msg: str) -> str:

0 commit comments

Comments
 (0)