Skip to content

Conversation

@JSCU-CNI
Copy link

@JSCU-CNI JSCU-CNI commented Sep 9, 2024

This PR adds an update utility to the dissect meta package and fixes #70. The goal is to provide users with one simple method of updating the dissect suite, no matter the installation method. The updater relies on the pyproject.toml dependencies definition.

We are open for better solutions. This script has worked well for us for some time, but perhaps we can find a better way to create a unified update solution.

@cecinestpasunepipe
Copy link

Thank you! Looks like a very interesting and useful solution. I'm going to try it myself!

@JSCU-CNI
Copy link
Author

Thanks @cecinestpasunepipe, please let me know what you think. I've added some more features in 2e09e83 and 6faacb7. Output should now show version changes and we now support editable git install updates too.

@Schamper Schamper self-requested a review September 10, 2024 11:13
@pyrco
Copy link
Contributor

pyrco commented Sep 12, 2024

If you don't mind me asking, what does this solve that a

pip install --upgrade dissect

won't do?

@JSCU-CNI
Copy link
Author

If you don't mind me asking, what does this solve that a pip install --upgrade dissect won't do?

That's a valid question, thanks for asking @pyrco. This is primarily helpful for installations with either:

  1. editable installs of (some or all) dissect git repositories
  2. modified or non-strict pyproject.toml dissect dependencies

If you have installed dissect using a "regular" pip install dissect, and you want to update to the latest non-pre release of dissect, this tool will still work for you, but you could indeed also use pip install -U dissect directly.

Unfortunately running pip install -U dissect will not cut it if you depend on for example dev versions of packages. If the defined version(s) in the pyproject.toml dependencies dict are broad (e.g. foo>1.0.0.dev,<2.0.0.dev) and pip has a local cache, pip will not even look in the remote registry for a newer version. Iterating over every dependency fixes that. This seems to be intended pip behaviour unfortunately.

We have had some hard to identify issues in the past due to some dependencies being out-of-date and some being up-to-date due to the described pip dependency resolving. This helper utility aims to remove these struggles once and for all by providing a unified known-good updating method, no matter the installation method (git+editable, pypi) or dependency definition (regular or modified) that was used.

@EinatFox
Copy link

EinatFox commented Oct 2, 2024

Hi @JSCU-CNI , please open an issue and attache this PR so we can schedule a review into our sprints.

@JSCU-CNI JSCU-CNI requested a review from Schamper June 26, 2025 17:34
from pathlib import Path
from typing import Iterator

from pip._vendor import tomli
Copy link
Member

Choose a reason for hiding this comment

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

Is this stable enough? Maybe add it as a dependency for Python versions below 3.11, and use tomllib when available?

return res


def main():
Copy link
Member

Choose a reason for hiding this comment

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

Maybe copy catch_sigpipe from dissect.target.

current_version = module.get("version")

if previous_version != current_version:
print(f"{module_name} \x1b[31m{previous_version}\x1b[0m -> \x1b[32m\x1b[1m{current_version}\x1b[0m")
Copy link
Member

Choose a reason for hiding this comment

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

Can you format this with some constants for the color codes? And maybe respect NO_COLOR?


def _run(cmd: str, verbose: int) -> subprocess.CompletedProcess:
"""Wrapper for subprocess run command."""
res = subprocess.run(cmd, shell=True, capture_output=True)
Copy link
Member

Choose a reason for hiding this comment

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

Can you change calls to this to be shell=False? I don't think there's a need for it. The calls will look a bit "uglier" but unless it's absolutely necessary to use shell=True we should avoid it.

black dissect
isort dissect

[testenv:lint]
Copy link
Member

Choose a reason for hiding this comment

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

Can you update these to use ruff?

JSCU-CNI and others added 3 commits July 15, 2025 12:58
Co-authored-by: Erik Schamper <1254028+Schamper@users.noreply.github.com>
Co-authored-by: Erik Schamper <1254028+Schamper@users.noreply.github.com>
Co-authored-by: Erik Schamper <1254028+Schamper@users.noreply.github.com>
@Schamper Schamper self-requested a review September 22, 2025 08:10
@Schamper
Copy link
Member

Hi @JSCU-CNI, can you address the review comments or otherwise say if this PR is still necessary for you?

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.

Add update tool

5 participants