log2timeline / plaso

Super timeline all the things
https://plaso.readthedocs.io
Apache License 2.0
1.73k stars 351 forks source link

Remove indirect dependencies #4873

Open thinrope opened 7 months ago

thinrope commented 7 months ago

While working on packaging latest plaso for Gentoo, I think I see two python modules (idna,cffi) which are not referenced in any code, yet they are installed by some of the scripts. I suggest to have them removed from dependencies.ini and requirements.txt.

Those are only indirect dependencies as follows:

This concerns plaso-20240409 on Gentoo installed from my pkalin overlay, as there is no official plaso support on Gentoo yet.

NOTE: Description was edited as follows:

joachimmetz commented 7 months ago

cryptography should be no longer there, idna and cffi we would need to check.

joachimmetz commented 7 months ago

looks like idna was a requirement of cryptography and requests, cryptography is no longer used, but let me check requests

joachimmetz commented 7 months ago

Looks like idna still is a dependency of requests https://github.com/psf/requests/blob/main/setup.cfg#L6 . I would need to look why it was explicitly added instead of it being an implicit dependency. I recommend we keep that one for now.

joachimmetz commented 7 months ago

And cffi is a dependency of xattr https://github.com/xattr/xattr/blob/main/pyproject.toml#L15

joachimmetz commented 7 months ago

I would need to assess first, the reason for these indirect dependencies were added. Likely due to one of the packaging/environments failing to include them.

joachimmetz commented 7 months ago

Looks like cffi was added for cryptography but this predates the inclusion of xattr https://github.com/log2timeline/plaso/commit/221a2983c43eb29a6939b77909635e55dd654d4d

joachimmetz commented 7 months ago

Idna was explicitly added for requests https://github.com/log2timeline/plaso/commit/8871cd9777e4e6c7b92737ea1864a8164a8287b4

thinrope commented 7 months ago

I'll work on this a bit more, but here are my thoughts:

joachimmetz commented 7 months ago

no indirect deps should be present

Unfortunately the "should" here is one of those theory versus reality arguments. They were added because they were needed.

we need better tests :-)

tests can always be improved

thinrope commented 7 months ago

I am digging around and so far I don't see any direct use of cffi nor idna across the projects even:

(Disclaimer: The above two ways are the only standard ways to use a Python module, AFAIK)

While dfvfs also lists cffi as direct dep, I see no place where it is used. Based on blame, cffi is a remains of pycrypto->cryptography move 5 years ago (and now cryptography is no longer used). Let me know if we need another issue for this (since different project).

joachimmetz commented 7 months ago

(Disclaimer: The above two ways are the only standard ways to use a Python module, AFAIK)

Python has many "standard" ways of using modules.

I'll have a closer looks when time permits. Maybe this was msi or Pyinstaller related.