Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions .github/workflows/refresh-profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@ permissions:
jobs:
refresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: requirements.txt

- run: pip install -r requirements.txt

- name: Update README
env:
GITHUB_TOKEN: ${{ github.token }}
run: python scripts/update_readme.py

- name: Collect metrics
env:
GITHUB_TOKEN: ${{ github.token }}
run: python scripts/collect_metrics.py
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- run: uv sync --all-groups

- name: Update README
env:
GITHUB_TOKEN: ${{ github.token }}
run: uv run generate-profile-readme

- name: Collect metrics
env:
GITHUB_TOKEN: ${{ github.token }}
run: uv run python scripts/collect_metrics.py

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__/
*.py[cod]
.pytest_cache/
.ruff_cache/
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-case-conflict
- id: mixed-line-ending
- id: detect-private-key
- id: check-added-large-files
args: ["--maxkb=50"]
exclude: ^uv\.lock$

- repo: local
hooks:
- id: ruff
name: ruff (uv)
entry: uv run ruff check --fix
language: system
types_or: [python, pyi]

- id: ruff-format
name: ruff format (uv)
entry: uv run ruff format
language: system
types_or: [python, pyi]

- id: pytest
name: pytest (uv)
entry: uv run pytest
language: system
types_or: [python, pyi]

- id: basedpyright
name: basedpyright (uv)
entry: uv run basedpyright
language: system
types_or: [python, pyi]
pass_filenames: false
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ This repository hosts the start page when you visit the eclipse-score GitHub org

## Development

You can use e.g. `uv` to create a virtual environment:
Use `uv` to create a virtual environment and install the project dependencies:

```
uv venv && uv pip install -r requirements.txt
uv sync --all-groups
```

And to run the script:
To generate the organization profile README:

```
uv run scripts/update_readme.py
uv run generate-profile-readme
```

The generator reads repository custom properties from GitHub and expects `GITHUB_TOKEN` to be set.
If `GITHUB_TOKEN` is not set, it falls back to `gh auth token`.

To run the local checks:

```sh
uv run pre-commit run --all-files
```
225 changes: 112 additions & 113 deletions profile/README.md

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
[build-system]
requires = ["hatchling>=1.27.0"]
build-backend = "hatchling.build"

[project]
name = "profile-readme-generator"
version = "0.0.0"
description = "Generate the eclipse-score organization profile README from GitHub repository properties"
requires-python = ">=3.12"
dependencies = [
"PyGithub",
]

[project.scripts]
generate-profile-readme = "profile_readme_generator.generator:main"

[dependency-groups]
dev = [
"basedpyright",
"pre-commit",
"pytest",
"ruff",
]

[tool.hatch.build.targets.wheel]
packages = ["src/profile_readme_generator"]

[tool.hatch.build.targets.wheel.force-include]
"src/profile_readme_generator/templates" = "profile_readme_generator/templates"

[tool.uv]
package = true

[tool.ruff]
src = ["src", "tests", "scripts"]
target-version = "py312"
exclude = [
"scripts/collect_metrics.py",
"scripts/update_readme.py",
]

[tool.ruff.lint]
select = [
"E",
"W",
"F",
"I",
"N",
"UP",
"B",
"C4",
"C90",
"SIM",
"TCH",
"TID",
"RUF",
"PT",
"PIE",
"T20",
"RSE",
"RET",
]
ignore = [
"E501",
"T201",
"RET505",
]

[tool.ruff.lint.isort]
known-first-party = ["profile_readme_generator"]
combine-as-imports = true

[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"S101",
]

[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]
addopts = [
"--import-mode=importlib",
"--strict-markers",
"--strict-config",
]

[tool.pyright]
typeCheckingMode = "standard"
reportMissingParameterType = "warning"
reportMissingTypeArgument = "warning"
reportPrivateUsage = "warning"
reportUnknownVariableType = "warning"
reportUnusedVariable = "warning"
include = [
"src",
"scripts",
"tests",
]
exclude = [
"**/__pycache__",
"**/.*",
".venv*/**",
"build",
"dist",
"scripts/collect_metrics.py",
"scripts/update_readme.py",
]
venvPath = "."
venv = ".venv"
Loading
Loading