Skip to content

Commit 2c4e5ce

Browse files
authored
Merge pull request #2 from andrea-cap/release/0.2.2
release/0.2.2 → master
2 parents f436544 + e495d77 commit 2c4e5ce

20 files changed

Lines changed: 1712 additions & 1387 deletions

.bumpversion.cfg

Lines changed: 0 additions & 16 deletions
This file was deleted.

.editorconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ indent_style = space
88
indent_size = 2
99
end_of_line = lf
1010
charset = utf-8
11-
trim_trailing_whitespace = false
12-
insert_final_newline = false
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
1313

1414
[*.py]
15-
indent_size = 4
15+
indent_size = 4

.github/workflows/python-app.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
41
name: Python application
52

63
on:
@@ -18,23 +15,20 @@ jobs:
1815
fail-fast: false
1916
matrix:
2017
python-version: ["3.9", "3.10", "3.11", "3.12"]
21-
poetry-version: ["latest", "main"]
2218
os: [ubuntu-latest, macos-latest, windows-latest]
2319
runs-on: ${{ matrix.os }}
2420
steps:
2521
- uses: actions/checkout@v4
26-
- uses: actions/setup-python@v5
22+
- uses: actions/setup-python@v6
2723
with:
2824
python-version: ${{ matrix.python-version }}
29-
- name: Install poetry
30-
uses: abatilo/actions-poetry@v2
31-
- uses: actions/cache@v3
32-
name: Define a cache for the virtual environment based on the dependencies lock file
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v9
3327
with:
34-
path: ./.venv
35-
key: venv-${{ hashFiles('poetry.lock') }}
28+
enable-cache: true
3629
- name: Install project dependencies
37-
run: poetry install
30+
run: uv sync --locked
31+
- name: Check formatting and lint
32+
run: uv run ruff check . && uv run ruff format --check .
3833
- name: Run tests
39-
run: poetry run pytest ./tests/
40-
34+
run: uv run pytest ./tests/

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## v0.2.2 (2026-08-10)
4+
5+
### New
6+
7+
* Tests added/improved, added normalization of html parsing. [andrea]
8+
9+
### Changes
10+
11+
* New url for checking api errors. [andrea]
12+
13+
* Updated README. [andrea]
14+
15+
* Improved docstring. [andrea]
16+
17+
* Update rules. [andrea]
18+
19+
* Migration from poetry/black to uv/ruff, removed sphinx, other changes. [andrea]
20+
21+
### Fix
22+
23+
* Restored pystache for changelog. [andrea]
324

425
## v0.2.0 (2024-11-06)
526

README.md

Lines changed: 75 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,99 @@
11
# PyRepec
22

3-
![PyPI - Downloads](https://img.shields.io/pypi/dm/pyrepec)
3+
[![PyPI downloads](https://img.shields.io/pypi/dm/pyrepec)](https://pypi.org/project/pyrepec/)
4+
[![Python versions](https://img.shields.io/pypi/pyversions/pyrepec)](https://pypi.org/project/pyrepec/)
45

6+
PyRepec is a small Python client for the [RePEc API](https://ideas.repec.org/api.html).
7+
It provides typed result models, basic in-session caching, and helpers for querying
8+
authors, publications, bibliographic references, and JEL codes.
59

6-
A python client for [RePEc API](https://ideas.repec.org/api.html).
10+
Current Version: 0.2.2
711

8-
Current Version: 0.2.1
12+
## Requirements
913

10-
Report any bugs by opening an issue here: (https://github.com/TBD)
14+
- Python 3.9 or newer
15+
- A RePEc API token
1116

17+
## Installation
1218

13-
### Usage
19+
Install the package from PyPI:
20+
21+
```bash
22+
pip install pyrepec
23+
```
24+
25+
## Quick start
26+
27+
Keep the API token outside your source code, for example in the
28+
`REPEC_TOKEN` environment variable:
29+
30+
```bash
31+
export REPEC_TOKEN="your-token"
32+
```
33+
34+
Create a client and perform a request:
1435

1536
```python
37+
import os
38+
1639
from pyrepec import Repec
1740

18-
repec = Repec("TOKEN")
41+
repec = Repec(os.environ["REPEC_TOKEN"])
42+
result = repec.get_org_authors("RePEc:edi:bdigvit")
1943

20-
res = repec.get_org_authors("RePEc:edi:bdigvit")
44+
if result.error is not None:
45+
print(f"RePEc error {result.error.code}: {result.error.message}")
46+
else:
47+
for author in result.data:
48+
print(author)
2149
```
2250

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

24-
### Installation
55+
## Available methods
2556

26-
1. Installation using pip:
57+
| Method | Description | Result type |
58+
| --- | --- | --- |
59+
| `get_org_authors(org_id)` | Get the authors associated with an organization. | `RepecResultList` |
60+
| `get_author_data(author_id)` | Get the full record for an author. | `RepecSingleResult` |
61+
| `get_authors_for_item(item_id)` | Get the authors of a paper or article. | `RepecResultList` |
62+
| `get_jel_codes(item_id)` | Get the JEL codes associated with an item. | `RepecJelResult` |
63+
| `get_ref(item_id)` | Get the bibliographic references for an item. | `RepecSingleResult` |
64+
| `get_error(err_code)` | Resolve a RePEc error code into its function and description. | `tuple[str, str]` |
65+
66+
The exact dictionaries returned in `data` follow the upstream RePEc API response
67+
format.
68+
69+
## Development
70+
71+
Clone the repository and install the locked development environment:
2772

2873
```bash
29-
pip install pyrepec
74+
git clone https://github.com/andrea-cap/pyrepec.git
75+
cd pyrepec
76+
uv sync --locked
3077
```
3178

79+
Run the test suite and code-quality checks:
3280

33-
### Methods
81+
```bash
82+
uv run pytest ./tests/
83+
uv run ruff check .
84+
uv run ruff format --check .
85+
```
86+
87+
Integration tests require `REPEC_TOKEN`; without it, they are skipped. Unit tests
88+
do not make external API calls.
89+
90+
Generate the changelog from the available Git history:
91+
92+
```bash
93+
uv run gitchangelog
94+
```
3495

35-
Featured methods:
96+
## Reporting issues
3697

37-
- get_org_authors(org_id: str)
38-
- get_author_data(author_id: str)
39-
- get_authors_for_item(item_id: str)
40-
- get_jel_codes(item_id: str)
41-
- get_error(err_code: int)
42-
- get_ref(item_id: str)
98+
Report bugs and request features through the
99+
[GitHub issue tracker](https://github.com/andrea-cap/pyrepec/issues).

docs/API.rst

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/Makefile

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/conf.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs/index.rst

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/make.bat

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)