diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e195f41..a6768e9 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -32,3 +32,11 @@ repos:
rev: 23.9.1
hooks:
- id: black
+ - repo: local
+ hooks:
+ - id: check-for-layout
+ name: check-for-layout
+ files: _posts/.*.md
+ entry: python update_layout.py
+ language: python
+ additional_dependencies: [typer, python-frontmatter, typing-extensions]
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
index 5c09acd..01f9946 100644
--- a/MAINTAINERS.md
+++ b/MAINTAINERS.md
@@ -14,6 +14,7 @@ First off, thank you for considering contributing to Black Python Devs website.
- [Translations](#translations)
- [Styling](#styling)
- [Adding New Pages](#adding-new-pages)
+- Post Validation
# Before You Get Started
@@ -203,6 +204,34 @@ ROUTES = [
- Make sure your new page renders correctly and all links work as expected.
+## Layout Validation
+
+### Automatic Layout Updates
+
+To ensure consistency across all blog posts, we've implemented automatic layout validation and updating functionality. This helps maintain proper frontmatter configuration for all Markdown files in the `_posts` directory.
+
+### Tools and Features
+
+#### `update_layout.py` CLI Tool
+
+- Checks and applies missing layout fields to post files
+- Can process multiple posts simultaneously
+- Usage:
+ ```bash
+ python update_layout.py fix|check path/to/post1.md [path/to/post2.md ...]
+ ```
+
+#### Pre-commit Hook
+
+We've implemented a custom pre-commit hook that automatically runs the `update_layout.py` update check on any `.md` files in the `_posts` directory that are being committed. The hook will:
+
+- Run automatically before each commit
+- Check all modified `.md` files in the `_posts` directory
+- Apply the necessary layout field if missing
+- Fail the commit initially but fix the issue, allowing you to commit again
+
+For manual layout checks and updates, you can always run the `update_layout.py` tool directly.
+
---
Remember, when in doubt, don't hesitate to ask for help in our Discord community or in a GitHub issue!
diff --git a/_includes/latest-posts.html b/_includes/latest-posts.html
index 4a52c65..f926d64 100644
--- a/_includes/latest-posts.html
+++ b/_includes/latest-posts.html
@@ -7,8 +7,10 @@
+ {%- endif -%}
{%- assign count = count | plus:1 -%}
{%- endfor -%}
diff --git a/_layouts/default.html b/_layouts/default.html
index 06d4ebe..9e3363f 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -3,7 +3,7 @@
-
+
{% if page.title %}{{ site.title }} | {{ page.title }}{% else %}{{ site.title }}{% endif %}
diff --git a/_posts/2023-10-20-djangoconus.md b/_posts/2023-10-20-djangoconus.md
index 4c28195..866de3e 100644
--- a/_posts/2023-10-20-djangoconus.md
+++ b/_posts/2023-10-20-djangoconus.md
@@ -1,8 +1,10 @@
---
-layout: post
-lang: en
-title: "DjangoCon US 2023"
date: 2023-10-20
+description: Join us for a behind-the-scenes look at DjangoCon US 2023, where diversity
+ and inclusion came together to shape a powerful community of Python developers.
+lang: en
+layout: post
+title: DjangoCon US 2023
---
In Durham, North Carolina, approximately 300 Django developers gathered from all over the world for [DjangoCon US](https://2023.djangocon.us/). This event showcased the knowledge of the community and celebrated its cultural diversity and the diversity of its hosting city. The event was located at the Marriot Convention Center, in the heart of the city. There were many resturants and smaller attractions.
diff --git a/_posts/2023-11-11-what-is-the-us-conference-city-diversity-metric.md b/_posts/2023-11-11-what-is-the-us-conference-city-diversity-metric.md
index 0fae286..8acaa3e 100644
--- a/_posts/2023-11-11-what-is-the-us-conference-city-diversity-metric.md
+++ b/_posts/2023-11-11-what-is-the-us-conference-city-diversity-metric.md
@@ -1,9 +1,12 @@
---
-title: "What is the US Conference City Diversity Metric"
-layout: post
-lang: en
-date: 2023-11-11
author: Jay Miller
+date: 2023-11-11
+description: Discover how the US Conference Diversity Metric can inform your event's
+ location and create a more inclusive experience for attendees, with expert analysis
+ from Jay Miller.
+lang: en
+layout: post
+title: What is the US Conference City Diversity Metric
---
In 2022 at DjangoCon I took a look at the location of all of the PyCon US locations and their makeup by race. I highlighted that in the first 10 years of PyCon's existence, 9 of those 10 events were in culturally diverse cities like Atlanta, Washington DC and Chicago. The second half was during Python's boom and the need for larger venues started pushing conferences to more affordable areas with large international airports. These were places like Salt Lake City, Portland, and Montreal.
diff --git a/_posts/2023-11-13-black-python-devs-represent-in-dsf-elections.md b/_posts/2023-11-13-black-python-devs-represent-in-dsf-elections.md
index 5d16c65..70f7812 100644
--- a/_posts/2023-11-13-black-python-devs-represent-in-dsf-elections.md
+++ b/_posts/2023-11-13-black-python-devs-represent-in-dsf-elections.md
@@ -1,9 +1,11 @@
---
-title: "Black Python Devs Represent in DSF Elections"
-date: 2023-11-13
author: Jay Miller
+date: 2023-11-13
+description: Find out how the growing presence of Black Python Developers is shaping
+ the future of diversity in the tech industry through the DSF Elections.
lang: en
layout: post
+title: Black Python Devs Represent in DSF Elections
---
The DSF Board Elections have opened and voting is available for DSF members now until 27 November 2023 (Anywhere on Earth).
diff --git a/_posts/2023-12-14-dawn-wages-sarah-abderemane-and-djangonaut-space-awarded-the-malcolm-tredinnick-memorial-prize.md b/_posts/2023-12-14-dawn-wages-sarah-abderemane-and-djangonaut-space-awarded-the-malcolm-tredinnick-memorial-prize.md
index 3a67d5a..0d83e72 100644
--- a/_posts/2023-12-14-dawn-wages-sarah-abderemane-and-djangonaut-space-awarded-the-malcolm-tredinnick-memorial-prize.md
+++ b/_posts/2023-12-14-dawn-wages-sarah-abderemane-and-djangonaut-space-awarded-the-malcolm-tredinnick-memorial-prize.md
@@ -1,9 +1,12 @@
---
-title: "Dawn Wages, Sarah Abderemane and Djangonaut Space Awarded the Malcolm Tredinnick Memorial Prize"
-date: 2023-12-14
author: Jay Miller
+date: 2023-12-14
+description: Discover how the innovative team at Djangonaut Space is making a lasting
+ impact on the Django community with sustainable initiatives and groundbreaking projects.
lang: en
layout: post
+title: Dawn Wages, Sarah Abderemane and Djangonaut Space Awarded the Malcolm Tredinnick
+ Memorial Prize
---
Each year the _Django Software Foundation_, selects a person or group that exemplifies the outstanding service to community as shown by the award's namesake.
diff --git a/_posts/2023-12-14-sarah-abderemane-selected-to-the-django-software-foundation-board.md b/_posts/2023-12-14-sarah-abderemane-selected-to-the-django-software-foundation-board.md
index 014b858..a6e7043 100644
--- a/_posts/2023-12-14-sarah-abderemane-selected-to-the-django-software-foundation-board.md
+++ b/_posts/2023-12-14-sarah-abderemane-selected-to-the-django-software-foundation-board.md
@@ -1,9 +1,12 @@
---
-title: "Sarah Abderemane Selected to the Django Software Foundation Board of Directors"
-date: 2023-12-14
author: Jay Miller
+date: 2023-12-14
+description: Discover how Sarah Abderemane's selection to the Django Software Foundation
+ Board of Directors is a significant milestone for the thriving Black Python Devs
+ community.
lang: en
layout: post
+title: Sarah Abderemane Selected to the Django Software Foundation Board of Directors
---
This year Black Python Devs were strongly represented with [41% of the folks running](https://blackpythondevs.github.io/2023-11-13-black-python-devs-represent-in-dsf-elections/) belonging to the community.
diff --git a/_posts/2024-01-12-black-python-devs-is-sponsoring-pytexas.md b/_posts/2024-01-12-black-python-devs-is-sponsoring-pytexas.md
index 23b653e..6783e68 100644
--- a/_posts/2024-01-12-black-python-devs-is-sponsoring-pytexas.md
+++ b/_posts/2024-01-12-black-python-devs-is-sponsoring-pytexas.md
@@ -1,9 +1,12 @@
---
-title: "Black Python Devs is Sponsoring PyTexas"
-date: 2024-01-12
author: Jay Miller
+date: 2024-01-12
+description: Discover how Black Python Devs is supporting PyTexas, a premier regional
+ Python conference in Austin, TX, and learn about opportunities to attend for free
+ through ticket giveaways and speaker selection.
lang: en
layout: post
+title: Black Python Devs is Sponsoring PyTexas
---
We've got some fantastic updates to share about our upcoming involvement with PyTexas! We're thrilled to announce that we are a community sponsor for PyTexas!
diff --git a/_posts/2024-01-25-marlene-mhangami-recognized-as-python-fellow.md b/_posts/2024-01-25-marlene-mhangami-recognized-as-python-fellow.md
index 03da04d..7d07b48 100644
--- a/_posts/2024-01-25-marlene-mhangami-recognized-as-python-fellow.md
+++ b/_posts/2024-01-25-marlene-mhangami-recognized-as-python-fellow.md
@@ -1,8 +1,11 @@
---
-layout: post
-lang: en
-title: "Marlene Mhangami Recognized as Python Fellow for Q3 2023"
date: 2024-01-25
+description: Meet Marlene Mhangami, a trailblazing leader in the Python community
+ recognized for her exceptional contributions as PSF Chair and DEI Working Group
+ member, now highlighted as a Q3 2023 Python Fellow.
+lang: en
+layout: post
+title: Marlene Mhangami Recognized as Python Fellow for Q3 2023
---
Every quarter, the Python Software Foundation recognizes individuals in the community for their exceptional contributions to the Python community. Black Python Devs member [Marlene Mangami](http://marlenemhangami.com/) was selected as a fellow for [Q3 2023](https://pyfound.blogspot.com/2024/01/announcing-python-software-foundation.html).
diff --git a/_posts/2024-03-13-pycon-us-announcement.md b/_posts/2024-03-13-pycon-us-announcement.md
index f005ca3..e475de6 100644
--- a/_posts/2024-03-13-pycon-us-announcement.md
+++ b/_posts/2024-03-13-pycon-us-announcement.md
@@ -1,8 +1,10 @@
---
-layout: post
-lang: en
-title: "Black Python Devs x PyCon US"
date: 2024-03-13
+description: Explore how Black Python Devs is shaping the future of the Python community
+ through a range of events and activities at PyCon US.
+lang: en
+layout: post
+title: Black Python Devs x PyCon US
---
PyCon US is coming and Black Python Devs will represented strongly.
diff --git a/_posts/2024-05-03-pycon_ng_2024.md b/_posts/2024-05-03-pycon_ng_2024.md
index 3b269cd..04a5031 100644
--- a/_posts/2024-05-03-pycon_ng_2024.md
+++ b/_posts/2024-05-03-pycon_ng_2024.md
@@ -1,9 +1,12 @@
---
-layout: post
-title: Black Python Devs is sponsoring PyCon Nigeria 2024
date: 2024-05-03
-lang: en
+description: Discover how Black Python Devs is empowering the next generation of developers
+ through its partnership with PyCon Nigeria 2024 and learn about exclusive opportunities
+ for students.
featured_image: /assets/images/bpdxpyconng.jpg
+lang: en
+layout: post
+title: Black Python Devs is sponsoring PyCon Nigeria 2024
---
We're happy to annouce that Black Python Devs will be sponsoring [PyCon Nigeria 2024](https://ng.pycon.org/) as a part of our _Build Local Community Initiative_. This commitment comes with the added benefit of free student ticket for qualifying Black Python Devs members.
diff --git a/_posts/2024-05-17-non-profit-announcement.md b/_posts/2024-05-17-non-profit-announcement.md
index ec533fa..3cf203d 100644
--- a/_posts/2024-05-17-non-profit-announcement.md
+++ b/_posts/2024-05-17-non-profit-announcement.md
@@ -1,9 +1,11 @@
---
-layout: post
-lang: en
-title: Black Python Devs is now a Non-Profit Under the GNOME Foundation
date: 2024-05-16
+description: Discover how a historic partnership between two influential organizations
+ is revolutionizing tech diversity and innovation in the open-source world.
featured_image: /assets/images/BPD_STACKED_featured.png
+lang: en
+layout: post
+title: Black Python Devs is now a Non-Profit Under the GNOME Foundation
---
The [GNOME Foundation](https://foundation.gnome.org/) and Black Python Devs are proud to announce that our organizations have entered into a fiscal sponsorship agreement for the mutual benefit of our communities and the greater OS world.
diff --git a/_posts/2024-05-22-why-we-use-colored-and-coloured.md b/_posts/2024-05-22-why-we-use-colored-and-coloured.md
index e3441c8..d341cfd 100644
--- a/_posts/2024-05-22-why-we-use-colored-and-coloured.md
+++ b/_posts/2024-05-22-why-we-use-colored-and-coloured.md
@@ -1,9 +1,12 @@
---
-layout: post
-lang: en
-title: Why We Use Black, Colored and Coloured when Describing Members
date: 2024-05-22
+description: Join us as we explore a nuanced approach to inclusive language, examining
+ the complexities of terms like "Black", "Colored", and "coloured" in describing
+ our community members.
featured_image: /assets/images/BPD_PyCon_2024_cropped.jpg
+lang: en
+layout: post
+title: Why We Use Black, Colored and Coloured when Describing Members
---
We've received concerns from (up to this point) entirely white folks on the internet about our usage of words like _Colored_ and _Coloured_ when regarding some of our members.
diff --git a/_posts/2024-05-25-abigail-mesrenyame-dogbe-wins-inaugural-outstanding-pylady-award.md b/_posts/2024-05-25-abigail-mesrenyame-dogbe-wins-inaugural-outstanding-pylady-award.md
index 5b6de15..b646987 100644
--- a/_posts/2024-05-25-abigail-mesrenyame-dogbe-wins-inaugural-outstanding-pylady-award.md
+++ b/_posts/2024-05-25-abigail-mesrenyame-dogbe-wins-inaugural-outstanding-pylady-award.md
@@ -1,10 +1,13 @@
---
-layout: "post"
-lang: "en"
-author: "Anotida Expected Msiiwa"
-title: "Abigail Mesrenyame Dogbe Honored with Inaugural Outstanding PyLady Award"
+author: Anotida Expected Msiiwa
date: 2024-01-25
-featured_image: "/assets/images/opa_winners_2024.png"
+description: Meet Abigail Mesrenyame Dogbe, a dedicated member of Black Python Devs
+ and recipient of the Inaugural Outstanding PyLady award, whose inspiring contributions
+ to the open-source community are empowering women in STEM.
+featured_image: /assets/images/opa_winners_2024.png
+lang: en
+layout: post
+title: Abigail Mesrenyame Dogbe Honored with Inaugural Outstanding PyLady Award
---
Every year, the PyLadies community recognizes individuals for their remarkable contributions to the open-source community with the [Inaugural Outstanding PyLady award](https://kit.pyladies.com/en/latest/global/award.html). This year, we are thrilled to announce that [Abigail Mesrenyame Dogbe](https://mesrenyamedogbe.hashnode.dev), a dedicated member of Black Python Devs, has been honored with this prestigious award at PyCon 2024 in Pittsburgh, PA.
diff --git a/_posts/2024-07-03-black-python-devs-running-for-2024-PSF-Board.md b/_posts/2024-07-03-black-python-devs-running-for-2024-PSF-Board.md
index 2138bd4..26f8657 100644
--- a/_posts/2024-07-03-black-python-devs-running-for-2024-PSF-Board.md
+++ b/_posts/2024-07-03-black-python-devs-running-for-2024-PSF-Board.md
@@ -1,9 +1,12 @@
---
-title: "Black Python Developers Running for the 2024 Python Software Foundation Board"
-date: 2024-07-03
author: Anotida Expected Msiiwa
+date: 2024-07-03
+description: Join us in learning about four exceptional Black Python developers who
+ are shaping the future of the Python community and running for a crucial role on
+ the Python Software Foundation Board.
lang: en
layout: post
+title: Black Python Developers Running for the 2024 Python Software Foundation Board
---
We are thrilled to announce that four exceptional Black Python developers are running for the [Python Software Foundation (PSF)](https://www.python.org/psf-landing/) Board of Directors this year. The candidates are Monica Oyugi, Abigail Dogbe, Darrell Jenkins, and Jeremy Tanner. Their dedication and contributions to the Python community are truly inspiring.
diff --git a/_posts/2024-07-20-black-python-devs-partners-with-pyohio.md b/_posts/2024-07-20-black-python-devs-partners-with-pyohio.md
index 18c7c99..c0ec033 100644
--- a/_posts/2024-07-20-black-python-devs-partners-with-pyohio.md
+++ b/_posts/2024-07-20-black-python-devs-partners-with-pyohio.md
@@ -1,10 +1,13 @@
---
-title: "Black Python Devs Partners with PyOhio to Foster Community Growth"
+author: Anotida Expected Msiiwa
date: 2024-07-20
-author: "Anotida Expected Msiiwa"
-lang: "en"
-layout: "post"
-featured_image: "/assets/images/black-python-devs-x-pyohio.png"
+description: Discover how Black Python Devs is teaming up with PyOhio to create a
+ more inclusive and diverse community, supporting and amplifying the voices of Black
+ developers in Ohio and beyond.
+featured_image: /assets/images/black-python-devs-x-pyohio.png
+lang: en
+layout: post
+title: Black Python Devs Partners with PyOhio to Foster Community Growth
---
We are thrilled to announce a significant new partnership between Black Python Devs and [PyOhio](https://www.pyohio.org/2024/)! This collaboration marks a major milestone in our mission to amplify the involvement of Black developers within the Python community, with a particular focus on the Ohio region. Our financial support for PyOhio is designed to stimulate community engagement and foster growth in the years to come.
diff --git a/_posts/2024-08-15-python-morsels-black-python-devs-high-five.md b/_posts/2024-08-15-python-morsels-black-python-devs-high-five.md
index 75f4249..1131731 100644
--- a/_posts/2024-08-15-python-morsels-black-python-devs-high-five.md
+++ b/_posts/2024-08-15-python-morsels-black-python-devs-high-five.md
@@ -1,8 +1,12 @@
---
-title: Black Python Devs Partners with Python Morsels for High Five Launch
+author: Jay Miller
date: 2024-08-15
+description: Discover how to kickstart your Python skills with a comprehensive 10-week
+ course, featuring daily exercises, community support, and real-world applications
+ - now available with an exclusive $30 off offer.
lang: en
-author: Jay Miller
+layout: post
+title: Black Python Devs Partners with Python Morsels for High Five Launch
---
We’re thrilled to announce a that Python Morsels is offering us an affiliate partnership for [Python High Five](https://www.pythonmorsels.com/high-five/), a comprehensive 10-week Python course starting in early September.
diff --git a/_posts/2024-08-16-talkpython-training-partnership.md b/_posts/2024-08-16-talkpython-training-partnership.md
index 631b762..14d1327 100644
--- a/_posts/2024-08-16-talkpython-training-partnership.md
+++ b/_posts/2024-08-16-talkpython-training-partnership.md
@@ -1,8 +1,12 @@
---
-title: "Talk Python Training Partners with Black Python Devs"
-date: 2024-08-16
author: Jay Miller
+date: 2024-08-16
+description: Learn how TalkPython Training's new partnership with Black Python Devs
+ is driving greater diversity and benefiting learners through a unique opportunity
+ to support both your education and the community.
lang: en
+layout: post
+title: Talk Python Training Partners with Black Python Devs
---
We are excited to announce a new partnership with TalkPython Training!
diff --git a/_posts/2024-09-09-oreilly-partnership.md b/_posts/2024-09-09-oreilly-partnership.md
index a1dcdb5..562d805 100644
--- a/_posts/2024-09-09-oreilly-partnership.md
+++ b/_posts/2024-09-09-oreilly-partnership.md
@@ -1,9 +1,13 @@
---
-title: "O'Reilly Media Partners with Black Python Devs"
-date: 2024-09-09
author: Jay Miller
-lang: en
+date: 2024-09-09
+description: Get the inside scoop on O'Reilly Media's innovative partnership with
+ Black Python Devs and discover how it's revolutionizing access to high-quality learning
+ resources for the Black Python community.
featured_image: /assets/images/bpd_x_oreilly.jpg
+lang: en
+layout: post
+title: O'Reilly Media Partners with Black Python Devs
---
We are excited to announce a new partnership with O'Reilly Media!
diff --git a/_posts/2024-10-13-black-python-devs-ghana-event.md b/_posts/2024-10-13-black-python-devs-ghana-event.md
index 37897a2..88578da 100644
--- a/_posts/2024-10-13-black-python-devs-ghana-event.md
+++ b/_posts/2024-10-13-black-python-devs-ghana-event.md
@@ -1,9 +1,12 @@
---
-title: "Black Python Devs Ghana Connect Meetup"
-date: 2024-10-13
author: Abigail Afi Gbadago
-lang: en
+date: 2024-10-13
+description: Discover how Ghanaian developers turned their passion for coding into
+ a career with inspiring stories of perseverance and innovation in Python.
featured_image: /assets/images/bpd_ghana_connect1.webp
+lang: en
+layout: post
+title: Black Python Devs Ghana Connect Meetup
---
On Saturday, August 17th, 2024, Stancy and Afi hosted the Black Python Devs Ghana Connect Meetup at Accra Mall, Pizza Inn. The event started at 1 PM with a warm introduction and welcome remarks from our moderator, Theresa Seyram Agbenyegah. We had an enthusiastic turnout of 22 participants, each of whom introduced themselves during an icebreaker session.
diff --git a/_posts/2024-10-19-black-python-devs-leadership-summit.md b/_posts/2024-10-19-black-python-devs-leadership-summit.md
index ccd7c0e..4c96a17 100644
--- a/_posts/2024-10-19-black-python-devs-leadership-summit.md
+++ b/_posts/2024-10-19-black-python-devs-leadership-summit.md
@@ -1,9 +1,13 @@
---
-title: "Black Python Devs Leadership Summit"
-date: 2024-10-19
author: Abigail Afi Gbadago
-lang: en
+date: 2024-10-19
+description: Join Abigail Afi Gbadago and other leaders at the highly successful Black
+ Python Devs Leadership Summit as they shared insights on succession planning, mental
+ health, and leadership skills in a day of engaging talks and interactive sessions.
featured_image: /assets/images/bpd-leadership-summit-1.jpeg
+lang: en
+layout: post
+title: Black Python Devs Leadership Summit
---
The Black Python Devs Leadership Summit, which took place on September 21st at 8 a.m. was a successful event.
diff --git a/_posts/2024-10-25-pycon-ug-2024.md b/_posts/2024-10-25-pycon-ug-2024.md
index 04cb989..5b9f8e6 100644
--- a/_posts/2024-10-25-pycon-ug-2024.md
+++ b/_posts/2024-10-25-pycon-ug-2024.md
@@ -1,9 +1,13 @@
---
-title: "Black Python Devs at PyconUG 2024"
+author: Tobias Thomas (Toe•bias HT)
date: 2024-10-25
-author: "Tobias Thomas (Toe•bias HT)"
+description: Discover the inspiring stories of Uganda's next generation African Python
+ developers who attended PyconUG 2024 and learn about their experiences in a vibrant
+ tech community.
+featured_image: /assets/images/PyconUG-BPD-X-Conference-Logos.png
lang: en
-featured_image: "/assets/images/PyconUG-BPD-X-Conference-Logos.png"
+layout: post
+title: Black Python Devs at PyconUG 2024
---
Wednesday, 9th, October, 2024, was Uganda's Independence day.
diff --git a/_posts/2024-10-29-dsf-candidates-2025.md b/_posts/2024-10-29-dsf-candidates-2025.md
index a9ec3d5..6f710c4 100644
--- a/_posts/2024-10-29-dsf-candidates-2025.md
+++ b/_posts/2024-10-29-dsf-candidates-2025.md
@@ -1,10 +1,13 @@
---
-title: "Black Python Devs Running for the DSF"
-date: 2024-10-29
author: Jay Miller
+date: 2024-10-29
+description: Discover how a new generation of Black Python Developers is shaping the
+ future of Django and the global tech community, and learn about their inspiring
+ stories and impact on the world.
+featured_image: /assets/images/django-foundation-election.webp
lang: en
layout: post
-featured_image: /assets/images/django-foundation-election.webp
+title: Black Python Devs Running for the DSF
---
The [DSF Board Candidates have been announced](https://www.djangoproject.com/weblog/2024/oct/28/2025-dsf-board-candidates/) and voting is now open for DSF members now until 15 November (Anywhere on Earth).
diff --git a/_posts/2024-11-02-black-python-devs-pyho-2024.md b/_posts/2024-11-02-black-python-devs-pyho-2024.md
index ceec064..14da676 100644
--- a/_posts/2024-11-02-black-python-devs-pyho-2024.md
+++ b/_posts/2024-11-02-black-python-devs-pyho-2024.md
@@ -1,9 +1,12 @@
---
-title: "Amplifying Voices and Fostering Community: Black Python Devs as a Catalyst."
-date: 2024-11-02
author: Kafui Alordo
-lang: en
+date: 2024-11-02
+description: Discover how Black Python Devs is redefining the future of Python's open
+ source ecosystem by creating a safe and inclusive space for underrepresented developers.
featured_image: /assets/images/bpd_pyho_2024.jpg
+lang: en
+layout: post
+title: "Amplifying Voices and Fostering Community: Black Python Devs as a Catalyst."
---
We’re ecstatically pleased as a community to share in the celebration of the incredible impact of Black Python Devs (BPD) on PyHo 2024 (the regional Python community conference of the people of Volta). Through an unwavering commitment to empower underrepresented/underserved developers.
diff --git a/ollama_summarizer.py b/ollama_summarizer.py
new file mode 100644
index 0000000..c3e7713
--- /dev/null
+++ b/ollama_summarizer.py
@@ -0,0 +1,42 @@
+from rich.progress import track
+import pathlib
+import frontmatter
+from langchain_core.prompts import PromptTemplate
+from langchain_ollama import OllamaLLM
+from langchain.chains.summarize import load_summarize_chain
+from langchain_community.document_loaders.text import TextLoader
+from langchain_text_splitters.character import RecursiveCharacterTextSplitter
+
+
+llm = OllamaLLM(model="llama3.2")
+prompt_template = """Write a subtle description to encourage the reader to read the blog post.
+
+{text}
+
+---
+
+Instructions:
+Only return the response, no confirmation.
+These are professional updates from Black Python Devs.
+Use no more than 1 sentence.
+Avoid clickbait phrases
+"""
+prompt = PromptTemplate(template=prompt_template, input_variables=["text"])
+chain = load_summarize_chain(llm=llm, prompt=prompt)
+
+splitter = RecursiveCharacterTextSplitter(
+ separators=["\n", ".", "?"],
+ keep_separator="end",
+ chunk_size=1000,
+ chunk_overlap=200,
+)
+
+for file in track(pathlib.Path("_posts").glob("*.md"), description="running"):
+ fm_file = frontmatter.loads(file.read_text())
+ doc = TextLoader(file.absolute()).load()[0]
+
+ # if "description" in fm_file.keys():
+ # continue
+ summary = chain.invoke(input=splitter.split_documents([doc]))
+ fm_file["description"] = summary["output_text"].strip('"').strip("\n")
+ file.write_text(frontmatter.dumps(fm_file))
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 5af3538..2f19572 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,5 +1,18 @@
-ephemeral_port_reserve
+# page-generation
gh-issues
+
+# linting
pre-commit
+typer
+
+# Automation
+langchain
+langchain_community
+langchain_ollama
+rich
+python-frontmatter
+
+# Testing
+ephemeral_port_reserve
pytest-playwright
pytest-xprocess
diff --git a/tests/test.py b/tests/test.py
index c5cc2f9..8c20e34 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -1,6 +1,8 @@
import pathlib
+from typing import Generator
import pytest
+import frontmatter
from xprocess import ProcessStarter
from playwright.sync_api import Page, expect, sync_playwright
@@ -90,7 +92,7 @@ def test_headers_in_language(page_url: tuple[Page, str], route: str) -> None:
)
def test_bpdevs_title_en(page_url: tuple[Page, str], title: str, url: str) -> None:
page, live_server_url = page_url
- page.goto(f"{live_server_url}/{url}")
+ page.goto(f"{live_server_url}{url}")
expect(page).to_have_title(f"Black Python Devs | {title}")
@@ -99,3 +101,50 @@ def test_mailto_bpdevs(page_url: tuple[Page, str]) -> None:
page.goto(live_server_url)
mailto = page.get_by_role("link", name="email")
expect(mailto).to_have_attribute("href", "mailto:contact@blackpythondevs.com")
+
+
+@pytest.mark.parametrize(
+ "url",
+ (
+ "/",
+ "/blog",
+ ),
+)
+def test_page_description_in_index_and_blog(page_url: tuple[Page, str], url: str):
+ """Checks for the descriptions data in the blog posts. There should be some objects with the class `post-description`"""
+ page, live_server_url = page_url
+ page.goto(f"{live_server_url}{url}")
+ expect(page.locator("p.post-description").first).to_be_visible()
+ expect(page.locator("p.post-description").first).not_to_be_empty()
+
+
+def stem_description(
+ path: pathlib.Path,
+) -> Generator[tuple[str, frontmatter.Post], None, None]:
+ """iterate throug a list returning the stem of the file and the contents"""
+
+ for entry in path.glob("*.md"):
+ yield (entry.stem, frontmatter.loads(entry.read_text()))
+
+
+blog_posts = stem_description(pathlib.Path("_posts"))
+
+
+@pytest.mark.parametrize("post", list(blog_posts))
+def test_page_blog_posts(
+ page_url: tuple[Page, str], post: tuple[str, frontmatter.Post]
+):
+ """Checks that the meta page description matches the description of the post"""
+ page, live_server_url = page_url
+ entry_stem, frontmatter = post
+ url = f"{live_server_url}/{entry_stem}/"
+ page.goto(url)
+ page.wait_for_selector(
+ 'meta[name="description"]',
+ timeout=5000,
+ state="attached",
+ )
+ assert (
+ page.locator('meta[name="description"]').get_attribute("content")
+ == frontmatter["description"]
+ )
diff --git a/update_layout.py b/update_layout.py
new file mode 100644
index 0000000..1362ccd
--- /dev/null
+++ b/update_layout.py
@@ -0,0 +1,30 @@
+import typing
+import typer
+import pathlib
+import frontmatter
+
+
+app = typer.Typer(no_args_is_help=True)
+
+
+@app.command(name="check")
+def check_file(
+ target_files: typing.List[pathlib.Path],
+) -> None:
+ """Check a file for the layout attribute"""
+
+ ret_code = 0
+ for target_file in target_files:
+ fm_file = frontmatter.loads(target_file.read_text())
+
+ if "layout" not in fm_file.metadata:
+ print("%s is missing the `layout` value. Applying layout: post.")
+ fm_file["layout"] = "post"
+ target_file.write_text(frontmatter.dumps(fm_file))
+ ret_code = 1
+
+ typer.Exit(code=ret_code)
+
+
+if __name__ == "__main__":
+ app()