Skip to content

Commit

Permalink
Merge pull request #1293 from python-discord/feat/timeline-from-yaml
Browse files Browse the repository at this point in the history
Markdown + YAML for the timeline
  • Loading branch information
wookie184 authored Jul 18, 2024
2 parents fec87a6 + 10f3f6a commit 9ac9ef9
Show file tree
Hide file tree
Showing 69 changed files with 783 additions and 994 deletions.
3 changes: 1 addition & 2 deletions pydis_site/apps/home/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# The "home" app

This Django application takes care of serving the homepage of our website, that
is, the first page that you see when you open pythondiscord.com. It also
manages the timeline page showcasing the history of our community.
is, the first page that you see when you open pythondiscord.com.

## Directory structure

Expand Down
3 changes: 1 addition & 2 deletions pydis_site/apps/home/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django_distill import distill_path

from .views import HomeView, timeline
from .views import HomeView

app_name = 'home'
urlpatterns = [
distill_path('', HomeView.as_view(), name='home'),
distill_path('timeline/', timeline, name="timeline"),
]
5 changes: 0 additions & 5 deletions pydis_site/apps/home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,3 @@ def get(self, request: WSGIRequest) -> HttpResponse:
"""Collect repo data and render the homepage view."""
repo_data = self._get_repo_data()
return render(request, "home/index.html", {"repo_data": repo_data})


def timeline(request: WSGIRequest) -> HttpResponse:
"""Render timeline view."""
return render(request, 'home/timeline.html')
45 changes: 45 additions & 0 deletions pydis_site/apps/timeline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The "timeline" app

