Skip to main content

ossdoctor

CI PyPI License: MIT

简体中文

A health check for open source repositories. ossdoctor looks for the docs, community files and automation that maintainers rely on, scores the repository from 0 to 100, and generates whatever is missing.

  • Fast and offline. It reads only the working tree, never calls an API and needs no token, so it runs the same locally, in CI and on forks.
  • Fixes, not just findings. ossdoctor fix writes a sensible LICENSE, CONTRIBUTING guide, security policy, issue forms, Dependabot config and more, tailored to the ecosystems it detects. It never overwrites an existing file.
  • Built for CI. Markdown output for job summaries and PR comments, SARIF for GitHub code scanning, JSON for scripts, and --fail-under to keep a score from slipping.
  • Zero dependencies. Pure Python standard library.

ossdoctor reporting a score of 50/100 for a demo repository, with failing checks such as a missing changelog, security policy and a committed .env file

Installation

pipx install ossdoctor      # or: pip install ossdoctor

Python 3.11 or newer is required.

Usage

ossdoctor                       # check the current directory
ossdoctor path/to/repo -v       # explain how to fix each failure
ossdoctor --format markdown     # report as a Markdown table
ossdoctor --format json         # machine-readable output
ossdoctor -f sarif -o ossdoctor.sarif   # SARIF 2.1.0 for code scanning
ossdoctor --fail-under 80       # exit 1 when the score is below 80

ossdoctor fix --dry-run         # show which files would be generated
ossdoctor fix --license Apache-2.0 --email security@example.com --github-user ada

ossdoctor list                  # list every check

fix fills in the project name, year, author and contact address (taken from git config unless you pass --author and --email). Placeholders it cannot fill are reported so you can finish them by hand. Review the generated files before committing: they are starting points, not finished documents.

ossdoctor fix creating ten missing files, after which only the README license section and the committed .env file remain

Anything that needs a human decision, such as a leaked secret or a missing README section, is left for you.

Built-in license templates: MIT, ISC, BSD-2-Clause and BSD-3-Clause. For other licenses, copy the text from choosealicense.com.

GitHub Action

# .github/workflows/ossdoctor.yml
name: ossdoctor
on: [push, pull_request]
permissions:
  contents: read
jobs:
  health:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: jalensuggs77/ossdoctor@v0.2.0
        with:
          fail-under: "80"

The report is added to the job summary and the score is available as steps.<id>.outputs.score.

GitHub code scanning

With sarif-file, the Action also writes a SARIF report. Upload it and every failing check shows up under Security → Code scanning, with the fix explained on the alert and new problems flagged on pull requests:

jobs:
  health:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v7
      - uses: jalensuggs77/ossdoctor@v0.2.0
        with:
          sarif-file: ossdoctor.sarif
      - uses: github/codeql-action/upload-sarif@v4
        if: always()
        with:
          sarif_file: ossdoctor.sarif
          category: ossdoctor

Required checks are reported as errors, recommended ones as warnings and optional ones as notes. Security checks also carry a security-severity, so GitHub ranks them as high, medium or low. Problems with a specific file (a committed .env, a large binary, an incomplete README) are reported on that file. A missing file is reported on the path where it belongs, such as SECURITY.md. Paths are relative to the git repository root, so running ossdoctor on a subdirectory of a monorepo works too.

Checks

Id Level What it looks for
readme required A README with real content
readme-sections recommended Installation, usage and license headings
license required A LICENSE file, identified by SPDX id
changelog recommended CHANGELOG / HISTORY / NEWS, or a fragments directory
contributing recommended CONTRIBUTING guide
code-of-conduct recommended CODE_OF_CONDUCT
issue-templates recommended Issue templates or forms
pr-template optional Pull request template
codeowners optional CODEOWNERS
ci required GitHub Actions, GitLab CI, CircleCI, Jenkins, Buildkite and others
tests required Test files or directories in common layouts
security-policy recommended SECURITY policy for private vulnerability reports
dependency-updates recommended Dependabot or Renovate configuration
lockfile recommended Committed lockfiles for npm and Go
no-secret-files required No .env, private keys or keystores in the repository
gitignore recommended .gitignore
editorconfig optional .editorconfig
no-large-files recommended No files over the size limit (5 MB by default)

Community files are found in the root, .github/ or docs/, the same places GitHub looks. In a git checkout, files ignored by .gitignore are not checked. Because ossdoctor works offline, it cannot see default community files that an organization keeps in its own .github repository. If you rely on those, disable the corresponding checks. A package-lock=false line in .npmrc is treated as a deliberate choice not to commit an npm lockfile.

Scoring. Required checks weigh 3, recommended 2 and optional 1. The score is the weighted share of applicable checks that pass. Skipped checks don't count.

Configuration

Add a [tool.ossdoctor] table to pyproject.toml, or create .ossdoctor.toml with the same keys at the top level:

[tool.ossdoctor]
disable = ["codeowners", "editorconfig"]   # check ids to skip
fail-under = 80                            # default for --fail-under
large-file-mb = 10                         # limit for no-large-files
ignore-paths = ["tests/fixtures/*"]        # globs excluded from file scans

Exit codes

Code Meaning
0 Success
1 Score below fail-under
2 Usage or configuration error

Roadmap

  • Checks for release hygiene (tags, signed releases) and branch protection, using an optional token
  • More license templates and templates in other languages
  • Package manager metadata checks (repository URL, license field, keywords)

Ideas and pull requests are welcome. See CONTRIBUTING.md.

License

MIT

Metadata

Release files for ossdoctor 0.2.0

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

Source distribution (sdist)

Source distribution for ossdoctor 0.2.0
File Size Uploaded Provenance
ossdoctor-0.2.0.tar.gz 41.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 70.7 kB

Release files / ossdoctor-0.2.0.tar.gz

Download URL ossdoctor-0.2.0.tar.gz
Size 41.4 kB
Tags Source
SHA-256 checksum
How to use checksums
36e24492b71c46abee9d41918a02a58a6f20db8006cdbcb288929b998743bf8c
BLAKE2b-256 checksum
How to use checksums
eea01ec4a90cf4197ddfba5a8854b1bb573eff5af1e2f3f76a37208823285504
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / ossdoctor-0.2.0-py3-none-any.whl

Download URL ossdoctor-0.2.0-py3-none-any.whl
Size 29.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b91bcd12d3983cf00a574a5309280de54315603cb54052acd8d0e32fc5d0cf7d
BLAKE2b-256 checksum
How to use checksums
d5ef7136fa75d117f852778a95d28954a4a8db3da6751c03d8032bb84794385b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for ossdoctor 0.2.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ossdoctor-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

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.

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