Skip to content

Commit

Permalink
Markdown generator for votes (#149)
Browse files Browse the repository at this point in the history
* add to_vote.py and pixi.toml

* add additional files
  • Loading branch information
wolfv authored Jul 2, 2024
1 parent 702278b commit d8be5a5
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pixi environments
.pixi
*.egg-info
211 changes: 211 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
name = "governance"
version = "0.1.0"
description = "Add a short description here"
authors = ["Wolf Vollprecht <w.vollprecht@gmail.com>"]
channels = ["conda-forge"]
platforms = ["osx-arm64"]

[tasks]
vote_markdown = "python to_vote.py"

[dependencies]
python = ">=3.12.4,<3.13"
37 changes: 37 additions & 0 deletions to_vote.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import csv
import io
from pathlib import Path

def csv_to_markdown(csv_data):
# Create a StringIO object to simulate a file
csv_file = io.StringIO(csv_data)

# Read the CSV data
csv_reader = csv.DictReader(csv_file)

# Start the Markdown output
markdown_output = "# GitHub Users Selection List\n\n"

# Process each row
for row in csv_reader:
github_username = row['github_username']
name = row['name']

# Build the Markdown line
line = f"@{github_username} ({name})\n"
line += "- [ ] yes\n"
line += "- [ ] no\n"
line += "- [ ] abstain\n"

markdown_output += line + "\n"

return markdown_output

if __name__ == "__main__":
# Read the CSV file
csv_data = Path("steering.csv").read_text()

# Convert the CSV data to Markdown
markdown_output = csv_to_markdown(csv_data)

print(markdown_output)

0 comments on commit d8be5a5

Please sign in to comment.