Metadata-Version: 2.4
Name: wiclipedia
Version: 0.4.0
Summary: Minimalist Wikipedia CLI client for terminal dwellers.
Author: seto
License-Expression: AGPL-3.0-or-later
Project-URL: Source, https://github.com/seto/wiCLIpedia
Project-URL: Changelog, https://github.com/seto/wiCLIpedia/blob/master/CHANGES.md
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: End Users/Desktop
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Wiki
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

<h1 align="center">wiCLIpedia</h1>

<p align="center">
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-AGPL--3.0+-blue.svg" alt="License: AGPL-3.0-or-later"></a>
  <a href="https://pypi.org/project/wiclipedia/"><img src="https://img.shields.io/pypi/v/wiclipedia.svg?maxAge=86400&color=blue" alt="Version"></a>
  <a href="https://pypi.org/project/wiclipedia"><img src="https://img.shields.io/pypi/pyversions/wiclipedia.svg" alt="Supported Versions"></a>
  <a href="https://github.com/seto/wiCLIpedia/actions"><img src="https://github.com/seto/wiCLIpedia/workflows/CI/badge.svg" alt="CI"></a>
  <a href="https://www.mypy-lang.org/"><img src="https://www.mypy-lang.org/static/mypy_badge.svg" alt="Checked with mypy"></a>
  <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code_style-black-000000.svg" alt="Code Style: Black"></a>
  <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Linting: Ruff"></a>
</p>

This is a minimalist command line interface (CLI) program to fetch and display data from
Wikipedia.

_In an era where Artificial Intelligence answers everything and large language models
shape our knowledge, this program is a small tribute to Wikipedia, the silent,
human-curated backbone that feeds those very models. Never forget the source._

---

<p align="center">
  <img src="https://github.com/user-attachments/assets/51b51758-e340-4d1c-8255-5c784cd8f8c4" width="600" alt="Demo">
</p>

---

## Features

- Fetches and displays article summaries and table of contents
- Navigates article sections interactively
- Opens a section's main article when a dedicated page exists
- Jumps to related pages linked within the article sections
- Handles redirects and disambiguation pages automatically
- Supports multiple Wikipedia languages
- Caches responses locally to minimize API calls
- ANSI colors and styles for enhanced readability (can be disabled)

## Installation

```bash
pip install wiclipedia
```

## Usage

```bash
wicli "Blade Runner"
```

If no page title is provided, the program will prompt you to enter one interactively.

You will be interactively prompted to navigate through the article summary sections.  
To navigate, use the section numbers shown in the table of contents.

If the query matches a disambiguation page, you will be prompted to select the intended
article from a list of options.

When a section opens with a main-article hatnote (e.g. `{{Main}}`, `{{See also}}`), you
are told that a dedicated page exists: enter `0` to open it.

While reading an article, related pages found in list items (e.g. a "See also" section)
are not shown automatically. If any are found, enter `j` to display them, then use `j1`,
`j2`, etc. to jump directly to one of them.

By default, it fetches the English Wikipedia. To specify a different language, use the
`-l` or `--lang` option:

```bash
wicli "La classe operaia va in paradiso" --lang it
```

Available commands during navigation:

- `:b` — Go back to the start prompt
- `:q` — Exit the program
- `:m` — Show the table of contents menu (only available when navigating sections)
- `0` — Open the main article of the current section
- `j` — Show the related pages found in the current section
- `j1`, `j2`, … — Jump to a related page (after entering `j`)

At the start prompt, you can also use:

- `:show-w` — Show the warranty disclaimer
- `:show-c` — Show the redistribution conditions

## Options

| Option         | Description                                          |
| -------------- | ---------------------------------------------------- |
| `page`         | Wikipedia page title (optional, prompted if omitted) |
| `-l`, `--lang` | Language code (default: `en`)                        |
| `--no-cache`   | Disable local cache for the session                  |
| `--purge`      | Purge local cache and exit                           |

## Cache

Responses are cached locally for 72 hours to reduce API calls.  
The cache is stored in `~/.cache/wiclipedia/`.  
Use `--no-cache` to bypass it for a session, or `--purge` to clear it entirely.

## Display

ANSI colors and styles are enabled by default.  
Set the `NO_COLOR` environment variable to disable them (see
[no-color.org](https://no-color.org)).

## API Respect and Fair Use Disclaimer

wiCLIpedia interfaces directly with the official Wikipedia PHP/MediaWiki APIs without
using any third-party scraping libraries.  
Please use this program responsibly. If you need to perform massive automated data
extraction, use official database dumps instead of hammering the live API.

wiCLIpedia caches responses locally for 72 hours by default to minimize API load. Check
the [Cache](#cache) section for details.

More information about the MediaWiki API and usage guidelines:

- [API Documentation](https://www.mediawiki.org/wiki/API:Main_page)
- [API Etiquette](https://www.mediawiki.org/wiki/API:Etiquette)

## License

This program is licensed under the
[GNU Affero General Public License v3.0 or later](https://www.gnu.org/licenses/agpl-3.0.html)
(AGPL-3.0+).  
See the [LICENSE](https://github.com/seto/wiCLIpedia/blob/master/LICENSE) file for
details.

## Changelog

See [CHANGES.md](https://github.com/seto/wiCLIpedia/blob/master/CHANGES.md) for release
notes.
