A CLI tool to fetch Wikipedia articles
Project description
wiki-client
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
- Raw output — Print plain text instead of Rich-formatted output
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
pip install ./wiki
wiki "Unix shell"
Or use the provided install script:
curl -fsSL https://raw.githubusercontent.com/dsillman2000/wiki-client/main/install.sh | sh
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"
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_cli/ 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
- Query resolution — Tries a direct Wikipedia REST API title lookup; falls back to a full-text search if the title returns 404.
- Rendering — Uses Rich to render the article extract as formatted Markdown
in the terminal. Pass
--rawfor plain-text output.
Version
1.0.0
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wiki_client-1.2.2.tar.gz.
File metadata
- Download URL: wiki_client-1.2.2.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdc719feb0597db8579dec252bb72758267788745eba832c92c38dcd96b1d478
|
|
| MD5 |
6db873a91bc1141fe9b80facd33241d6
|
|
| BLAKE2b-256 |
85241985e49e37ba62d781653479498240a9652f6ea41c0ec73d8c6f993373cd
|
Provenance
The following attestation bundles were made for wiki_client-1.2.2.tar.gz:
Publisher:
release.yml on dsillman2000/wiki-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wiki_client-1.2.2.tar.gz -
Subject digest:
fdc719feb0597db8579dec252bb72758267788745eba832c92c38dcd96b1d478 - Sigstore transparency entry: 1155352566
- Sigstore integration time:
-
Permalink:
dsillman2000/wiki-client@f441cb378e1d81599e0918c272b6992bc7b8a2aa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dsillman2000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f441cb378e1d81599e0918c272b6992bc7b8a2aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file wiki_client-1.2.2-py3-none-any.whl.
File metadata
- Download URL: wiki_client-1.2.2-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0e737872d434aea15a761ef0b09922f9027b7cd5ef762ceb028072618c25702
|
|
| MD5 |
9ea0055dbb80edeb85dbea0fafe7cab5
|
|
| BLAKE2b-256 |
a42c0d4ed8362b470253d5ea65582d2c660f2f9267a8540e79952e1ec7ee966e
|
Provenance
The following attestation bundles were made for wiki_client-1.2.2-py3-none-any.whl:
Publisher:
release.yml on dsillman2000/wiki-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wiki_client-1.2.2-py3-none-any.whl -
Subject digest:
b0e737872d434aea15a761ef0b09922f9027b7cd5ef762ceb028072618c25702 - Sigstore transparency entry: 1155352568
- Sigstore integration time:
-
Permalink:
dsillman2000/wiki-client@f441cb378e1d81599e0918c272b6992bc7b8a2aa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dsillman2000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f441cb378e1d81599e0918c272b6992bc7b8a2aa -
Trigger Event:
push
-
Statement type: