mirror of
https://github.com/MunGell/awesome-for-beginners.git
synced 2026-01-24 04:19:06 -08:00
Compare commits
8 Commits
9791a45ebd
...
015c63597e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
015c63597e | ||
|
|
5ff9c045f5 | ||
|
|
4a5eb29229 | ||
|
|
7b0fe75179 | ||
|
|
2beb884293 | ||
|
|
e0d5ac11c6 | ||
|
|
663f4c351e | ||
|
|
2e35b616f0 |
76
.github/scripts/render-readme.py
vendored
76
.github/scripts/render-readme.py
vendored
@@ -1,5 +1,10 @@
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
import json
|
||||
import os
|
||||
import logging
|
||||
|
||||
# Configuring logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
DATAFILE = "./data.json"
|
||||
TEMPLATEPATH = "./.github/"
|
||||
@@ -9,34 +14,61 @@ TARGETFILE = "./README.md"
|
||||
def new_technology_dict(repo_technology):
|
||||
return {"link_id": repo_technology.lower(), "entries": []}
|
||||
|
||||
# Function to log warnings for missing data
|
||||
def log_warning(message):
|
||||
logging.warning(message)
|
||||
|
||||
# Check if the data file exists
|
||||
if not os.path.exists(DATAFILE):
|
||||
log_warning(f"Data file {DATAFILE} does not exist.")
|
||||
exit(1)
|
||||
|
||||
# Load data from the JSON file
|
||||
try:
|
||||
with open(DATAFILE, "r") as datafile:
|
||||
data = json.loads(datafile.read())
|
||||
except json.JSONDecodeError:
|
||||
log_warning("Error: Failed to parse JSON data in the file.")
|
||||
exit(1)
|
||||
|
||||
# Initialize technologies dictionary
|
||||
technologies = {}
|
||||
|
||||
with open(DATAFILE, "r") as datafile:
|
||||
data = json.loads(datafile.read())
|
||||
|
||||
for technology in data["technologies"]:
|
||||
# Processing technologies
|
||||
for technology in data.get("technologies", {}):
|
||||
technologies[technology] = {
|
||||
"link_id": data["technologies"][technology],
|
||||
"link_id": data["technologies"].get(technology),
|
||||
"entries": [],
|
||||
}
|
||||
|
||||
for repository in data["repositories"]:
|
||||
repo_technologies = repository["technologies"]
|
||||
# Processing repositories
|
||||
for repository in data.get("repositories", []):
|
||||
repo_technologies = repository.get("technologies", [])
|
||||
if not repo_technologies:
|
||||
log_warning(f"Repository {repository['name']} has no technologies listed.")
|
||||
for repo_technology in repo_technologies:
|
||||
if not technologies.get(repo_technology, False):
|
||||
if repo_technology not in technologies:
|
||||
technologies[repo_technology] = new_technology_dict(repo_technology)
|
||||
log_warning(f"Technology {repo_technology} is newly added.")
|
||||
technologies[repo_technology]["entries"].append(repository)
|
||||
|
||||
# Create Jinja2 environment and load the template
|
||||
env = Environment(loader=FileSystemLoader(TEMPLATEPATH))
|
||||
if not os.path.exists(os.path.join(TEMPLATEPATH, TEMPLATEFILE)):
|
||||
log_warning(f"Template file {TEMPLATEFILE} does not exist in the provided path.")
|
||||
exit(1)
|
||||
template = env.get_template(TEMPLATEFILE)
|
||||
|
||||
# Create categories from the technologies
|
||||
categories = []
|
||||
for key, value in zip(technologies.keys(), technologies.values()):
|
||||
for key, value in technologies.items():
|
||||
categories.append(
|
||||
{"title": key, "link_id": value["link_id"], "entries": value["entries"]}
|
||||
)
|
||||
|
||||
# Sorting categories and entries
|
||||
categories = sorted(categories, key=lambda x: x["title"].upper())
|
||||
|
||||
category_groups = {"Misc": []}
|
||||
for category in categories:
|
||||
category["entries"] = sorted(category["entries"], key=lambda x: x["name"].upper())
|
||||
@@ -48,8 +80,28 @@ for category in categories:
|
||||
else:
|
||||
category_groups["Misc"].append(category)
|
||||
|
||||
sponsors = data["sponsors"]
|
||||
# Process sponsors
|
||||
sponsors = data.get("sponsors", [])
|
||||
|
||||
output = template.render(category_groups=category_groups, categories=categories, sponsors=sponsors)
|
||||
# Generate Table of Contents (TOC)
|
||||
toc = []
|
||||
for category in categories:
|
||||
toc.append(f"- [{category['title']}]({category['link_id']})")
|
||||
|
||||
open(TARGETFILE, "w").write(output)
|
||||
# Prepare context for rendering the template
|
||||
context = {
|
||||
"category_groups": category_groups,
|
||||
"categories": categories,
|
||||
"sponsors": sponsors,
|
||||
"toc": toc # Adding TOC to context
|
||||
}
|
||||
|
||||
# Rendering the README file
|
||||
try:
|
||||
output = template.render(context)
|
||||
with open(TARGETFILE, "w") as targetfile:
|
||||
targetfile.write(output)
|
||||
logging.info("README file generated successfully.")
|
||||
except Exception as e:
|
||||
log_warning(f"Error while rendering template: {e}")
|
||||
exit(1)
|
||||
|
||||
@@ -367,6 +367,7 @@ If you would like to be guided through how to contribute to a repository on GitH
|
||||
- [H2O Wave](https://github.com/h2oai/wave) _(label: good first issue)_ <br> Realtime Web Apps and Dashboards framework for Python and R. Suited (not only) for AI audience.
|
||||
- [Hasura GraphQL Engine](https://github.com/hasura/graphql-engine) _(label: good first issue)_ <br> Blazing fast, instant realtime GraphQL APIs on Postgres with fine grained access control, also trigger webhooks on database events.
|
||||
- [Impler.io](https://github.com/implerhq/impler.io) _(label: good first issue)_ <br> 100% open source data import experience with readymade CSV & Excel import widget 🚀
|
||||
- [IterTools TS](https://github.com/Smoren/itertools-ts) _(label: good first issue)_ <br> Extended itertools port for TypeScript and JavaScript. Provides a huge set of functions for working with iterable collections (including async ones).
|
||||
- [LinksHub](https://github.com/rupali-codes/LinksHub) _(label: good first issue)_ <br> LinksHub aims to provide developers with access to a wide range of free resources and tools that they can use in their work.
|
||||
- [LitmusChaos](https://github.com/litmuschaos/litmus) _(label: good first issue)_ <br> Litmus is a toolset to do cloud-native chaos engineering.
|
||||
- [Manifest](https://github.com/mnfst/manifest) _(label: good first issue)_ <br> Manifestis an open-source Backend-as-a-Service allowign developers to create a backend easily and quickly.
|
||||
|
||||
@@ -2132,6 +2132,15 @@
|
||||
],
|
||||
"description": "Exosphere is a user-friendly client interface for OpenStack-based cloud systems."
|
||||
},
|
||||
{
|
||||
"name": "IterTools TS",
|
||||
"link": "https://github.com/Smoren/itertools-ts",
|
||||
"label": "good first issue",
|
||||
"technologies": [
|
||||
"TypeScript"
|
||||
],
|
||||
"description": "Extended itertools port for TypeScript and JavaScript. Provides a huge set of functions for working with iterable collections (including async ones)."
|
||||
},
|
||||
{
|
||||
"name": "Harmony",
|
||||
"link": "https://github.com/harmonydata/harmony",
|
||||
|
||||
Reference in New Issue
Block a user