Skip to content

Commit e254389

Browse files
authored
Merge pull request #436 from mkdocstrings/copilot/sub-pr-434-again
Fix pyproject.toml workspace config and restore griffe CLI branding
2 parents a2e13bf + 8ecd876 commit e254389

Some content is hidden

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

47 files changed

+714
-672
lines changed

docs/extensions/built-in/dataclasses.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ Additional metadata like `ClassVar`, the `init` and `kw_only` parameters, or the
2929

3030
=== "CLI"
3131
```console
32-
$ griffecli dump -e dataclasses,other my_package
32+
$ griffe dump -e dataclasses,other my_package
3333
```
3434

3535
=== "Python"
3636
```python
3737
import griffe
3838

39-
my_package = griffelib.load("my_package", extensions=griffelib.load_extensions("dataclasses", "other"))
39+
my_package = griffe.load("my_package", extensions=griffe.load_extensions("dataclasses", "other"))
4040
```
4141

4242
=== "mkdocstrings"

docs/extensions/built-in/unpack-typeddict.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ To enable the extension:
6565

6666
=== "CLI"
6767
```console
68-
$ griffecli dump -e unpack_typeddict my_package
68+
$ griffe dump -e unpack_typeddict my_package
6969
```
7070

7171
=== "Python"
7272
```python
7373
import griffe
7474

75-
my_package = griffelib.load("my_package", extensions=griffelib.load_extensions("unpack_typeddict"))
75+
my_package = griffe.load("my_package", extensions=griffe.load_extensions("unpack_typeddict"))
7676
```
7777

7878
=== "mkdocstrings"

docs/extensions/official/runtime-objects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This extension stores runtime objects corresponding to each loaded Griffe object
1111

1212
```pycon
1313
>>> import griffe
14-
>>> griffe_data = griffelib.load("griffe", extensions=griffelib.load_extensions("griffe_runtime_objects"), resolve_aliases=True)
14+
>>> griffe_data = griffe.load("griffe", extensions=griffe.load_extensions("griffe_runtime_objects"), resolve_aliases=True)
1515
>>> griffe_data["parse"].extra
1616
defaultdict(<class 'dict'>, {'runtime-objects': {'object': <function parse at 0x78685c951260>}})
1717
>>> griffe_data["Module"].extra

docs/extensions/official/warnings-deprecated.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
---
99

10-
This extension adds support for functions and classes decorated with [`@warnings.deprecated(...)`][warnings.deprecated], as implemented thanks to [PEP 702](https://peps.python.org/pep-0702/). The message provided in the decorator call will be stored in the corresponding Griffe object's [`deprecated`][griffelib.Object.deprecated] attribute (usable by downstream rendering templates), and will also add an admonition to the object's docstring with the provided message as text.
10+
This extension adds support for functions and classes decorated with [`@warnings.deprecated(...)`][warnings.deprecated], as implemented thanks to [PEP 702](https://peps.python.org/pep-0702/). The message provided in the decorator call will be stored in the corresponding Griffe object's [`deprecated`][griffe.Object.deprecated] attribute (usable by downstream rendering templates), and will also add an admonition to the object's docstring with the provided message as text.
1111

1212
```python
1313
from warnings import deprecated

