Skip to content

Conversation

multimeric
Copy link

Summary of changes

Rebase of #3169 against 7-maintenance.

All these changes should have no impact at runtime, they're purely to improve UX through static analysis.

  • Convert Term to a typed NamedTuple from a namedtuple. This makes static analysis easier in that your IDE and type checker can understand which fields are present on the type, the type of each field, and give each field its own documentation
  • Document the meaning of each field in Term for usability
  • Move the type definition of Context fields into the class body. This is also for static analysis and allows the user to get tab completion etc when using these fields.

My long term goal is to make this context API usage as a public API, so that I can generate and interact with contexts programmatically instead of just by defining these in JSON.

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Checked that all tests and type checking passes.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

nicholascar and others added 10 commits March 29, 2025 12:06
Co-authored-by: Daan de Schepper <d.de.schepper@rijksmuseum.nl>
* test: fix failing webtest

Fixes RDFLib#3192

* Revert "remove old hacks against 2to3 (RDFLib#3076)" (RDFLib#3195)

This reverts commit b74c657.
* Specify `Optional` parameters in `Graph.triples_choices`

The two non-list parameters can be `None`, but this is not reflected in
the type hint.

Also introduces a type alias to simplify method signatures.

* style: remove unused imports

---------

Co-authored-by: Nicholas Car <nick@kurrawong.net>
Co-authored-by: Edmond Chuc <37032744+edmondchuc@users.noreply.github.com>
Co-authored-by: Edmond Chuc <edmond@kurrawong.ai>
@edmondchuc
Copy link
Contributor

pre-commit.ci run

@edmondchuc
Copy link
Contributor

pre-commit.ci autofix

pre-commit-ci bot and others added 4 commits September 4, 2025 06:44
…b#3197)

* feat: canonicalization with longturtle serializer now optional

Fixes RDFLib#3196

* docs: fix docs build error by removing py obj reference to canon
@edmondchuc
Copy link
Contributor

Thanks for rebasing this @multimeric. I think the tests are currently failing due to some dependency bumps in the lockfile. Any chance we can roll those back?

@multimeric
Copy link
Author

Thanks for rebasing this @multimeric. I think the tests are currently failing due to some dependency bumps in the lockfile. Any chance we can roll those back?

Done

@edmondchuc
Copy link
Contributor

Great, thanks for following up and making those changes.

The CI is now showig a few mypy/type errors. Would you mind having a look and seeing if you can address those as well?

@edmondchuc edmondchuc added the 7.x label Sep 16, 2025
@edmondchuc edmondchuc deleted the branch RDFLib:7.x September 18, 2025 03:08
@edmondchuc edmondchuc closed this Sep 18, 2025
@edmondchuc edmondchuc reopened this Sep 18, 2025
@edmondchuc edmondchuc changed the base branch from 7-maintenance to 7.x September 18, 2025 03:14
@edmondchuc
Copy link
Contributor

Just an FYI, I'm targeting the 7.x branch now as it's the branch intended for all v7 related features and fixes.

@multimeric
Copy link
Author

Thanks. The type errors are a bit annoying because it's making me fix everything in the JSON-LD parser, including things that I didn't change. I'll try to do so but it might not be soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants