aboutcode-org / aboutcode-org/extractcode

Side effects on locale and timezone when importing `extractcode.libarchive2` as library

Offen
#65 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
39
Forks
23
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Importing `extractcode.libarchive2` has unexpected side effects on the caller, especially when used as a library inside a larger project.

In my specific case, the base application is running with the `Europe/Berlin` timezone, as this is my local time. After having executed some extraction code involving the aforementioned module, my timezone is set to UTC. This only became obvious because my logging showed that processing the archive finished nearly two hours before starting the process.

The reason is https://github.com/aboutcode-org/extractcode/blob/db9dd083239302220b996bcf9c1914cd5c3ff016/src/extractcode/libarchive2.py#L135-L143 In my opinion, libraries should not change such stuff globally without any warning.

Edit: It seems like these aspects are not covered by unit tests as well, which makes evaluating alternatives or removing these lines harder.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.