$npx skillfedfor your agent

pytrec-eval

Provides Python bindings for popular Information Retrieval measures implemented within trec_eval.

With conditionsPyPI GeneralReleased Sep 202096.2K downloads / mopermissive licenseSource build

Decision gist · record as of 2026-08-14

sdist only — pytrec_eval-0.5.tar.gz · builds from source
v0.5 · released 2020-09-07 · Python >=3

Yes, if you need standard IR evaluation metrics in Python and can meet the C++ build requirements. The package is dormant but stable, carries no known vulnerabilities, and wraps a trusted reference implementation. Install only if you're comfortable with a package that hasn't been updated since 2020 and verify compatibility with your Python version before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires a C++ compiler and Python development headers; developed for Python 3.5 and requires Python >= 3.
  • Installation requires a C++ compiler and Python development headers; the package is dormant (last release 2020-09-07, last commit 2023-10-10) but carries no known vulnerabilities and has accumulated 350 repository stars.

License · maintenance · safety

permissive license (permissive) — Licensed under the MIT license (permissive), allowing commercial and private use; note that the underlying trec_eval tool is licensed separately.

last release 2020-09-07 (2167 days) · last repo commit 2023-10-10 · 350 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 96,187 downloads/mo, #13,224 on PyPI

Verify before relying

pip install pytrec_eval

import pytrec_eval

qrel = {'q1': {'d1': 0, 'd2': 1}}
run = {'q1': {'d1': 1.0, 'd2': 0.0}}
evaluator = pytrec_eval.RelevanceEvaluator(qrel, {'map', 'ndcg'})
results = evaluator.evaluate(run)
  • Whether numpy and scipy are runtime dependencies or only build-time requirements (description lists them but fact sheet shows n_runtime: 0).
  • Current compatibility with modern Python versions beyond the 3.5 development baseline.
  • Whether the package is actively maintained or if dormancy signals end-of-life.
Same gist for agents: .md · .json

What it is and what it does

pytrec_eval is a Python wrapper around TREC's trec_eval tool, a standard reference implementation for computing Information Retrieval evaluation metrics. It lets you compute measures like MAP (Mean Average Precision) and NDCG (Normalized Discounted Cumulative Gain) by passing relevance judgments and ranked results as Python dictionaries, then get back computed scores for each query.

The package is designed to eliminate the need for custom metric implementations in Python research code. It wraps the compiled trec_eval engine via C++ bindings, so it inherits the correctness and performance of the reference implementation. Installation requires a C++ compiler and Python development headers; the package has been dormant since 2020 but carries no known security issues.

Use it for

  • Evaluate information retrieval systems in Python research pipelines without reimplementing standard metrics.
  • Compute ranking quality metrics (MAP, NDCG, etc.) for search or recommendation system experiments.
  • Perform statistical significance testing between two ranked result sets using standard IR measures.
  • Validate IR models by scoring ranked results against ground-truth relevance judgments in batch.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need standard IR evaluation metrics in Python and can meet the C++ build requirements.

The package is dormant but stable, carries no known vulnerabilities, and wraps a trusted reference implementation. Install only if you're comfortable with a package that hasn't been updated since 2020 and verify compatibility with your Python version before relying on it in production.

Install

pytrec-eval on PyPI

Before you install

Installation requires a C++ compiler and Python development headers; the package is dormant (last release 2020-09-07, last commit 2023-10-10) but carries no known vulnerabilities and has accumulated 350 repository stars.

Requires a C++ compiler and Python development headers; developed for Python 3.5 and requires Python >= 3.

License in practice

Licensed under the MIT license (permissive), allowing commercial and private use; note that the underlying trec_eval tool is licensed separately.

Quickstart

pip install pytrec_eval

import pytrec_eval

qrel = {'q1': {'d1': 0, 'd2': 1}}
run = {'q1': {'d1': 1.0, 'd2': 0.0}}
evaluator = pytrec_eval.RelevanceEvaluator(qrel, {'map', 'ndcg'})
results = evaluator.evaluate(run)

Verify before relying

  • Whether numpy and scipy are runtime dependencies or only build-time requirements (description lists them but fact sheet shows n_runtime: 0).
  • Current compatibility with modern Python versions beyond the 3.5 development baseline.
  • Whether the package is actively maintained or if dormancy signals end-of-life.

Package facts

Licensepermissive license permissive
Python supportSupports the current Python release >=3
Install frictionHigh. Source build required
Runtime dependenciesNone
MaintenanceDormant 2,167 days since the last release
Last repo commit
First released
Downloads96,187 / month, #13,224 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 3 - AlphaIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxProgramming Language :: C++Programming Language :: PythonTopic :: Text Processing :: General

Evidence: pytrec_eval-0.5.tar.gz

Tags

Capabilities
information retrieval evaluationtrec eval pythonranking metrics computationir evaluation measuresndcg map calculationrelevance judgment scoring
Topics
information-retrievalevaluation-metricsresearch-tool
PyPI keywords
trec_evalinformation retrievalevaluationranking

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “ndcg map calculation”

  • pytrec-evalProvides Python bindings to compute standard Information Retrieval…
  • ir-measuresProvides a unified Python interface to compute standard information…
  • ranxranx computes ranking evaluation metrics (precision, recall, NDCG,…

Give your agent the search over MCP, or paste the wish link into any chat.

More General packages

regex Worth it
PyPI · Python Modules · released Jul 2026

A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.

Apache-2.0 AND CNRI-Pythoncompiled wheel · 3.10+
437.7Mdownloads / mo
docutils With conditions
PyPI · Software Development · released May 2026

Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.

BSD-3-Clausepure Python · 3.9+
225.6Mdownloads / mo
Sphinx Worth it
PyPI · Software Development · released Dec 2025

Sphinx generates professional documentation from reStructuredText source files, producing HTML, PDF, EPUB, and other formats with automatic cross-references, code highlighting, and hierarchical navigation.

BSD-2-Clausepure Python · 3.12+
91.8Mdownloads / mo
lark Worth it
PyPI · Python Modules · released Oct 2025

Lark is a parsing library that builds abstract syntax trees from context-free grammars, supporting multiple parsing algorithms (Earley, LALR(1), CYK) with automatic line and column tracking.

MITpure Python · 3.8+
79.7Mdownloads / mo
nltk Worth it
PyPI · Scientific/Engineering · released Aug 2026

NLTK is a Python library for natural language processing tasks including tokenization, parsing, tagging, and linguistic analysis, with built-in datasets and educational resources.

Install it if you need foundational NLP tools, linguistic datasets, or are learning the field; consider specialized libraries (spaCy, transformers) if you need…

Apache-2.0pure Python · 3.10+
74.1Mdownloads / mo
humanize Worth it
PyPI · Text Processing · released Jun 2026

Converts numbers, dates, times, and file sizes into human-readable text formats, with support for fuzzy durations like "3 minutes ago" and localization to multiple languages.

Install it if you need to display human-readable numbers, durations, or sizes to end users.

MITpure Python · 3.10+
72.4Mdownloads / mo

See also ir-measures · pytrec-eval-terrier · trec-car-tools · ranx · ir-datasets · mir-eval · colbert-ai · py-expression-eval · deepeval · voyageai