Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: simplify extractor #96

Merged
merged 19 commits into from
Oct 24, 2023
Merged

refactor: simplify extractor #96

merged 19 commits into from
Oct 24, 2023

Conversation

cmdoret
Copy link
Member

@cmdoret cmdoret commented Oct 23, 2023

This PR simplifies the extractor interface by adding a unique Repository model (see #71).
Until now, all repository metadata was stored directly in extractors, and each extractor had to define its own schema for RDF serialization. The aim of this PR is to decouple the extractor from the repository. It does the following:

  • Extractors only have the (public) methods list_files() and extract().
  • extract() returns a Repository object (instead of editing the extractor in place.
  • Repository is a dataclass that stores the repository metadata and can be serialized to RDF.
  • All serialization schemas are removed, as we only need RepositorySchema

Using a single serialization for all extractors required minor metadata alignments. I made the following choices:

  • There can be multiple authors (git and github had a single author, whereas gitlab had multiple)
  • Dropped schema:isPartOf, which was only used in GitLab
    • We also used it to denote affiliation to an organization, which is not its intended use

@cmdoret cmdoret added the refactor improving code without user-facing changes label Oct 23, 2023
@cmdoret cmdoret self-assigned this Oct 23, 2023
Copy link
Member

@rmfranken rmfranken left a comment

Choose a reason for hiding this comment

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

tres beau.

gimie/sources/git.py Outdated Show resolved Hide resolved
@cmdoret cmdoret requested a review from rmfranken October 24, 2023 13:05
Copy link
Member

@rmfranken rmfranken left a comment

Choose a reason for hiding this comment

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

So safe!

@cmdoret cmdoret linked an issue Oct 24, 2023 that may be closed by this pull request
@cmdoret cmdoret merged commit 49b47c5 into main Oct 24, 2023
@vancauwe vancauwe self-requested a review November 2, 2023 14:45
@cmdoret cmdoret deleted the refactor/simpler-extractor branch November 10, 2023 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor improving code without user-facing changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce extractor complexity
2 participants