Skip to main content

wiki-client

PyPI Version Python Versions

A command-line tool to fetch Wikipedia articles and display them in the terminal.

Overview

wiki is a Python CLI that retrieves Wikipedia articles via the Wikipedia REST API and renders them with Rich for a beautiful terminal experience.

Features

  • Fetch articles — Query Wikipedia by article title or search query
  • Search mode — Show a ranked list of search results
  • Featured articles — Fetch Wikipedia's daily featured article
  • Random articles — Fetch random Wikipedia articles
  • Most-read articles — Fetch Wikipedia's most-read articles for yesterday
  • Daily news — Fetch Wikipedia's "In the news" stories
  • Raw output — Print plain text instead of Rich-formatted output
  • AI Agent Skills — Ready-to-use skill files for OpenCode, Copilot, Claude, Codex, Windsurf, Aider, and Cursor

Requirements

  • Python 3.10 or newer

The following Python packages are installed automatically:

Package Purpose
click CLI argument parsing
httpx HTTP requests to the Wikipedia API
rich Terminal formatting and rendering

Installation

Recommended: uvx (no permanent install required)

The easiest way to run wiki is with uvx from the uv toolkit. This downloads and runs the tool in an isolated environment without permanently installing it:

uvx --from wiki-client wiki "Unix shell"

