Skip to content

Commit a2e13bf

Browse files
authored
Merge pull request #435 from mkdocstrings/copilot/sub-pr-434
change: Reorganize as `griffe` and `griffelib` packages with uv workspaces
2 parents df434cb + 1ef3a63 commit a2e13bf

File tree

17 files changed

+183
-125
lines changed

17 files changed

+183
-125
lines changed

config/ruff.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ ignore = [
3535
"TRY003", # Avoid specifying long messages outside the exception class
3636
]
3737

38-
logger-objects = ["griffelib.logger"]
38+
logger-objects = ["griffe.logger", "griffelib.logger"]
3939

4040
[lint.per-file-ignores]
41-
"packages/griffe/src/griffe/__main__.py" = [
41+
"packages/griffecli/src/griffecli/__main__.py" = [
4242
"D100", # Missing module docstring
4343
]
44-
"packages/griffe/src/griffe/_internal/cli.py" = [
44+
"packages/griffecli/src/griffecli/_internal/cli.py" = [
4545
"T201", # Print statement
4646
]
47-
"packages/griffe/src/griffe/_internal/git.py" = [
47+
"packages/griffelib/src/griffelib/_internal/git.py" = [
4848
"S603", # `subprocess` call: check for execution of untrusted input
4949
"S607", # Starting a process with a partial executable path
5050
]
51-
"packages/griffe/src/griffe/_internal/agents/nodes/*.py" = [
51+
"packages/griffelib/src/griffelib/_internal/agents/nodes/*.py" = [
5252
"ARG001", # Unused function argument
5353
"N812", # Lowercase `keyword` imported as non-lowercase `NodeKeyword`
5454
]
55-
"packages/griffe/src/griffe/_internal/debug.py" = [
55+
"packages/griffelib/src/griffelib/_internal/debug.py" = [
5656
"T201", # Print statement
5757
]
58-
"packages/griffe/src/griffe/_internal/**.py" = [
58+
"packages/griffelib/src/griffelib/_internal/**.py" = [
5959
"D100", # Missing docstring in public module
6060
]
6161
"scripts/*.py" = [
@@ -84,7 +84,7 @@ docstring-quotes = "double"
8484
ban-relative-imports = "all"
8585

8686
[lint.isort]
87-
known-first-party = ["griffe"]
87+
known-first-party = ["griffe", "griffelib", "griffecli"]
8888

8989
[lint.pydocstyle]
9090
convention = "google"

packages/griffecli/pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,17 @@ classifiers = [
4141
"Typing :: Typed",
4242
]
4343

44+
[project.scripts]
45+
griffecli = "griffecli:main"
46+
4447
[tool.hatch.metadata.hooks.uv-dynamic-versioning]
48+
# Dependencies are dynamically versioned; {{version}} is substituted at build time.
49+
dependencies = ["griffelib=={{version}}", "colorama>=0.4"]
4550

4651
[tool.hatch.metadata.hooks.uv-dynamic-versioning.optional-dependencies]
52+
# No optional dependencies for the CLI package
4753

4854
[tool.hatch.build.targets.sdist]
55+
56+
[tool.hatch.build.targets.wheel]
57+
sources = ["src/"]
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
# TODO: Cut proper imports from griffelib `__init__.py` module
1+
# This top-level module imports all public names from the CLI package,
2+
# and exposes them as public objects.
3+
4+
"""Griffe CLI package.
5+
6+
The CLI (Command Line Interface) for the griffe library.
7+
This package provides command-line tools for interacting with griffe.
8+
9+
## CLI entrypoints
10+
11+
- [`griffecli.main`][]: Run the main program.
12+
- [`griffecli.check`][]: Check for API breaking changes in two versions of the same package.
13+
- [`griffecli.dump`][]: Load packages data and dump it as JSON.
14+
- [`griffecli.get_parser`][]: Get the argument parser for the CLI.
15+
"""
16+
17+
from __future__ import annotations
18+
19+
from griffecli._internal.cli import DEFAULT_LOG_LEVEL, check, dump, get_parser, main
20+
21+
__all__ = [
22+
"DEFAULT_LOG_LEVEL",
23+
"check",
24+
"dump",
25+
"get_parser",
26+
"main",
27+
]

packages/griffecli/src/griffecli/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Entry-point module, in case you use `python -m griffelib`.
1+
# Entry-point module, in case you use `python -m griffecli`.
22
#
33
# Why does this file exist, and why `__main__`? For more info, read:
44
#
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Internal modules for the griffecli package.

packages/griffecli/src/griffecli/_internal/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# We might be tempted to import things from `__main__` later,
55
# but that will cause problems; the code will get executed twice:
66
#
7-
# - When we run `python -m griffelib`, Python will execute
7+
# - When we run `python -m griffecli`, Python will execute
88
# `__main__.py` as a script. That means there won't be any
9-
# `griffelib.__main__` in `sys.modules`.
9+
# `griffecli.__main__` in `sys.modules`.
1010
# - When you import `__main__` it will get executed again (as a module) because
11-
# there's no `griffelib.__main__` in `sys.modules`.
11+
# there's no `griffecli.__main__` in `sys.modules`.
1212

1313
from __future__ import annotations
1414

packages/griffelib/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ classifiers = [
4242
]
4343

4444
[tool.hatch.metadata.hooks.uv-dynamic-versioning]
45+
# No base dependencies needed for griffelib
4546

4647
[tool.hatch.metadata.hooks.uv-dynamic-versioning.optional-dependencies]
48+
# The 'pypi' extra provides dependencies needed for the load_pypi functionality
49+
# to download and inspect packages from PyPI.
50+
pypi = ["pip>=24.0", "platformdirs>=4.2", "wheel>=0.42"]
4751

4852
[tool.hatch.build.targets.sdist]
53+
54+
[tool.hatch.build.targets.wheel]
55+
sources = ["src/"]

0 commit comments

Comments
 (0)