The [timeline page](https://www.pythondiscord.com/timeline/) on our website is
powered by this Django application.

## The entries

Timeline entries are written in markdown files with YAML frontmatter under the
`entries` directory.

Each file represents a timeline entry. The file names have the format
`<date>_<name>.md`, where:
- `date` is in `YYYY-MM-DD` for easy sorting of files in directory listings,
also used for sorting of the entries displayed on the timeline page.
- `name` is an arbitrary slug in `kebab-case`, used for linking to individual
timeline entries on the page, which will be set in the `id` attribute for each
timeline item.

Each file contains:
- A YAML frontmatter, which defines some metadata shown next to each entry in
the timeline, including:
- `date`: User-facing date label.
- `icon`: The CSS class used for the icon, e.g. "fa fa-snowflake". Set to
`pydis` to use the pydis logo image.
- `icon_color`: The CSS class that sets the background color of the icon, e.g.
"pastel-red". List of available colors can be found in [the CSS
file](../../static/css/timeline/timeline.css). This can be omitted if the
pydis logo is used.
- Markdown content.


## Directory structure

The app has a single view in `views.py` that renders the template using the list
of parsed entries from `apps.py`, which reads the markdown files on startup.
This is a standard Django view, mounted in `urls.py` as usual.

The `tests` directory validates that the page renders successfully as expected.
If you made changes to the app and are looking for guidance on adding new tests,
the [Django tutorial introducing automated
testing](https://docs.djangoproject.com/en/dev/intro/tutorial05/) is a good
place to start.

This application does not use the database and as such does not have models nor
migrations.
Empty file.
50 changes: 50 additions & 0 deletions pydis_site/apps/timeline/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from pathlib import Path

from django.apps import AppConfig
import frontmatter
import markdown

from pydis_site import settings


ENTRIES_PATH = Path(settings.BASE_DIR, "pydis_site", "apps", "timeline", "entries")


class TimelineConfig(AppConfig):
"""AppConfig instance for Timeline app."""

name = 'pydis_site.apps.timeline'

def ready(self) -> None:
"""Fetch all the timeline entries."""
self.entries = []

for path in ENTRIES_PATH.rglob("*.md"):
metadata, content = frontmatter.parse(path.read_text(encoding="utf-8"))

md = markdown.Markdown()
html = str(md.convert(content))

# Strip `.md` file extension from filename and split it into the
# date (for sorting) and slug (for linking).
key, slug = path.name[:-3].split("_")

icon_color = metadata.get("icon_color")
# Use the pydis blurple as the default background color.
if not icon_color or metadata["icon"] == "pydis":
icon_color = "has-background-primary"

entry = {
"key": key,
"slug": slug,
"title": metadata["title"],
"date": metadata["date"],
"icon": metadata["icon"],
"icon_color": icon_color,
"content": html,
}

self.entries.append(entry)

# Sort the entries in reverse-chronological order.
self.entries.sort(key=lambda e: e['key'], reverse=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Python Discord is created
date: Jan 8th, 2017
icon: pydis
---

**Joe Banks** becomes one of the owners around 3 days after it is created, and
**Leon Sandøy** (lemon) joins the owner team later in the year, when the
community has around 300 members.
10 changes: 10 additions & 0 deletions pydis_site/apps/timeline/entries/2017-11-10_1000-members.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Python Discord hits 1,000 members
date: Nov 10th, 2017
icon: fa fa-users
icon_color: pastel-dark-blue
---

Our main source of new users at this point is a post on Reddit that happens to
get very good SEO. We are one of the top 10 search engine hits for the search
term "python discord".
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Our logo is born. Thanks @Aperture!
date: Feb 3rd, 2018
icon: pydis
---

<p style="background-color: #7289DA; border-radius: 10px;">
<img style="padding-right: 20px;" src="https://raw.githubusercontent.com/python-discord/branding/main/logos/logo_banner/logo_site_banner.svg">
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: PyDis hits 2,000 members; pythondiscord.com and @Python are live
date: Mar 4th, 2018
icon: fa fa-users
icon_color: pastel-dark-blue
---

The public moderation bot we're using at the time, Rowboat, announces it will be
shutting down. We decide that we'll write our own bot to handle moderation, so
that we can have more control over its features. We also buy a domain and start
making a website in Flask.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: First code jam with the theme “snakes”
date: Mar 23rd, 2018
icon: fa fa-dice
icon_color: pastel-blue
---

Our very first Code Jam attracts a handful of users who work in random teams of
2. We ask our participants to write a snake-themed Discord bot. Most of the code
written for this jam still lives on in Sir Lancebot, and you can play with it by
using the `.snakes` command. For more information on this event, see [the event
page](https://pythondiscord.com/pages/code-jams/code-jam-1-snakes-bot/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: The privacy policy is created
date: May 21st, 2018
icon: fa fa-scroll
icon_color: pastel-lime
---

Since data privacy is quite important to us, we create a privacy page pretty
much as soon as our new bot and site starts collecting some data. To this day,
we keep [our privacy policy](https://pythondiscord.com/pages/privacy/) up to
date with all changes, and since April 2020 we've started doing [monthly data
reviews](https://pythondiscord.notion.site/6784e3a9752444e89d19e65fd4510d8d).
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Do You Even Python and PyDis merger
date: Jun 9th, 2018
icon: fa fa-handshake
icon_color: pastel-pink
---

At this point in time, there are only two serious Python communities on Discord
- Ours, and one called Do You Even Python. We approach the owners of DYEP with a
bold proposal - let's shut down their community, replace it with links to ours,
and in return we will let their staff join our staff. This gives us a big boost
in members, and eventually leads to @eivl and @Mr. Hemlock joining our Admin
team
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: PyDis hits 5,000 members and partners with r/Python
date: Jun 20th, 2018
icon: fa fa-users
icon_color: pastel-dark-blue
---

As we continue to grow, we approach the r/Python subreddit and ask to become
their official Discord community. They agree, and we become listed in their
sidebar, giving us yet another source of new members.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: PyDis is now partnered with Discord; the vanity URL discord.gg/python is created
date: Jul 10th, 2018
icon: fa fa-handshake
icon_color: pastel-pink
---

After being rejected for their Partner program several times, we finally get
approved. The recent partnership with the r/Python subreddit plays a significant
role in qualifying us for this partnership.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: First Hacktoberfest PyDis event; @Sir Lancebot is created
date: Oct 1st, 2018
icon: fa fa-dice
icon_color: pastel-blue
---

We create a second bot for our community and fill it up with simple, fun and
relatively easy issues. The idea is to create an approachable arena for our
members to cut their open-source teeth on, and to provide lots of help and hand-
holding for those who get stuck. We're training our members to be productive
contributors in the open-source ecosystem.
9 changes: 9 additions & 0 deletions pydis_site/apps/timeline/entries/2018-11-24_10000-members.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: PyDis hits 10,000 members
date: Nov 24th, 2018
icon: fa fa-users
icon_color: pastel-dark-blue
---

We partner with RLBot, move from GitLab to GitHub, and start putting together
the first Advent of Code event.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: django-simple-bulma is released on PyPi
date: Dec 19th, 2018
icon: fa fa-code
icon_color: pastel-orange
---

Our very first package on PyPI, [django-simple-
bulma](https://pypi.org/project/django-simple-bulma/) is a package that sets up
the Bulma CSS framework for your Django application and lets you configure
everything in settings.py.
10 changes: 10 additions & 0 deletions pydis_site/apps/timeline/entries/2019-04-08_15000-members.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: PyDis hits 15,000 members; the “hot ones special” video is released
date: Apr 8th, 2019
icon: fa fa-users
icon_color: pastel-dark-blue
---

<div class="force-aspect-container">
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" class="force-aspect-content" frameborder="0" src="https://www.youtube.com/embed/DIBXg8Qh7bA"></iframe>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: The Django rewrite of pythondiscord.com is now live!
date: Sep 15, 2019
icon: fa fa-code
icon_color: pastel-orange
---

The site is getting more and more complex, and it's time for a rewrite. We
decide to go for a different stack, and build a website based on Django, DRF,
Bulma and PostgreSQL.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Sebastiaan Zeef becomes an owner
date: Sept 22nd, 2019
icon: pydis
---

After being a long time active contributor to our projects and the driving force
behind many of our events, Sebastiaan Zeef joins the Owners Team alongside Joe &
Leon.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: The code of conduct is created
date: Oct 26th, 2019
icon: fa fa-scroll
icon_color: pastel-lime
---

Inspired by the Adafruit, Rust and Django communities, an essential community
pillar is created; Our [Code of Conduct.](https://pythondiscord.com/pages/code-
of-conduct/)
10 changes: 10 additions & 0 deletions pydis_site/apps/timeline/entries/2019-12-22_30000-members.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: PyDis hits 30,000 members
date: Dec 22nd, 2019
icon: fa fa-users
icon_color: pastel-dark-blue
---

More than tripling in size since the year before, the community hits 30000
users. At this point, we're probably the largest Python chat community on the
planet.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: PyDis sixth code jam with the theme “Ancient technology” and the technology Kivy
date: Jan 17, 2020
icon: fa fa-dice
icon_color: pastel-blue
---

Our Code Jams are becoming an increasingly big deal, and the Kivy core
developers join us to judge the event and help out our members during the event.
One of them, @tshirtman, even joins our staff!

<div class="force-aspect-container">
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen="" class="force-aspect-content" frameborder="0"
src="https://www.youtube.com/embed/8fbZsGrqBzo"></iframe>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: The new help channel system is live
date: Apr 5th, 2020
icon: fa fa-comments
icon_color: pastel-green
---

We release our dynamic help-channel system, which allows you to claim your very
own help channel instead of fighting over the static help channels. We release a
[Help Channel Guide](https://pythondiscord.com/pages/resources/guides/help-
channels/) to help our members fully understand how the system works.
8 changes: 8 additions & 0 deletions pydis_site/apps/timeline/entries/2020-04-14_40000-members.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Python Discord hits 40,000 members, and is now bigger than Liechtenstein.
date: Apr 14, 2020
icon: fa fa-users
icon_color: pastel-dark-blue
---

![](https://raw.githubusercontent.com/python-discord/branding/main/wallpapers/bigger%20than%20liechtenstein/pydis%20postcard.png)
15 changes: 15 additions & 0 deletions pydis_site/apps/timeline/entries/2020-04-17_pydis-game-jam-2020.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: PyDis Game Jam 2020 with the “Three of a Kind” theme and Arcade as the technology
date: Apr 17th, 2020
icon: fa fa-gamepad
icon_color: pastel-purple
---

The creator of Arcade, Paul Vincent Craven, joins us as a judge. Several of the
Code Jam participants also end up getting involved contributing to the Arcade
repository.

<div class="force-aspect-container">
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" class="force-aspect-content" frameborder="0"
src="https://www.youtube.com/embed/KkLXMvKfEgs"></iframe>
</div>
11 changes: 11 additions & 0 deletions pydis_site/apps/timeline/entries/2020-05-25_modmail-is-now-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: ModMail is now live
date: May 25th, 2020
icon: fa fa-comments
icon_color: pastel-green
---

Having originally planned to write our own ModMail bot from scratch, we come
across an exceptionally good [ModMail bot by
kyb3r](https://github.com/kyb3r/modmail) and decide to just self-host that one
instead.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Python Discord is now listed on python.org/community
date: May 28th, 2020
icon: fa fa-handshake
icon_color: pastel-pink
---

After working towards this goal for months, we finally work out an arrangement
with the PSF that allows us to be listed on that most holiest of websites:
https://python.org/. [There was much
rejoicing.](https://youtu.be/yciX2meIkXI?t=3)
Loading

0 comments on commit 9ac9ef9

Please sign in to comment.