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

Dependency Sources #56

Open
c0rydoras opened this issue Aug 14, 2023 · 0 comments · May be fixed by #299
Open

Dependency Sources #56

c0rydoras opened this issue Aug 14, 2023 · 0 comments · May be fixed by #299
Assignees
Labels
backend This issue or pull request is backend related breaking This issue or pull request discusses something breaking feature This issue or pull request discusses a feature

Comments

@c0rydoras
Copy link
Collaborator

c0rydoras commented Aug 14, 2023

Goal

  • Allow multiple dependency_sources (packages) e.g package-a/yarn.lock, package-b/yarn.lock
  • Assign maintainers per source

Implementation

  • Projects have a m2m of DependencySource
  • Projects do no longer have versioned_dependencies or maintainers
  • DependencySource has versions which is an m2m for Version
  • Maintainers now have a source field that replaces the project field
class Maintainer
    ...
    source = models.ForeignKey(
        DependencySource, on_delete=models.CASCADE, related_name="maintainers"
    )
    ...
  • Due to how lockfiles are implemented we use their name and create a source from it:
class Tracker:
    # this would also be adjusted further
    ...
    def _get_lockfile(self, root, file):
        file_path = path.join(root, file)
        rel_file_path = path.relpath(file_path, self.local_path)
        with open(file_path, "r") as file_content:
            return {"name": rel_file_path, "data": file_content.read()} # e.g. {"name": "./api/poetry.lock", "data": "..."}

    @property
    def lockfiles(self):
        if not self.has_local_copy:
            raise RepoDoesNotExist(
                f"Unable to retrieve lockfiles for {self.project.repo} because it is not saved locally."
            )

        lockfile_list = []
        for root, _, files in walk(self.local_path):
            if ".git" in root:
                continue

            lockfile_list.extend([self._get_lockfile(root, file) for file in files])

        return lockfile_list
     ...
  • Adjust Parser to set versions on sources instead of versioned_dependencies on the project
  • Adjust views and serializers
  • Adjust tests
  • Write tests

Further implementation

@c0rydoras c0rydoras added backend This issue or pull request is backend related feature This issue or pull request discusses a feature breaking This issue or pull request discusses something breaking labels Aug 14, 2023
@c0rydoras c0rydoras self-assigned this Aug 14, 2023
@c0rydoras c0rydoras added this to the Outdated v1 milestone Aug 14, 2023
@c0rydoras c0rydoras removed this from the Outdated v1 milestone Feb 9, 2024
@c0rydoras c0rydoras linked a pull request Mar 5, 2024 that will close this issue
@c0rydoras c0rydoras linked a pull request Mar 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend This issue or pull request is backend related breaking This issue or pull request discusses something breaking feature This issue or pull request discusses a feature
Projects
Status: Waiting for review
Development

Successfully merging a pull request may close this issue.

1 participant