A Python package to check whether papers in your .bib file or a specific bibtex entry have been listed on Retraction Watch.
- Parse .bib files and extract paper information
- Query the Retraction Watch dataset for retracted papers
- Support both exact DOI matching and fuzzy title matching
- Robust error handling for various edge cases
# Install from PyPI (when published)
pip install retraction-check
# Or install from source
git clone https://github.com/codingfabi/retraction_check.git
cd retraction_check
pipenv install
# Install development dependencies
pipenv install --dev# Using the installed command
retraction-check yourfile.bib
# Or using the module
python -m retraction_check.check_bib yourfile.bib# Run all tests
pipenv run test
# Run tests with coverage
pipenv run test-cov
# Run tests in watch mode
pipenv run test-watch
# Run tests directly with Python
python tests/run_tests.py# Format code
pipenv run format
# Lint code
pipenv run lint
# Type checking
pipenv run type-check
# Run all checks
pipenv run check-alltest- Run all tests with verbose outputtest-cov- Run tests with coverage report (HTML and terminal)test-watch- Run tests in watch mode with short tracebacklint- Run flake8 lintingformat- Format code with blackformat-check- Check if code is properly formattedtype-check- Run mypy type checkingcheck-all- Run all quality checks (format, lint, type-check, test-cov)
- Python 3.8+
- bibtexparser
- requests
You can automate retraction checks for your bibliography file using GitHub Actions. The following workflow runs the check on demand, on a schedule, or on every commit to a specific branch. If any retractions are found, it will open a GitHub issue listing the findings.
name: Retraction Check
on:
workflow_dispatch: # Allows manual trigger
schedule:
- cron: '0 8 * * 1' # Runs every Monday at 08:00 UTC
push:
paths:
- yourfile.bib # Change this to your personal bib file to make sure the workflow runs every time the bibfile changes
jobs:
retraction_check:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Run retraction check
id: retraction
run: |
python -m retraction_check.check_bib path/to/your/bibfileyourfile.bib > findings.txt
grep -v "No retracted papers found." findings.txt > findings_only.txt || true
- name: Create issue if retractions found
if: success() && hashFiles('findings_only.txt') != ''
uses: peter-evans/create-issue-from-file@v5
with:
title: "Retraction Watch: Retracted Papers Detected in Bibliography"
content-filepath: findings_only.txt
labels: retraction, automated-check- Replace
yourfile.bibwith the path to your bibliography file. - The workflow will create an issue only if retractions are found.
- You can trigger the workflow manually, on a schedule, or on every commit to the specified branch.
You can also automate retraction checks for your bibliography file using GitLab CI/CD. The following example runs the check on every push to the default branch and creates an issue if retractions are found (requires a GitLab personal access token with API scope stored as GITLAB_TOKEN).
retraction_check:
image: python:3.11
stage: test
script:
- pip install .
- python -m retraction_check.check_bib path/to/yourfile.bib > findings.txt
- grep -v "No retracted papers found." findings.txt > findings_only.txt || true
# Only create an issue if findings_only.txt is not empty
- |
if [ -s findings_only.txt ]; then
curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"title": "Retraction Watch: Retracted Papers Detected in Bibliography",
"description": "$(cat findings_only.txt)",
"labels": "retraction, automated-check"
}' \
--request POST "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/issues"
fi
only:
- main # or your default branch
rules:
- changes:
- path/to/yourfile.bib- Replace
path/to/yourfile.bibwith the path to your bibliography file. - Store a GitLab personal access token with API scope as a CI/CD variable named
GITLAB_TOKEN. - The job will create an issue only if retractions are found and the
.bibfile changes.