Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 59 additions & 29 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,69 @@
name: Python package

on: [push]
on:
push:
branches: [master, main, revival-poc]
pull_request:
branches: [master, main]

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --dev
- name: Lint with ruff
run: |
uv run ruff check src tests
uv run ruff format --check src tests

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, pypy-3.8, 3.10.0, '3.11.0-alpha.3']
os: [
ubuntu-latest,
macOS-latest,
windows-latest,
]
python-version: ['3.12', '3.13', '3.14']
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
# Python 3.14 is in development, exclude on Windows for now
- os: windows-latest
python-version: '3.14'

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --dev

- name: Run tests
run: uv run pytest tests/ -v

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -r requirements_dev.txt
python setup.py install
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python setup.py test
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --dev
- name: Type check with mypy
run: uv run mypy src --ignore-missing-imports
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
253 changes: 202 additions & 51 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,74 +1,225 @@
=========
google_cl
GoogleCL
=========


.. image:: https://img.shields.io/pypi/v/google_cl.svg
:target: https://pypi.python.org/pypi/google_cl

.. image:: https://img.shields.io/travis/vinitkumar/google_cl.svg
:target: https://travis-ci.org/vinitkumar/google_cl
.. image:: https://img.shields.io/pypi/pyversions/google_cl.svg
:target: https://pypi.python.org/pypi/google_cl

.. image:: https://readthedocs.org/projects/google-cl/badge/?version=latest
:target: https://google-cl.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

**Command-line interface for Google services - Gmail, Drive, and Calendar**

.. image:: https://pyup.io/repos/github/vinitkumar/google_cl/shield.svg
:target: https://pyup.io/repos/github/vinitkumar/google_cl/
:alt: Updates



Pythonic interface to interact with google services

GoogleCL provides a modern, intuitive command-line interface to interact with Google services. Manage your emails, files, and calendar events directly from your terminal.

* Free software: Apache Software License 2.0
* Documentation: https://google-cl.readthedocs.io.

* Documentation: https://google-cl.readthedocs.io

Features
+++++++

* TODO

Contributors
+++++++

Code Contributors
------------------

This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
.. image:: https://opencollective.com/googlecl/contributors.svg?width=890&button=false

Financial Contributors
------------------

Become a financial contributor and help us sustain our community. Contribute_

Individuals
~~~~~~~~~~~~~~~~~~~~~~

.. image:: https://opencollective.com/googlecl/individuals.svg?width=890
:target: https://opencollective.com/googlecl

Organizations
~~~~~~~~~~~~~~~~~~~~~~

Support this project with your organization. Your logo will show up here with a link to your website. Contribute_

.. image:: https://opencollective.com/googlecl/organization/0/avatar.svg
:target: https://opencollective.com/googlecl/organization/0/website

.. _Contribute: https://opencollective.com/googlecl

* TODO
--------

📧 **Gmail**
- List and read emails from your inbox
- Send emails with plain text or HTML
- Search emails using Gmail query syntax
- Manage labels

📁 **Google Drive**
- List and search files
- Upload and download files
- Create folders
- Check storage quota
- Delete files (trash or permanent)

📅 **Google Calendar**
- View today's events
- List upcoming events
- Create new events
- Quick add events using natural language
- Manage multiple calendars

Installation
------------

Using `uv` (recommended)::

uv pip install googlecl

Using pip::

pip install googlecl

From source::

git clone https://github.com/vinitkumar/googlecl.git
cd googlecl
uv pip install -e .

Quick Start
-----------

1. **Set up Google Cloud credentials**:

- Go to https://console.cloud.google.com/
- Create a new project or select an existing one
- Enable the Gmail, Drive, and Calendar APIs
- Go to APIs & Services > Credentials
- Create an OAuth 2.0 Client ID (Desktop application)
- Download the JSON file

2. **Configure GoogleCL**::

# Show configuration paths
googlecl auth info

# Copy your credentials.json to the config directory
mkdir -p ~/.config/googlecl
cp ~/Downloads/credentials.json ~/.config/googlecl/

3. **Authenticate**::

googlecl auth login

4. **Start using GoogleCL**::

# Check your inbox
googlecl gmail inbox

# List Drive files
googlecl drive list

# Show today's calendar events
googlecl calendar today

Usage Examples
--------------

**Gmail**::

# List 10 emails from inbox
googlecl gmail inbox -n 10

# Show only unread emails
googlecl gmail inbox --unread

# Read a specific email
googlecl gmail read MESSAGE_ID

# Send an email
googlecl gmail send --to user@example.com --subject "Hello" --body "Hi there!"

# Search emails
googlecl gmail search "from:boss@company.com is:unread"

# List all labels
googlecl gmail labels

**Google Drive**::

# List files
googlecl drive list

# Search for files
googlecl drive search "report"

# Upload a file
googlecl drive upload myfile.pdf

# Download a file
googlecl drive download FILE_ID -o ~/Downloads/

# Create a folder
googlecl drive mkdir "New Folder"

# Check storage quota
googlecl drive quota

**Google Calendar**::

# Show today's events
googlecl calendar today

# Show upcoming events (next 7 days)
googlecl calendar upcoming

# Show next 30 days
googlecl calendar upcoming --days 30

# Create an event
googlecl calendar add "Team Meeting" --start "2024-01-15 10:00" --end "2024-01-15 11:00"

# Quick add (natural language)
googlecl calendar quick "Lunch with John tomorrow at noon"

# List all calendars
googlecl calendar calendars

Authentication
--------------

GoogleCL uses OAuth 2.0 for authentication. Your credentials are stored locally at:

- **Credentials file**: ``~/.config/googlecl/credentials.json``
- **Token file**: ``~/.config/googlecl/token.json``

Commands::

# Check authentication status
googlecl auth status

# Login (authenticate)
googlecl auth login

# Force re-authentication
googlecl auth login --force

# Logout (remove tokens)
googlecl auth logout

# Show configuration info
googlecl auth info

Development
-----------

Clone the repository::

git clone https://github.com/vinitkumar/googlecl.git
cd googlecl

Set up development environment::

uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"

Run tests::

pytest

Run linting::

ruff check src tests
mypy src

Contributing
------------

Contributions are welcome! Please read `CONTRIBUTING.rst` for guidelines.

License
-------

This project is licensed under the Apache License 2.0 - see the `LICENSE` file for details.

Credits
++++++++
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage

Loading
Loading