Skip to content

Conversation

@johnslavik
Copy link
Member

@johnslavik johnslavik commented Nov 30, 2025

Continuation of #431, based on #433, closes #408
Migration script: https://gist.github.com/johnslavik/76d556a427033c4de2d236d67aa05b8f

@johnslavik
Copy link
Member Author

Let's try Copilot here

@johnslavik
Copy link
Member Author

johnslavik commented Nov 30, 2025

@copilot We've migrated griffe to 3 packages exposed by griffe package in a backward-compatible way, all bound by uv dynamic versioning that ensures compatibility. griffecli is supposed to only implement and expose CLI (which needs proper configuration in pyproject.toml) and depend on griffelib=={{version}}. griffelib is supposed depend on nothing and implement the necessary logic. griffe is supposed to be a backward-compatible package depending on both griffelib and griffecli, with all the previous packaging and runtime behaviors in regular use as before the migration.

Fix any instances of name errors (import griffe, but then griffelib is used, etc.), inconsistencies caused by the migration, and any references broken by the migration script. Make sure that the griffecli's init module is correct. Do complete whatever the migration script missed, making sure the migration is fully complete and backward-compatible. Update the documentation to reflect new changes, if necessary. Document all changes that you've made.

Copy link

Copilot AI commented Nov 30, 2025

@johnslavik I've opened a new pull request, #435, to work on those changes. Once the pull request is ready, I'll request review from you.

@johnslavik
Copy link
Member Author

@copilot Add missing configuration from pyproject.toml (check CI failures) and make sure that we promote the old way of running things (griffe check, not griffecli check; python -m griffe, not python -m griffecli) -- but document that it is possible to use python -m griffecli instead of python -m griffe where it makes sense.

Copy link

Copilot AI commented Nov 30, 2025

@johnslavik I've opened a new pull request, #436, to work on those changes. Once the pull request is ready, I'll request review from you.

@johnslavik
Copy link
Member Author

@copilot Look at https://github.com/mkdocstrings/griffe/actions/runs/19806731977/job/56741990187?pr=434. Fix all incorrect refs

Copy link

Copilot AI commented Dec 1, 2025

@johnslavik I've opened a new pull request, #437, to work on those changes. Once the pull request is ready, I'll request review from you.

Comment on lines +11 to +14
- [`griffecli.main`][]: Run the main program.
- [`griffecli.check`][]: Check for API breaking changes in two versions of the same package.
- [`griffecli.dump`][]: Load packages data and dump it as JSON.
- [`griffecli.get_parser`][]: Get the argument parser for the CLI.
Copy link
Member

@pawamoy pawamoy Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a mix of cross-ref, some using griffe.*, some using griffecli.* or griffelib.*, we should make them consistent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- I'd opt for griffe where possible, as in #434 (comment)

# Absolute file path probably means temporary worktree.
# We use our worktree prefix to remove some components
# of the path on the left (`/tmp/griffe-worktree-*/griffe_*/repo`).
# of the path on the left (`/tmp/griffelib-worktree-*/griffe_*/repo`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could keep these foders named "griffe" rather than "griffelib", as the distinction is not important in this case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup

if _match_pattern(path.name, (*_editable_editables_patterns, *_editable_scikit_build_core_patterns)):
# Support for how 'editables' write these files:
# example line: `F.map_module('griffe', '/media/data/dev/griffe/src/griffe/__init__.py')`.
# example line: `F.map_module('griffelib', '/media/data/dev/griffelib/packages/griffelib/src/griffelib/__init__.py')`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine if we keep the previous version of these comments as they're just examples (and still valid I believe even after the migration).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

with TemporaryDirectory(prefix=f"{_WORKTREE_PREFIX}{repo_name}-{normref}-") as tmp_dir:
location = os.path.join(tmp_dir, normref) # noqa: PTH118
tmp_branch = f"griffe-{normref}" # Temporary branch name must not already exist.
tmp_branch = f"griffelib-{normref}" # Temporary branch name must not already exist.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could keep using griffe, see previous comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

import platformdirs # noqa: PLC0415

pypi_cache_dir = Path(platformdirs.user_cache_dir("griffe"))
pypi_cache_dir = Path(platformdirs.user_cache_dir("griffelib"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we could keep using griffe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely

data = python_handler.collect("griffe", options=python_handler.get_options({}))

with mkdocs_gen_files.open("griffe.json", "w") as fd:
with mkdocs_gen_files.open("griffelib.json", "w") as fd:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to update this somehow, to contain griffe, griffecli and griffelib.

src = root / "src"
public_api = src / "griffe"
print(f"{'#' * heading_level} `griffe.__main__`\n")
print(f"{'#' * heading_level} `griffelib.__main__`\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be griffe or griffecli rather than grifflib here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

change: Split griffe to griffe and griffelib packages

3 participants