Skip to content

#750: Updated dependency pip-audit#754

Open
ckunki wants to merge 12 commits intomainfrom
refactoring/750-Updated_dependency_pip-audit
Open

#750: Updated dependency pip-audit#754
ckunki wants to merge 12 commits intomainfrom
refactoring/750-Updated_dependency_pip-audit

Conversation

@ckunki
Copy link
Contributor

@ckunki ckunki commented Mar 18, 2026

Closes #750

Checklist

Note: If any of the items in the checklist are not relevant to your PR, just check the box.

For any Pull Request

Is the following correct:

  • the title of the Pull Request?
  • the title of the corresponding issue?
  • there are no other open Pull Requests for the same update/change?
  • that the issue which this Pull Request fixes ("Fixes...") is mentioned?

When Changes Were Made

Did you:

  • update the changelog?
  • update the cookiecutter-template?
  • update the implementation?
  • check coverage and add tests: unit tests and, if relevant, integration tests?
  • update the User Guide & other documentation?
  • resolve any failing CI criteria (incl. Sonar quality gate)?

When Preparing a Release

Have you:

  • thought about version number (major, minor, patch)?
  • checked Exasol packages for updates and resolved open vulnerabilities, if easily possible?

@ckunki ckunki temporarily deployed to manual-approval March 18, 2026 13:45 — with GitHub Actions Inactive
@ckunki ckunki temporarily deployed to manual-approval March 18, 2026 14:20 — with GitHub Actions Inactive
@ckunki ckunki temporarily deployed to manual-approval March 18, 2026 14:47 — with GitHub Actions Inactive
@ckunki ckunki temporarily deployed to manual-approval March 18, 2026 14:56 — with GitHub Actions Inactive
stdout: str
stderr: str

def __init__(self, subprocess_output: subprocess.CompletedProcess) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think, adding method __init__ to a dataclass could be problematic.

)


PipAuditEntry = dict[str, str | list[str] | tuple[str, ...]]
Copy link
Contributor Author

@ckunki ckunki Mar 18, 2026

Choose a reason for hiding this comment

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

Improve readability and reduce typing effort in type hints.

references_subsection = f"\n#### References:\n\n* {links_join}\n\n "
subsection = f"### {self.vulnerability_id} in {self.package.coordinates}\n\n{self.description}\n{references_subsection}"
return cleandoc(subsection.strip())
indent = " " * 12
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a cleandoc and some indent magic improves readability.

)


def aux_subprocess(*cmd, **kwargs) -> subprocess.CompletedProcess:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were multiple calls to suprocess.run().

The following approach

  • minimizes code-duplication
  • defines defaults for crucial kwargs like check and capture_output in a central place
  • capture_output reduces clutter in pytest output when running the test locally

return subprocess.run(cmd, **kwargs_with_defaults)


class PoetryProject:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This class is a bit longer than the original implementation.
But it improves readability by using method-chaining to express the setup of the sample project under test.

@ckunki ckunki temporarily deployed to manual-approval March 18, 2026 16:07 — with GitHub Actions Inactive
@ckunki ckunki temporarily deployed to manual-approval March 18, 2026 16:24 — with GitHub Actions Inactive
@ckunki ckunki deployed to manual-approval March 18, 2026 16:31 — with GitHub Actions Active
@sonarqubecloud
Copy link

def set_minimum_python_version(self, version: str) -> PoetryProject:
content = self.toml.read_text()
changed = re.sub(
r'^requires-python = ".*"$',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
r'^requires-python = ".*"$',
r'^requires-python\s*=\s*".*"$',

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.

Update pipaudit

2 participants