docs/guide/contributors/architecture.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ descriptions = {
2222
"scripts": "Our different scripts. See [Scripts, configuration](#scripts-configuration).",
2323
"site": "Documentation site, built with `make run mkdocs build` (git-ignored).",
2424
"src": "The source of our Python package(s). See [Sources](#sources) and [Program structure](#program-structure).",
25-
"packages/griffe/src/griffe": "Our public API, exposed to users. See [Program structure](#program-structure).",
26-
"packages/griffe/src/griffe/_internal": "Our internal API, hidden from users. See [Program structure](#program-structure).",
25+
"src/griffe": "Our public API, exposed to users. See [Program structure](#program-structure).",
26+
"packages/griffelib/src/griffelib/_internal": "Our internal API, hidden from users. See [Program structure](#program-structure).",
2727
"tests": "Our test suite. See [Tests](#tests).",
2828
".copier-answers.yml": "The answers file generated by [Copier](https://copier.readthedocs.io/en/stable/). See [Boilerplate](#boilerplate).",
2929
"devdeps.txt": "Our development dependencies specification. See [`make setup`][command-setup] command.",
@@ -108,7 +108,7 @@ The test suite is based on [pytest](https://docs.pytest.org/en/8.2.x/). Test mod
108108

109109
## Program structure
110110

111-
The internal API is contained within the `packages/griffe/src/griffe/_internal` folder. The top-level `griffe/__init__.py` module exposes all the public API, by importing the internal objects from various submodules of `griffelib._internal`.
111+
The internal API is contained within the `packages/griffelib/src/griffelib/_internal` folder. The top-level `griffe/__init__.py` module exposes all the public API, by importing the internal objects from `griffelib`, which itself imports from various submodules of `griffelib._internal`.
112112

113113
Users then import `griffe` directly, or import objects from it.
114114

@@ -122,7 +122,7 @@ if os.getenv("DEPLOY") == "true":
122122
from pydeps.target import Target
123123

124124
cli.verbose = cli._not_verbose
125-
options = cli.parse_args(["packages/griffe/src/griffe", "--noshow", "--reverse"])
125+
options = cli.parse_args(["packages/griffelib/src/griffelib", "--noshow", "--reverse"])
126126
colors.START_COLOR = 128
127127
target = Target(options["fname"])
128128
with target.chdir_work():

docs/guide/contributors/workflow.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ Deprecated code should also be marked as legacy code. We use [Yore](https://pawa
5757
Examples:
5858

5959
```python title="Remove function when we bump to 2.0"
60+
# YORE: Bump 2: Remove block.
61+
def deprecated_function():
62+
...
63+
```
6064

6165
```python title="Simplify imports when Python 3.15 is EOL"
6266
# YORE: EOL 3.15: Replace block with line 4.

docs/guide/users/checking.md

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ Griffe is able to compare two snapshots of your project to detect API breakages
99
By default, Griffe will compare the current code to the latest tag:
1010

1111
```console
12-
$ griffecli check mypackage
12+
$ griffe check mypackage
1313
```
1414

1515
To specify another Git reference to check against, use the `--against` or `-a` option:
1616

1717
```console
18-
$ griffecli check mypackage -a 0.2.0
18+
$ griffe check mypackage -a 0.2.0
1919
```
2020

2121
You can specify a Git tag, commit (hash), or even a branch: Griffe will create a worktree at this reference in a temporary directory, and clean it up after finishing.
2222

2323
If you want to also specify the *base* reference to use (instead of the current code), use the `--base` or `-b` option. Some examples:
2424

2525
```console
26-
$ griffecli check mypackage -b HEAD -a 2.0.0
27-
$ griffecli check mypackage -b 2.0.0 -a 1.0.0
28-
$ griffecli check mypackage -b fix-issue-90 -a 1.2.3
29-
$ griffecli check mypackage -b 8afcfd6e
26+
$ griffe check mypackage -b HEAD -a 2.0.0
27+
$ griffe check mypackage -b 2.0.0 -a 1.0.0
28+
$ griffe check mypackage -b fix-issue-90 -a 1.2.3
29+
$ griffe check mypackage -b 8afcfd6e
3030
```
3131

3232
TIP: **Important:** Remember that the base is the most recent reference, and the one we compare it against is the oldest one.
3333

34-
The package name you pass to `griffecli check` must be found relative to the repository root. For Griffe to find packages in subfolders, pass the parent subfolder to the `--search` or `-s` option. Example for `src`-layouts:
34+
The package name you pass to `griffe check` must be found relative to the repository root. For Griffe to find packages in subfolders, pass the parent subfolder to the `--search` or `-s` option. Example for `src`-layouts:
3535

3636
```console
37-
$ griffecli check -s src griffe
37+
$ griffe check -s src griffe
3838
```
3939

4040
Example in a monorepo, within a deeper file tree:
4141

4242
```console
43-
$ griffecli check -s back/services/identity-provider/src identity_provider
43+
$ griffe check -s back/services/identity-provider/src identity_provider
4444
```
4545

4646
### Using PyPI
@@ -54,39 +54,39 @@ $ pip install griffe[pypi]
5454
The command syntax is:
5555

5656
```console
57-
$ griffecli check package_name -b project-name==2.0 -a project-name==1.0
57+
$ griffe check package_name -b project-name==2.0 -a project-name==1.0
5858
```
5959

6060
You can let Griffe guess the package name by passing an empty string:
6161

6262
```console
63-
$ griffecli check "" -b project-name==2.0 -a project-name==1.0
63+
$ griffe check "" -b project-name==2.0 -a project-name==1.0
6464
```
6565

6666
[PEP 508 version specifiers](https://peps.python.org/pep-0508/) are supported (`<`, `<=`, `!=`, `==`, `>=`, `>`, `~=`). For example, to compare v2 against the version just before it:
6767

6868
```console
69-
$ griffecli check "" -b project-name==2.0 -a project-name<2.0
69+
$ griffe check "" -b project-name==2.0 -a project-name<2.0
7070
```
7171

7272
Without a version specifier on the base reference, or without a base reference at all, Griffe will use the latest available version. The two following commands compare the latest version against v1:
7373

7474
```console
75-
$ griffecli check "" -b project-name -a project-name==1.0
76-
$ griffecli check "" -a project-name==1.0
75+
$ griffe check "" -b project-name -a project-name==1.0
76+
$ griffe check "" -a project-name==1.0
7777
```
7878

7979
Griffe will actually install packages in a cache directory. It means a few things: source distributions are supported, and only packages that are compatible with your current environment can be checked.
8080

8181
## Python API
8282

83-
To programmatically check for API breaking changes, you have to load two snapshots of your code base, for example using our [`load_git()`][griffelib.load_git] utility, and then passing them both to the [`find_breaking_changes()`][griffelib.find_breaking_changes] function. This function will yield instances of [`Breakage`][griffelib.Breakage]. It's up to you how you want to use these breakage instances.
83+
To programmatically check for API breaking changes, you have to load two snapshots of your code base, for example using our [`load_git()`][griffe.load_git] utility, and then passing them both to the [`find_breaking_changes()`][griffe.find_breaking_changes] function. This function will yield instances of [`Breakage`][griffe.Breakage]. It's up to you how you want to use these breakage instances.
8484

8585
```python
8686
import griffe
8787

88-
my_pkg_v1 = griffelib.load_git("my_pkg", ref="v1")
89-
my_pkg_v2 = griffelib.load_git("my_pkg", ref="v2")
88+
my_pkg_v1 = griffe.load_git("my_pkg", ref="v1")
89+
my_pkg_v2 = griffe.load_git("my_pkg", ref="v2")
9090

9191
for breaking_change in find_breaking_changes(my_pkg_v1, my_pkg_v2):
9292
print(breaking_change.explain())
@@ -110,7 +110,7 @@ jobs:
110110
fetch-depth: 0 # We the need the full Git history.
111111
- uses: astral-sh/setup-uv@v6
112112
# The following command will compare current changes to latest tag.
113-
- run: uvx griffecli check --search src --format github your_package_name
113+
- run: uvx griffe check --search src --format github your_package_name
114114
```
115115
116116
The last step will fail the workflow if any breaking change is found.
@@ -643,9 +643,9 @@ Griffe supports writing detected breakages in multiple formats, or styles.
643643

644644
This is the default format. Griffe will print each detected breakage on a single line:
645645

646-
```console exec="1" source="console" result="ansi" returncode="1" id="griffecli-check-oneline"
646+
```console exec="1" source="console" result="ansi" returncode="1" id="griffe-check-oneline"
647647
$ export FORCE_COLOR=1 # markdown-exec: hide
648-
$ griffecli check griffe -ssrc -b0.46.0 -a0.45.0
648+
$ griffe check griffe -ssrc -b0.46.0 -a0.45.0
649649
```
650650

651651
[](){#format-verbose}
@@ -655,11 +655,11 @@ $ griffecli check griffe -ssrc -b0.46.0 -a0.45.0
655655
- **CLI**: `-f verbose` / `-v`
656656
- **API**: `check(..., style="verbose")` / `check(..., style=ExplanationStyle.VERBOSE)` / `check(..., verbose=True)`
657657

658-
Depending on the detected breakages, the lines might be hard to read (being too compact), so `griffecli check` also accepts a `--verbose` or `-v` option to add some space to the output:
658+
Depending on the detected breakages, the lines might be hard to read (being too compact), so `griffe check` also accepts a `--verbose` or `-v` option to add some space to the output:
659659

660-
```console exec="1" source="console" result="ansi" returncode="1" id="griffecli-check-verbose"
660+
```console exec="1" source="console" result="ansi" returncode="1" id="griffe-check-verbose"
661661
$ export FORCE_COLOR=1 # markdown-exec: hide
662-
$ griffecli check griffe -ssrc -b0.46.0 -a0.45.0 --verbose
662+
$ griffe check griffe -ssrc -b0.46.0 -a0.45.0 --verbose
663663
```
664664

665665
[](){#format-markdown}
@@ -672,26 +672,26 @@ $ griffecli check griffe -ssrc -b0.46.0 -a0.45.0 --verbose
672672
The Markdown format is adapted for changelogs. It doesn't show the file and line number, and instead prints out the complete path of your API objects. With a bit of automation, you will be able to automatically insert a summary of breaking changes in your changelog entries.
673673

674674
```md exec="1" source="tabbed-left" tabs="Output|Result"
675-
- `griffelib.loader.GriffeLoader.resolve_aliases(only_exported)`: *Parameter kind was changed*: positional or keyword -> keyword-only
676-
- `griffelib.loader.GriffeLoader.resolve_aliases(only_exported)`: *Parameter default was changed*: `True` -> `None`
677-
- `griffelib.loader.GriffeLoader.resolve_aliases(only_known_modules)`: *Parameter kind was changed*: positional or keyword -> keyword-only
678-
- `griffelib.loader.GriffeLoader.resolve_aliases(only_known_modules)`: *Parameter default was changed*: `True` -> `None`
679-
- `griffelib.loader.GriffeLoader.resolve_aliases(max_iterations)`: *Parameter kind was changed*: positional or keyword -> keyword-only
680-
- `griffelib.loader.GriffeLoader.resolve_module_aliases(only_exported)`: *Parameter was removed*
681-
- `griffelib.loader.GriffeLoader.resolve_module_aliases(only_known_modules)`: *Parameter was removed*
682-
- `griffelib.git.tmp_worktree(commit)`: *Parameter was removed*
683-
- `griffelib.git.tmp_worktree(repo)`: *Positional parameter was moved*: position: from 2 to 1 (-1)
684-
- `griffelib.git.load_git(commit)`: *Parameter was removed*
685-
- `griffelib.git.load_git(repo)`: *Parameter kind was changed*: positional or keyword -> keyword-only
686-
- `griffelib.git.load_git(submodules)`: *Parameter kind was changed*: positional or keyword -> keyword-only
687-
- `griffelib.git.load_git(try_relative_path)`: *Parameter was removed*
688-
- `griffelib.git.load_git(extensions)`: *Parameter kind was changed*: positional or keyword -> keyword-only
689-
- `griffelib.git.load_git(search_paths)`: *Parameter kind was changed*: positional or keyword -> keyword-only
690-
- `griffelib.git.load_git(docstring_parser)`: *Parameter kind was changed*: positional or keyword -> keyword-only
691-
- `griffelib.git.load_git(docstring_options)`: *Parameter kind was changed*: positional or keyword -> keyword-only
692-
- `griffelib.git.load_git(lines_collection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
693-
- `griffelib.git.load_git(modules_collection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
694-
- `griffelib.git.load_git(allow_inspection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
675+
- `griffe.loader.GriffeLoader.resolve_aliases(only_exported)`: *Parameter kind was changed*: positional or keyword -> keyword-only
676+
- `griffe.loader.GriffeLoader.resolve_aliases(only_exported)`: *Parameter default was changed*: `True` -> `None`
677+
- `griffe.loader.GriffeLoader.resolve_aliases(only_known_modules)`: *Parameter kind was changed*: positional or keyword -> keyword-only
678+
- `griffe.loader.GriffeLoader.resolve_aliases(only_known_modules)`: *Parameter default was changed*: `True` -> `None`
679+
- `griffe.loader.GriffeLoader.resolve_aliases(max_iterations)`: *Parameter kind was changed*: positional or keyword -> keyword-only
680+
- `griffe.loader.GriffeLoader.resolve_module_aliases(only_exported)`: *Parameter was removed*
681+
- `griffe.loader.GriffeLoader.resolve_module_aliases(only_known_modules)`: *Parameter was removed*
682+
- `griffe.git.tmp_worktree(commit)`: *Parameter was removed*
683+
- `griffe.git.tmp_worktree(repo)`: *Positional parameter was moved*: position: from 2 to 1 (-1)
684+
- `griffe.git.load_git(commit)`: *Parameter was removed*
685+
- `griffe.git.load_git(repo)`: *Parameter kind was changed*: positional or keyword -> keyword-only
686+
- `griffe.git.load_git(submodules)`: *Parameter kind was changed*: positional or keyword -> keyword-only
687+
- `griffe.git.load_git(try_relative_path)`: *Parameter was removed*
688+
- `griffe.git.load_git(extensions)`: *Parameter kind was changed*: positional or keyword -> keyword-only
689+
- `griffe.git.load_git(search_paths)`: *Parameter kind was changed*: positional or keyword -> keyword-only
690+
- `griffe.git.load_git(docstring_parser)`: *Parameter kind was changed*: positional or keyword -> keyword-only
691+
- `griffe.git.load_git(docstring_options)`: *Parameter kind was changed*: positional or keyword -> keyword-only
692+
- `griffe.git.load_git(lines_collection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
693+
- `griffe.git.load_git(modules_collection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
694+
- `griffe.git.load_git(allow_inspection)`: *Parameter kind was changed*: positional or keyword -> keyword-only
695695
```
696696

697697
[](){#format-github}
@@ -701,7 +701,7 @@ The Markdown format is adapted for changelogs. It doesn't show the file and line
701701
- **CLI**: `-f github`
702702
- **API**: `check(..., style="github")` / `check(..., style=ExplanationStyle.GITHUB)`
703703

704-
When running `griffecli check` in CI, you can enable GitHub's annotations thanks to the GitHub output style. Annotations are displayed on specific lines of code. They are visible in the Checks tab. When you create an annotation for a file that is part of the pull request, the annotations are also shown in the Files changed tab.
704+
When running `griffe check` in CI, you can enable GitHub's annotations thanks to the GitHub output style. Annotations are displayed on specific lines of code. They are visible in the Checks tab. When you create an annotation for a file that is part of the pull request, the annotations are also shown in the Files changed tab.
705705

706706
/// tab | Files changed tab
707707
![gha_annotations_2](../../img/gha_annotations_2.png)
@@ -712,12 +712,12 @@ When running `griffecli check` in CI, you can enable GitHub's annotations thanks
712712
///
713713

714714
```console
715-
% python -m griffecli check -fgithub -ssrc griffe
716-
::warning file=packages/griffe/src/griffe/finder.py,line=58,title=Package.name::Attribute value was changed: `name` -> unset
717-
::warning file=packages/griffe/src/griffe/finder.py,line=60,title=Package.path::Attribute value was changed: `path` -> unset
718-
::warning file=packages/griffe/src/griffe/finder.py,line=62,title=Package.stubs::Attribute value was changed: `stubs` -> `None`
719-
::warning file=packages/griffe/src/griffe/finder.py,line=75,title=NamespacePackage.name::Attribute value was changed: `name` -> unset
720-
::warning file=packages/griffe/src/griffe/finder.py,line=77,title=NamespacePackage.path::Attribute value was changed: `path` -> unset
715+
% python -m griffe check -fgithub -ssrc griffe
716+
::warning file=src/griffe/finder.py,line=58,title=Package.name::Attribute value was changed: `name` -> unset
717+
::warning file=src/griffe/finder.py,line=60,title=Package.path::Attribute value was changed: `path` -> unset
718+
::warning file=src/griffe/finder.py,line=62,title=Package.stubs::Attribute value was changed: `stubs` -> `None`
719+
::warning file=src/griffe/finder.py,line=75,title=NamespacePackage.name::Attribute value was changed: `name` -> unset
720+
::warning file=src/griffe/finder.py,line=77,title=NamespacePackage.path::Attribute value was changed: `path` -> unset
721721
```
722722

723723
## Next steps

0 commit comments

Comments
 (0)