Install uv (if you haven't already):

curl -LsSf https://astral.sh/uv/install.sh | sh

pip install (permanent install)

Installing via pip places the wiki command on your $PATH directly:

pip install wiki-client
wiki "Unix shell"

Install from source

git clone https://github.com/dsillman2000/wiki-client.git
cd wiki-client
pip install .
wiki "Unix shell"

Or use the provided install script:

curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install.sh | bash

Install AI Agent Skills

The wiki CLI includes skill files for various AI agents. Install them directly from GitHub without cloning the repository:

Remote Installation (Recommended)

Use the unified installer script with the -a flag to specify the agent:

OpenCode
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | bash -s -- -a opencode
GitHub Copilot
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | bash -s -- -a copilot
Claude
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | bash -s -- -a claude
Codex
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | bash -s -- -a codex
Windsurf
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | bash -s -- -a windsurf
Aider
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | bash -s -- -a aider
Cursor
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | bash -s -- -a cursor

Install for Windsurf (Codeium)

curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | sh -s -- -a windsurf

Install for Aider

curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | sh -s -- -a aider

Install for Cursor

curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install/skill.sh | sh -s -- -a cursor


#### Local Installation

If you have cloned the repository, you can install locally:

```bash
# Install for OpenCode
./install/skill.sh -a opencode

# Install for GitHub Copilot
./install/skill.sh -a copilot

# Install for Claude
./install/skill.sh -a claude

# Install for Codex
./install/skill.sh -a codex

# Install for Windsurf (Codeium)
./install/skill.sh -a windsurf

# Install for Aider
./install/skill.sh -a aider

# Install for Cursor
./install/skill.sh -a cursor

Show help:

./install/skill.sh -h

Docker

A Docker image is available on GitHub Container Registry (GHCR) with all dependencies pre-installed:

# Pull the image
docker pull ghcr.io/dsillman2000/wiki-client:latest

# Run a query
docker run --rm ghcr.io/dsillman2000/wiki-client:latest "Unix shell"

# Extract specific section
docker run --rm ghcr.io/dsillman2000/wiki-client:latest -s History "Bash"

# List sections
docker run --rm ghcr.io/dsillman2000/wiki-client:latest --ls "Python"

# Save output to file (mount current directory)
docker run --rm -v "$(pwd)":/home/wiki ghcr.io/dsillman2000/wiki-client:latest \
  "Operating system" -o os.md

Advantages:

  • No local dependency installation required
  • Consistent environment across systems
  • Easy integration into CI/CD pipelines
  • Lightweight multi-stage build (~218MB)

Usage

Basic Queries

# Fetch an article
wiki "Unix shell"

# Print plain text (no Rich formatting)
wiki "Unix shell" --raw

Search Mode

# Show search results instead of auto-fetching
wiki --search "shell programming"

Section Listing & Filtering

# List all sections in an article
wiki --list-sections "Unix shell"
wiki --ls "Unix shell"          # shorthand

# Extract a specific section (fuzzy match)
wiki -s History "Unix shell"
wiki -s "early" "Unix shell"    # matches "Early shells", "Early history", etc.

# Multiple sections
wiki -s History -s "See also" "Unix shell"

Featured & Random Articles

# Fetch today's featured Wikipedia article
wiki --featured

# Extract specific section from featured article
wiki --featured -s "Early life"

# Fetch featured article for specific date
wiki --featured --featured-date 2025-03-23
wiki --featured-date 2025-03-23  # --featured-date implies --featured

# Extract section from specific date's featured article
wiki --featured-date 2025-03-23 -s "Storyline"

# List sections of featured article
wiki --featured --ls

# Fetch a random Wikipedia article
wiki --random

# Save random article to file
wiki --random -o random_article.md

Most-Read & News

# Fetch yesterday's most-read Wikipedia articles
wiki --most-read

# Extract specific article from most-read list
wiki --most-read -s "Eiffel Tower"

# Fetch most-read articles for specific date
wiki --most-read --most-read-date 2026-03-23
wiki --most-read-date 2026-03-23  # --most-read-date implies --most-read

# List most-read articles (compact view)
wiki --most-read --ls

# Save most-read to file
wiki --most-read -o most_read.md

# Fetch today's "In the news" stories
wiki --news
wiki --news --raw
wiki --news -o news.md
wiki --news --ls

Version

wiki --version

Examples

# Get the Unix shell article
wiki "Unix shell"

# Search for shell-related articles
wiki --search "shell interpreters"

# Print raw text
wiki "Bash (Unix shell)" --raw

# List all sections
wiki --ls "Unix shell"

# Read the History section
wiki -s History "Unix shell"

Development

Quick Start

# Install in editable mode with dev dependencies
pip install -e .
pip install pytest pytest-httpx ruff

# Or use Make
make install-dev

Linting & Testing

make lint       # ruff + shellcheck + prettier
make lint-python  # ruff only
make test       # pytest

Or run directly:

ruff check wiki_client/ tests/
python -m pytest tests/ -v

Available Make Targets

make help           # Show all targets
make install        # pip install -e .
make install-dev    # Install dev dependencies
make lint           # Run all linting checks
make lint-python    # ruff
make lint-shell     # shellcheck
make lint-markdown  # prettier
make test           # pytest
make format         # prettier --write README.md
make clean          # Remove build artifacts

How It Works

  1. Query resolution — Tries a direct Wikipedia REST API title lookup; falls back to a full-text search if the title returns 404.
  2. Rendering — Uses Rich to render the article extract as formatted Markdown in the terminal. Pass --raw for plain-text output.

Version

1.0.0

License

MIT

Release files for wiki-client 1.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wiki-client 1.8.3
File Size Uploaded
wiki_client-1.8.3.tar.gz 39.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wiki-client 1.8.3
File Interpreter ABI Platform
wiki_client-1.8.3-py3-none-any.whl Python 3 none any Details

Total release size:58.1 kB

Release files / wiki_client-1.8.3.tar.gz

Download URL wiki_client-1.8.3.tar.gz
Size 39.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d533ea26ebab91830b0e6f20a5ebcb191d631a97ea34c35dc557b9d257d5c07d
BLAKE2b-256 checksum
How to use checksums
5cccddaf32dbb1a0043146ba182d8378f9d934aa72b1b9b5df531533d2bada20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

Release files / wiki_client-1.8.3-py3-none-any.whl

Download URL wiki_client-1.8.3-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5ebf32a42f7bb9eb514a8fcf4a994bfc50cdad2d731ebd63cada8c0d5e7af2f
BLAKE2b-256 checksum
How to use checksums
9401c3f6bfae5b997e435c9531b4e5ccd19dc0fefc193eef1e02d3bd908dc489
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.8.3 This release

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.2.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page