Skip to main content

No project description provided

Project description

habits.txt

PyPI version

habits.txt is a plain text habit tracker.

Features | Installation | Concepts | Format | Directives | Examples

Features

  • Track habits in a plain text file
  • Track boolean (done/not done) habits or measurable habits/metrics (e.g. weight)
  • Custom and complex frequencies for habits (daily, on Monday and Friday, on the 1st every month, etc...)
  • Get stats about your habits with the CLI or with charts opening in your browser

Installation

pip install habits.txt

You can then use the CLI with:

hbtxt --help

Alternatively, you can use the executable provided by the latest release.

Concepts

Time-bound

A habit is time-bound. It has a start date, and eventually an end date. It means with habits.txt, you can track habits for a specific period of time. When you want to stop tracking a habit, you can just stop tracking it.

Frequency

A habit is defined by a frequency, else it's called a task. The minimum frequency supported by habits.txt is daily (it doesn't support intra-day habits).

Boolean or Measurable

A habit can be boolean or measurable. A boolean habit is either done or not done. A measurable habit has a value.

Format

Habits are tracked in what I call a "journal" which is just a plain text file. A journal contains "directives".

A directive is composed of a date, a directive type, a habit name, and other metadata specific to the directive type. For example, here is a sample directive:

2024-01-01 track "Read 5 pages a day" (* * *)

You can comment lines in your journal by starting them with a # character. You can't add comments at the end of a line.

# Start tracking a habit
2024-01-01 track "Read 5 pages a day" (* * *)

New in 1.1.0: You can now add custom metadata to your directives. The metadata should be key-value pairs separated by a colon, and should not include spaces.

2024-01-01 track "Read 5 pages a day" (* * *) metadata1:value1 metadata2:value2

Directives

track

To start tracking a habit, you use the track directive and specify the frequency of the habit enclosed in parentheses. Optionally, you can make the habit measurable by specifying the "measurable" keyword.

The frequency follows a simplified cron syntax, omitting the minute and the hour.

Example:

2024-01-01 track "Read 5 pages a day" (* * *)
2024-01-01 track "Exercise" (* * 1,3,5) measurable

untrack

To stop tracking a habit, you use the untrack directive.

Example:

2024-02-01 untrack "Read 5 pages a day"

record

To record a habit, you use the record directive and specify a value.

The allowed values are yes, no, or a number. You should not mix boolean and numeric values for the same habit.

New in 1.1.0: If you add custom metadata to a record directive, be sure to add it before the value, because the value should be the last element of the line.

You can write directives but omit the directive type, it will default to record (as it is supposed to be the most common directive).

Example:

2024-01-01 record "Read 5 pages a day" 5
2024-01-01 record "Workout" yes
2024-01-01 "Weight" 70.5
2024-01-01 record "Meditation" meta:value yes

Examples

habits.journal:

2024-01-01 track "Reading" (* * *)
2024-01-01 track "Exercise" (* * 1,3,5)
2024-01-01 track "Weight" (* * 1) measurable
2024-01-01 track "Meditation" (* * *) meta:value

# Record habits
2024-01-01 record "Reading" yes
2024-01-01 record "Exercise" no
2024-01-01 record "Weight" 70.5
2024-01-01 record "Meditation" place:home yes

Once your journal is ready, you can use the CLI to interact with it.

# Set the journal file as default journal
hbtxt config set journal /path/to/habits.journal

# Fill the habits for today interactively
hbtxt fill -i
Exercise (2024-01-01): yes

# Filter habit records
hbtxt filter -n "Exercise"
2024-01-01 Exercise yes

hbtxt filter -m "place:home"
2024-01-01 Meditation place:home yes

# Get information about the other available commands
hbtxt --help

# Get information about a given command
hbtxt chart --help

# Get information about the available config options
hbtxt config set --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

habits_txt-1.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

habits_txt-1.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file habits_txt-1.1.0.tar.gz.

File metadata

  • Download URL: habits_txt-1.1.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.9.3-arch1-1

File hashes

Hashes for habits_txt-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cbc3c1b702781516a091e266a5eb43abbc9032c29d3c1ee91861c6564baca525
MD5 28d733c68f97103addef093350265a56
BLAKE2b-256 2b77ca02de2c13ff1d69ae39cf4653a40805be66a828af51feb8c73e50990a06

See more details on using hashes here.

File details

Details for the file habits_txt-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: habits_txt-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.9.3-arch1-1

File hashes

Hashes for habits_txt-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0fb6a0a7f1fef4bdda0b31452771bf4bc15a23466d2a52926cc62dcf2d96542
MD5 ec003f89bd401f80950a83efaa0f4a0c
BLAKE2b-256 91ed75bd7f750ab674109c34fb6da22431f499827f08374fbc6c14699e295232

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page