wakatime / legacy-python-cli

Command line interface used by all WakaTime text editor plugins.
https://wakatime.com/
BSD 3-Clause "New" or "Revised" License
1.02k stars 84 forks source link
analytics developer-tools metrics productivity quantified-self time-tracker time-tracking

.. image:: https://travis-ci.org/wakatime/wakatime.svg :target: https://travis-ci.org/wakatime/wakatime :alt: Tests

.. image:: https://ci.appveyor.com/api/projects/status/g9snpluqi8svrgbn/branch/master?svg=true :target: https://ci.appveyor.com/project/alanhamlett/wakatime-jl10s/branch/master :alt: Windows Tests

.. image:: https://coveralls.io/repos/wakatime/wakatime/badge.svg?branch=master&service=github :target: https://coveralls.io/github/wakatime/wakatime?branch=master :alt: Coverage

.. image:: https://img.shields.io/pypi/v/wakatime.svg :target: https://pypi.python.org/pypi/wakatime :alt: Version

.. image:: https://img.shields.io/pypi/pyversions/wakatime.svg :target: https://pypi.python.org/pypi/wakatime :alt: Supported Python Versions

.. image:: https://wakatime.com/badge/github/wakatime/wakatime.svg?branch=master :target: https://wakatime.com/ :alt: Code time tracker

WakaTime

This repo is deprecated. Use the Go version of wakatime-cli <https://github.com/wakatime/wakatime-cli>_ instead.

Command line interface to WakaTime <https://wakatime.com/> used by all WakaTime text editor plugins <https://wakatime.com/editors>.

Go to http://wakatime.com/editors to install the plugin for your text editor or IDE.

Installation

Note: You shouldn't need to directly use this package unless you are building your own plugin <https://wakatime.com/help/misc/creating-plugin>_ or your text editor's plugin asks you to install the WakaTime CLI manually.

Each plugin <https://wakatime.com/editors> installs the WakaTime CLI for you, except for the Emacs WakaTime plugin <https://github.com/wakatime/wakatime-mode>.

Install the plugin for your IDE/editor:

https://wakatime.com/editors

Each plugin either comes pre-bundled with WakaTime CLI, or downloads the latest version from GitHub for you.

Usage

If you are building a plugin using the WakaTime API <https://wakatime.com/developers/> then follow the Creating a Plugin <https://wakatime.com/help/misc/creating-plugin> guide.

For command line options, run wakatime --help.

Some more usage information is available in the FAQ <https://wakatime.com/faq>_.

Configuring

Options can be passed via command line, or set in the $WAKATIME_HOME/.wakatime.cfg config file. Command line arguments take precedence over config file settings. The $WAKATIME_HOME/.wakatime.cfg file is in INI <http://en.wikipedia.org/wiki/INI_file>_ format. An example config file with all available options::

[settings]
debug = false
api_key = your-api-key
hide_file_names = false
hide_project_names = false
hide_branch_names =
exclude =
    ^COMMIT_EDITMSG$
    ^TAG_EDITMSG$
    ^/var/(?!www/).*
    ^/etc/
include =
    .*
include_only_with_project_file = false
status_bar_icon = true
status_bar_coding_activity = true
offline = true
proxy = https://user:pass@localhost:8080
no_ssl_verify = false
ssl_certs_file =
timeout = 30
hostname = machinename
[projectmap]
projects/foo = new project name
^/home/user/projects/bar(\d+)/ = project{0}
[git]
disable_submodules = false

For commonly used configuration options, see examples in the FAQ <https://wakatime.com/faq>_.

Troubleshooting

Read How to debug the plugins <https://wakatime.com/faq#debug-plugins>_.

Make sure to set debug=true in your ~/.wakatime.cfg file.

Common log file location in your User $WAKATIME_HOME directory::

~/.wakatime.log

Each plugin also has its own log file:

Useful API Endpoints:

Useful Resources:

Contributing

To install the dev environment::

virtualenv venv
. venv/bin/activate
pip install -r dev-requirements.txt
pip install tox

Before contributing a pull request, make sure tests pass::

tox

The above will run tests on all Python versions available on your machine. To just run all tests with your current Python version::

nosetests

To run only a single test method, specify the test file location, test class, and test method. For example, to only run the Git project detection test::

nosetests tests.test_project:ProjectTestCase.test_git_project_detected

Many thanks to all contributors <https://github.com/wakatime/wakatime/blob/master/AUTHORS>_!