gmail-archiver

Locally archive Gmail emails.

https://github.com/tatsh/gmail-archiver

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.4%) to scientific vocabulary

Keywords

backup email gmail google

Keywords from Contributors

interactive mesh interpretability profiles optics sequences generic projection standardization optim
Last synced: 4 months ago · JSON representation ·

Repository

Locally archive Gmail emails.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
backup email gmail google
Created over 4 years ago · Last pushed 5 months ago
Metadata Files
Readme Changelog Contributing Funding License Citation Codeowners Security

README.md

gmail-archiver

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Documentation Status mypy pre-commit pydocstyle pytest Ruff Downloads Stargazers

@Tatsh Mastodon Follow

Locally archive Gmail emails.

Installation

Pip

shell pip install gmail-archiver

Configuration

Create a file at ${CONFIG_DIR}/gmail-archiver/config.toml. On Linux this is typically ~/.config/gmail-archiver/config.toml. The application will print the configuration file path on every run.

The file must contain the following:

toml [tool.gmail-archiver] client_id = 'client-id.apps.googleusercontent.com' client_secret = 'client-secret'

You must set up a project on Google Cloud and it must have the Gmail API enabled.

Then in APIs and services, choose Credentials, + Create credentials and OAuth client ID.

  • Application type: Web application
  • Name: any name

Copy and paste the client ID and secret into the above file.

You should protect the above file. Set it to as limited of a permission set as possible. Example: chmod 0400 ~/.config/gmail-archiver/config.toml.

Why not use Keyring? Keyring is inappropriate for automated scenarios, unless it is purposely made insecure.

Authorisation

When run, if anything is invalid about the OAuth data, you will be prompted to create it.

```plain $ gmail-archiver email@gmail.com Using authorisation database: /home/user/.cache/gmail-archiver/oauth.json Using authorisation file: /home/user/.config/gmail-archiver/config.toml

https://accounts.google.com/o/oauth2/v2/auth?client_id=....

Visit displayed URL to authorize this application. Waiting... ```

In your browser, click Continue and then in the browser you will see the text: Authorisation redirect completed. You may close this window. At that point the archiving will begin.

plain Visit displayed URL to authorize this application. Waiting... 127.0.0.4 - - [17/May/2025 00:50:21] "GET /?code=...&scope=https://mail.google.com/ HTTP/1.1" 200 - INFO: Logging in. INFO: Deleting emails: False INFO: Archiving 200 messages.

Due to the method of authorisation for OAuth, if you need to run this on a server that does not have a fully-featured browser (such as a headless machine), you must run this tool on a machine with one (and the ability to run a localhost server) to get the first access token. Once this is done, transfer configuration and the OAuth authorisation data to the server. From that point, the access token will be refreshed when necessary. You must do this for every email you plan to archive.

The OAuth authorisation file is also printed at startup. Example on Linux: ~/.config/cache/gmail-archiver/oauth.json. It will be stored with mode 0600.

Usage

```shell Usage: gmail-archiver [OPTIONS] EMAIL [OUT_DIR]

Archive Gmail emails and move them to the trash.

Options: --no-delete Do not move emails to trash. -a, --auth-only Only authorise the user. -d, --debug Enable debug level logging. -D, --days INTEGER Archive emails older than this many days. Set to 0 to archive everything. --debug-imap Enable debug level logging for IMAP. -r, --force-refresh Force refresh the token. -h, --help Show this message and exit. ```

Owner

  • Login: Tatsh
  • Kind: user

Citation (CITATION.cff)

authors:
  - family-names: 'Udvare'
    given-names: 'Andrew'
cff-version: '1.2.0'
date-released: '2025-08-30'
message: 'If you use this software, please cite it as below.'
title: 'gmail-archiver'
version: '0.0.4'

GitHub Events

Total
  • Delete event: 8
  • Issue comment event: 10
  • Push event: 22
  • Pull request event: 18
  • Create event: 8
Last Year
  • Delete event: 8
  • Issue comment event: 10
  • Push event: 22
  • Pull request event: 18
  • Create event: 8

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 24
  • Total Committers: 2
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.083
Past Year
  • Commits: 15
  • Committers: 2
  • Avg Commits per committer: 7.5
  • Development Distribution Score (DDS): 0.133
Top Committers
Name Email Commits
Andrew Udvare a****e@g****m 22
dependabot[bot] 4****] 2

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 0
  • Total pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: about 2 hours
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 0
  • Pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: about 2 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (15)
Top Labels
Issue Labels
Pull Request Labels
dependencies (15) javascript (15)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 21 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
pypi.org: gmail-archiver

Locally archive Gmail emails.

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 21 Last month
Rankings
Dependent packages count: 9.1%
Average: 30.3%
Dependent repos count: 51.4%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/codeql.yml actions
  • actions/checkout v4 composite
  • github/codeql-action/analyze v3 composite
  • github/codeql-action/init v3 composite
.github/workflows/qa.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
package.json npm
  • @prettier/plugin-xml ^3.4.1 development
  • cspell ^9.0.2 development
  • markdownlint-cli2 ^0.18.0 development
  • prettier ^3.5.3 development
  • prettier-plugin-ini ^1.3.0 development
  • prettier-plugin-sort-json ^4.1.1 development
  • prettier-plugin-toml ^2.0.5 development
  • pyright ^1.1.401 development
  • yarn-audit-fix ^10.1.1 development
yarn.lock npm
  • 313 dependencies
poetry.lock pypi
  • 117 dependencies
pyproject.toml pypi
  • commitizen ^4.7.0 develop
  • djlint ^1.36.4 develop
  • mypy >=1.12,<1.16 develop
  • ruff ^0.11.9 develop
  • types-requests ^2.32.0.20250306 develop
  • yapf ^0.43.0 develop
  • autodoc-pydantic ^2.2.0 docs
  • doc8 ^1.1.2 docs
  • docutils ^0.21.2 docs
  • enum-tools ^0.12.0 docs
  • esbonio ^0.16.5 docs
  • numpydoc ^1.8.0 docs
  • restructuredtext-lint ^1.4.0 docs
  • sphinx [{"python" => ">=3.11", "version" => "^8.2.0"}, {"python" => "<3.11", "version" => "^7.2.5"}] docs
  • sphinx-click ^6.0.0 docs
  • sphinx-datatables ^0.2.1 docs
  • sphinx-hoverxref ^1.4.2 docs
  • sphinx-immaterial ^0.13.5 docs
  • click ^8.2.0
  • colorlog ^6.9.0
  • platformdirs ^4.3.8
  • python >=3.10,<3.14
  • requests ^2.32.3
  • tomlkit ^0.13.2
  • typing-extensions ^4.13.2
  • coveralls ^4.0.1 tests
  • mock ^5.2.0 tests
  • pytest ^8.3.5 tests
  • pytest-cov ^6.1.1 tests
  • pytest-mock ^3.14.0 tests
  • requests-mock ^1.12.1 tests
tests/pyproject.toml pypi