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

Stop using arrow/dateutil in favor of standard library #2250

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

legoktm
Copy link
Member

@legoktm legoktm commented Oct 2, 2024

Status

Work in progress

Description

The standard library's date formatting is better now (zoneinfo was added in 3.9), so we don't need to rely on the arrow and dateutil libraries.

A few specifics:

  • for the last sync file, just store a timestamp in ISO format. No back- compat is needed since reading is already fallible.
  • the API's date format is fixed, so tweak it into ISO format and parse.
  • to replace arrow's humanize, we can use babel's format_timedelta.

Note that this only actually removes arrow from our dependency tree as dateutil is a dependency of alembic. It's already been removed upstream, so once we upgrade alembic/SQLalchemy, it'll go away too.

Test Plan

TK

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:

  • I have updated the AppArmor profile
  • No update to the AppArmor profile is required for these changes
  • I don't know and would appreciate guidance

If these changes modify the database schema, you should include a database migration. Please check as applicable:

  • I have written a migration and upgraded a test database based on main and confirmed that the migration is self-contained and applies cleanly
  • I have written a migration but have not upgraded a test database based on main and would like the reviewer to do so
  • I need help writing a database migration
  • No database schema changes are needed

The standard library's date formatting is better now (zoneinfo was added
in 3.9), so we don't need to rely on the arrow and dateutil libraries.

A few specifics:
* for the last sync file, just store a timestamp in ISO format. No back-
  compat is needed since reading is already fallible.
* the API's date format is fixed, so tweak it into ISO format and parse.
* to replace arrow's humanize, we can use babel's format_timedelta.

Note that this only actually removes arrow from our dependency tree as
dateutil is a dependency of alembic. It's already been removed upstream,
so once we upgrade alembic/SQLalchemy, it'll go away too.
@legoktm
Copy link
Member Author

legoktm commented Oct 7, 2024

to replace arrow's humanize, we can use babel's format_timedelta.

babel is currently only a dev dependency, so it needs to be upgraded to prod (it's already prod on the server, so no diff review needed probably).

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.

1 participant