Skip to main content

PyRepec

PyPI downloads Python versions

PyRepec is a small Python client for the RePEc API. It provides typed result models, basic in-session caching, and helpers for querying authors, publications, bibliographic references, and JEL codes.

Current Version: 0.2.4

Requirements

  • Python 3.9 or newer
  • A RePEc API token

Installation

Install the package from PyPI:

pip install pyrepec

Quick start

Keep the API token outside your source code, for example in the REPEC_TOKEN environment variable:

export REPEC_TOKEN="your-token"

Create a client and perform a request:

import os

from pyrepec import Repec

repec = Repec(os.environ["REPEC_TOKEN"])
result = repec.get_org_authors("RePEc:edi:bdigvit")

if result.error is not None:
    print(f"RePEc error {result.error.code}: {result.error.message}")
else:
    for author in result.data:
        print(author)

Successful responses expose their payload through result.data. Errors reported by RePEc are available through result.error; in that case, result.data is empty. HTTP errors are raised by requests in the usual way.

Available methods

Method Description Result type
get_org_authors(org_id) Get the authors associated with an organization. RepecResultList
get_author_data(author_id) Get the full record for an author. RepecSingleResult
get_authors_for_item(item_id) Get the authors of a paper or article. RepecResultList
get_jel_codes(item_id) Get the JEL codes associated with an item. RepecJelResult
get_ref(item_id) Get the bibliographic references for an item. RepecSingleResult
get_error(err_code) Resolve a RePEc error code into its function and description. tuple[str, str]

The exact dictionaries returned in data follow the upstream RePEc API response format.

Development

Clone the repository and install the locked development environment:

git clone https://github.com/andrea-cap/pyrepec.git
cd pyrepec
uv sync --locked

Run the test suite and code-quality checks:

uv run pytest ./tests/
uv run ruff check .
uv run ruff format --check .

Integration tests require REPEC_TOKEN; without it, they are skipped. Unit tests do not make external API calls.

Generate the changelog from the available Git history:

uv run gitchangelog

Reporting issues

Report bugs and request features through the GitHub issue tracker.

Metadata

Release files for pyrepec 0.2.4

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

Source distribution (sdist)

Source distribution for pyrepec 0.2.4
File Size Uploaded Provenance Actions
pyrepec-0.2.4.tar.gz 8.3 kB Without provenance Details for pyrepec-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyrepec 0.2.4
File Interpreter ABI Platform Actions
pyrepec-0.2.4-py3-none-any.whl Python 3 none any Details for pyrepec-0.2.4-py3-none-any.whl

Total release size: 14.9 kB

Release files / pyrepec-0.2.4.tar.gz

Download URL pyrepec-0.2.4.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fc0d470df0a2bc6df6cb34224d4e158a5d68c1410d011109b420e1560c0fd6b3
BLAKE2b-256 checksum
How to use checksums
c4f622dc23ddd59cf28a77c2c851e6738966f3d388a850f276d5eebbe91567b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pyrepec-0.2.4-py3-none-any.whl

Download URL pyrepec-0.2.4-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a256cc5840e7304a33fab4fc6d4b3300b6fd8fd0bb95dabac0bd1b272ec93299
BLAKE2b-256 checksum
How to use checksums
be34c8b49c77bb4012d89b23ecfadba1c09f6f02c53de5bfd27fc259104cde36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pyrepec 0.2.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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