Skip to main content

Analyze Git commit activity by hour with member mapping and configurable outputs.

Project description

NightOwls

Tests Package Check Publish PyPI version PyPI - Downloads License: MIT

NightOwls is a Python CLI for analyzing Git commit activity by hour of day.

It supports:

  • JSON analysis output
  • stacked bar chart PNG output (x: hour, y: commit count, stacked by member)
  • resolved config output
  • bootstrapped members map output

Install

python -m pip install .

For development:

python -m pip install -r requirements.txt

Run

PYTHONPATH=src python -m nightowls --help

Or after install:

nightowls --help

Configuration Sources And Precedence

NightOwls merges configuration in this order:

  1. CLI options
  2. -c /path/to/config.json
  3. nightowls.json in repository root
  4. internal defaults

JSON Schema

Schema file in repo:

  • src/nightowls/schemas/nightowls.schema.json

Raw URL (for $schema):

  • https://raw.githubusercontent.com/5cover/nightowls/main/src/nightowls/schemas/nightowls.schema.json

Example header in nightowls.json:

{
  "$schema": "https://raw.githubusercontent.com/5cover/nightowls/main/src/nightowls/schemas/nightowls.schema.json"
}

nightowls.json Format

{
  "$schema": "https://raw.githubusercontent.com/5cover/nightowls/main/src/nightowls/schemas/nightowls.schema.json",
  "timezone": "local",
  "identity_source": "author",
  "member_sort": "commit_count",
  "output": {
    "format": "json",
    "path": null
  },
  "chart": {
    "title": null
  },
  "filters": {
    "since": null,
    "until": null,
    "branch": null,
    "no_merges": false
  },
  "members": [
    ["Raphael", { "name": "Scover", "email": "thediscover22450@gmail.com" }],
    ["Romain", { "name": "Soladoc" }],
    ["Noreply", { "email": { "regex": "@users\\.noreply\\.github\\.com$" } }],
    ["Unknown", {}]
  ]
}

Members Mapping Semantics

members is an ordered list of pairs:

[member_name, matcher]

Rules:

  • first match wins
  • matcher.name and matcher.email are optional
  • missing or null means wildcard for that field
  • string value means exact match
  • { "regex": "..." } means regex match
  • if nothing matches, NightOwls falls back to the git actor name

Member Ordering

member_sort controls member order in JSON output and chart stacking/color assignment.

  • "commit_count" (default): descending by total commit count, then alphabetical
  • "alphabetical": ascending by member name
  • ["name1", "name2", ...]: custom order; members not listed are appended alphabetically

Chart Title Behavior

  • If chart.title (or --chart-title) is set, it is used.
  • Otherwise title is Commits by hour (stacked by member) - {repo name} when repo name is available.
  • Final fallback is Commits by hour (stacked by member).

CLI Options

nightowls [path]
  -c, --config PATH
  --timezone {local,utc}
  --output-format {json,png,config,members}
  --output-path PATH
  --chart-title TEXT
  --identity-source {author,committer}
  --since EXPR
  --until EXPR
  --branch REV
  --no-merges

Examples

JSON output:

nightowls . --output-format json

PNG output:

nightowls . --output-format png --output-path out.png

PNG output with custom title:

nightowls . --output-format png --chart-title "Night activity overview"

Resolved config output:

nightowls . --output-format config

Bootstrap members map:

nightowls . --output-format members > members.json

Use custom config:

nightowls . -c ./nightowls.json --output-format json

Build

python -m build

Publish To PyPI

  • The Publish workflow runs on tags matching v* (for example v1.0.1).
  • Configure PyPI Trusted Publishing for this repository, then create and push a version tag:
git tag v1.0.1
git push origin v1.0.1

Test

PYTHONPATH=src python -m unittest discover -s tests -p 'test_*.py'

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

nightowls-1.0.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nightowls-1.0.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file nightowls-1.0.0.tar.gz.

File metadata

  • Download URL: nightowls-1.0.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nightowls-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7f53276a69988a903ad3e65cbf6acb27f15da9661c39eed05f353303ea953b8a
MD5 7bcc4d1e6ee2bdd90fc416a72bbc36e4
BLAKE2b-256 1efe47953093360f807ae0e876036884e6292908e51168e0fdf544027fcabdbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for nightowls-1.0.0.tar.gz:

Publisher: publish.yml on 5cover/nightowls

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nightowls-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nightowls-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nightowls-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6aac425129510c0a8049a9fbc5d1e9866addb83335d80719e3de56ee8a192f93
MD5 bdf7b081abc99eb477f2ecc832d1ab47
BLAKE2b-256 5ecf3a8a6f5232699bc0db3abbd446620b23d29c3e0290e684c062ec2ef11958

See more details on using hashes here.

Provenance

The following attestation bundles were made for nightowls-1.0.0-py3-none-any.whl:

Publisher: publish.yml on 5cover/nightowls

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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