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/Gemfile b/Gemfile index 05f6909..c392852 100644 --- a/Gemfile +++ b/Gemfile @@ -1,21 +1,21 @@ -source "https://rubygems.org" -ruby RUBY_VERSION - -gem "jekyll" - -# If you have any plugins, put them here! -group :jekyll_plugins do - gem "jemoji" - gem "github-pages" - gem "jekyll-remote-theme" - gem "jekyll-feed" -end - -# Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] - -gem 'webrick', '~> 1.7' - -# gem "rake" -# gem 'prism', '~> 0.17.1' -# gem 'ruby-lsp', '~> 0.12.4' +source "https://rubygems.org" +ruby RUBY_VERSION + +gem "jekyll" + +# If you have any plugins, put them here! +group :jekyll_plugins do + gem "jemoji" + gem "github-pages" + gem "jekyll-remote-theme" + gem "jekyll-feed" +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] + +gem 'webrick', '~> 1.9' + +# gem "rake" +# gem 'prism', '~> 0.17.1' +# gem 'ruby-lsp', '~> 0.12.4' diff --git a/Gemfile.lock b/Gemfile.lock index 089e757..2b2a23e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,9 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.2.1.1) + activesupport (8.0.0) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -12,9 +13,11 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.2.0) + benchmark (0.4.0) bigdecimal (3.1.8) coffee-script (2.4.1) coffee-script-source @@ -34,13 +37,13 @@ GEM ethon (0.16.0) ffi (>= 1.15.0) eventmachine (1.2.7) - execjs (2.9.1) - faraday (2.12.0) - faraday-net_http (>= 2.0, < 3.4) + execjs (2.10.0) + faraday (2.12.1) + faraday-net_http (>= 2.0, < 3.5) json logger - faraday-net_http (3.3.0) - net-http + faraday-net_http (3.4.0) + net-http (>= 0.5.0) ffi (1.17.0-aarch64-linux-gnu) ffi (1.17.0-aarch64-linux-musl) ffi (1.17.0-arm-linux-gnu) @@ -221,7 +224,7 @@ GEM gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) - json (2.7.2) + json (2.8.2) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -237,7 +240,7 @@ GEM jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.25.1) - net-http (0.4.1) + net-http (0.5.0) uri nokogiri (1.16.7-aarch64-linux) racc (~> 1.4) @@ -261,7 +264,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rexml (3.3.8) + rexml (3.3.9) rouge (3.30.0) rubyzip (2.3.2) safe_yaml (1.0.5) @@ -273,7 +276,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - securerandom (0.3.1) + securerandom (0.3.2) simpleidn (0.2.3) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) @@ -282,8 +285,8 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (1.8.0) - uri (0.13.1) - webrick (1.8.2) + uri (1.0.2) + webrick (1.9.0) PLATFORMS aarch64-linux @@ -308,7 +311,7 @@ DEPENDENCIES jekyll-remote-theme jemoji tzinfo-data - webrick (~> 1.7) + webrick (~> 1.9) RUBY VERSION ruby 3.3.5p100 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/_data/conferences.json b/_data/conferences.json index b86f942..b47d577 100644 --- a/_data/conferences.json +++ b/_data/conferences.json @@ -1,22 +1,12 @@ [ { - "conference_name": "PyconUg", - "url": "https://ug.pycon.org", - "conference_start_date": "2024-10-09", - "conference_end_date": "2024-10-13", + "conference_name": "DELSU Tech Invasion 2.0", + "url": "https://dti.hamplustech.com/", + "conference_start_date": "2024-12-04", + "conference_end_date": "2024-12-05", "conference_type": "in-person", - "conference_location": "NWSC International Resource Centre (IREC), Kampala, Uganda", - "summary": "The conference is a five-day event, 9-13 October. PyconUganda inherit this tradition of an annual event that brings together python enthusiasts, tech audiences and technology business in uganda and around the world.", - "speaking": null - }, - { - "conference_name": "PyHo", - "url": "https://twitter.com/pythonho", - "conference_start_date": "2024-10-25", - "conference_end_date": "2024-10-26", - "conference_type": "in-person", - "conference_location": "University of Health and Allied Sciences, Trafalgar, Ho. Ho, Volta Region, Ghana.", - "summary": "PyHo, champion the leverage of Python in education promote diversity and inclusion from underrepresented communities within\nthe/beyond our region. Provide the foundational platform for new and experienced speakers alike to share ideas and resources.", - "speaking": null + "conference_location": "Abraka, Delta State, Nigeria", + "summary": "This is the second edition of DELSU Tech Invasion (DTI) with the theme: Learn . Innovate . Earn. The subject or focus area is Python for Academics: Spreadsheet and Data Manipulation, Data Analytics and Visualization.", + "speaking": "- Developing lite web apps using Flask and Python - [Michael Oghenerukevwe Edward](http://linkedin.com/in/airdward/)\n- Transitioning in Tech Ecosystem as a Female - [Precious Ogbuka](https://www.linkedin.com/in/precious-ogbuka)\n- Rapid Development of Desktop Apps using Tkinter and Python - [Azubuike Uche Nathan](https://x.com/NathanAzub10827)\n- Why Learn, Innovate and Earn - [Naomi Apomejevwe Egbe](https://x.com/IamNaomiEgbe)\n- Gender diversity and inclusion in the tech ecosystem - [Elozino Onorie](https://x.com/_hush_7)\n- others can be found in the links below:\n - https://dti.hamplustech.com/pages/speaker/\n - https://dti.hamplustech.com/pages/schedule/" } ] diff --git a/_includes/conferences.html b/_includes/conferences.html index d9e9393..54818ff 100644 --- a/_includes/conferences.html +++ b/_includes/conferences.html @@ -18,9 +18,7 @@

{% endif %} {% if conference.speaking %}

Speaking:

-
  • {{ conference.speaking | markdownify }} -
  • {% endif %} {% endfor %} diff --git a/_includes/latest-posts.html b/_includes/latest-posts.html index 4a52c65..40fbf0e 100644 --- a/_includes/latest-posts.html +++ b/_includes/latest-posts.html @@ -2,15 +2,20 @@

    {{ page.list_title }}

    {%- endif -%}
    - {%- assign date_format = site.bpdevs.date_format | default: "%b %-d, %Y" -%} {% assign count = 0 %} {% assign limit_posts = 3 %} {%- for post in posts -%} {%- if count < limit_posts -%} -
    -

    - {{ post.title | escape }} -

    - - {%- if site.show_excerpts -%} {{ post.excerpt }} {%- endif -%} + {%- assign date_format = site.bpdevs.date_format | default: "%b %-d, %Y" -%} +
    + {% assign count = 0 %} {% assign limit_posts = 3 %} {%- for post in posts -%} {%- if count < limit_posts -%} +
    +

    + {{ post.title | escape }} +

    +

    {{ post.date | date: date_format }}

    + {%- if site.show_excerpts -%} +

    {{ post.description }}

    + {%- endif -%} +
    + {%- assign count = count | plus: 1 -%} {%- endif -%} {%- endfor -%}
    - {%- assign count = count | plus:1 -%} {%- endif -%} {%- endfor -%}
    {% if site.paginate %} diff --git a/_includes/posts.html b/_includes/posts.html index 4907b5b..583964f 100644 --- a/_includes/posts.html +++ b/_includes/posts.html @@ -20,8 +20,10 @@

    {{ post.date | date: date_format }} {%- if site.show_excerpts -%} - {{ post.excerpt }} - {%- endif -%} +

    + {{ post.description }} +

    + {%- endif -%} {%- assign count = count | plus:1 -%} {%- endfor -%} diff --git a/_layouts/default.html b/_layouts/default.html index 044d03b..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 %} @@ -12,7 +12,6 @@ - {% if page.lang and page.untranslated != true and site.data.locales.size > 1 %} {% assign locales = site.data.locales | sort %} {% for locale in locales %} @@ -37,6 +36,5 @@ {%- include footer.html -%} - diff --git a/_layouts/index.html b/_layouts/index.html index 7268c72..3d6314b 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -3,31 +3,24 @@ ---
    {% assign t = site.data.locales[page.lang][page.lang] %} {% if page.title %} {% assign header = page.title %} {% else %} {% assign header = site.title %} {% endif %} -
    -
    + + +
    {{ content }} DjangoCon US 2023 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 e778492..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. @@ -19,8 +23,11 @@ From 10:15 to 11:00 a.m., Jay Miller gave a State of BPD highlighting our leader At midday, we took a 2-hour lunch break. -After lunch, we had a keynote address by ![Wesley Faulkner on Leadership vs Management](https://www.youtube.com/watch?v=A9HkxFDH1Cs). +After lunch, we had a keynote address by Wesley Faulkner on Leadership vs Management + +
    +
    ![Black Python Devs Ghana Connect Meetup](/assets/images/bpd-leadership-summit-2.jpeg) Right after, there was a Coffee Break at 10:15 - 10:30. diff --git a/_posts/2024-10-25-pycon-ug-2024.md b/_posts/2024-10-25-pycon-ug-2024.md new file mode 100644 index 0000000..5b9f8e6 --- /dev/null +++ b/_posts/2024-10-25-pycon-ug-2024.md @@ -0,0 +1,36 @@ +--- +author: Tobias Thomas (Toe•bias HT) +date: 2024-10-25 +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 +layout: post +title: Black Python Devs at PyconUG 2024 +--- + +Wednesday, 9th, October, 2024, was Uganda's Independence day. + +We were celebrating 62 years of independence. This also happened to be the first day of the 2nd installment of [Pyconug conference 2024](https://ug.pycon.org/2024). It was a very exciting day and alot of the Ugandan pythonistas and pythoneers were waiting in anticipation for this day. Pyconug had alot of remarkable sponsors this year; from international brands like Github, JetBrains and the Python Software Foundation to local brands like Africa's talking platform and more. + +![Toebias at PyCon UG](/assets/images/pyconug-toebias.jpeg) + +One of the sponsors for this year's pyconug conference was the BlackPythonDevs community. +We were able to purchase up to 47 student tickets that would enable 47 students attend the conference. I'm happy to report that out of the 47 students that were sponsored, 22 students were able to attend the 5-day conference. Most of the students attended on the 4th and 5th day of the event, which was Saturday and Sunday respectively. I also noted that most of the students that attended where male and only a handful of female students could make it. + +Throughout the 5 days of the pyconug conference, I was able to interact with the sponsored black python devs students and gathered their view on their experience so far. To most of the students, this was their first ever tech conference to attend. They were overwhelmed by the number of developers that attended, the talks that were given, the food that was served and the socializing events that took place among developers. It was a really thrilling experience for them. + +On day-4 and day-5 of the conference, I had a short session with them before their lunch to share about BlackPythonDevs, who were their sponsors. I introduced to them what BlackPythonDevs is and I invited questions for those that had any. Most of the questions I received where around what "BlackPythonDevs" actually meant. Was it referring to a black python; in which case one of the students playfully suggested it be renamed to black mamba instead, what exactly was BlackPythonDevs. It's when I understood that these students did not know the concept of being black. When I tried to point out that it was a community of python developers that identified as black, it spiraled up a lot of questions. Like; what does it mean to be black, are Africans black? How about North-Africans? How about the really light(yellow) skinned Khoi people? There were a lot of questions that I didn't have the answers for. + +I brought back the students to focus on what matters. We need to strive for unity so we shouldn't focus on things that separate us. Skin color, hair texture, accent and more are all just variations of who we are as people, and they shouldn't be the main focus. Once we were done with our short interaction, I was able to have a brief photo moment with the students that attended on various days. + +Once the conference was done, some students were able to write up on their experience at their first ever python event sponsored by BlackPythonDevs. Here are some of the links to what the students expressed on their linkedIn platforms. + +- Shakiran Nannyombi - [Wraping up PyconUG 2024](https://www.linkedin.com/posts/shakiran-nannyombi-401057222_v-machinelearning-advice-activity-7251508529713344512-_-2o/) +- Wahid Kokole - [Attending PyconUG](https://www.linkedin.com/posts/wahid-kokole-1270a210a_pyconuganda-pyconuganda2024-activity-7252370483545862144-A7F_/) +- Bryant Nuwe - [Excited to have attended PyconUG](https://www.linkedin.com/posts/bryant-nuwe-06225a28a_pyconuganda2024-pyconuganda-opensource-activity-7249821894869209088-Up8w/) + +In conclusion, the students and I are grateful towards BlackPythonDevs for sponsoring these students' experience and their first ever Pyconug conference. We do hope more opportunities like these will be availed to the students to have a successful journey in their tech career. + +![Group photo on Day of PyCon UG](/assets/images/pyconug-bpd-group-photo-day-4.jpeg) diff --git a/_posts/2024-10-29-dsf-candidates-2025.md b/_posts/2024-10-29-dsf-candidates-2025.md new file mode 100644 index 0000000..6f710c4 --- /dev/null +++ b/_posts/2024-10-29-dsf-candidates-2025.md @@ -0,0 +1,27 @@ +--- +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 +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). + +The DSF Board serve two year terms. "This is an excellent opportunity to help advance Django. They guide the direction of the marketing, governance and outreach activities of the Django community." + +Here are some Black Python Devs Members Running for the four seats open: + +- [Abigail Gbadago — Accra, Ghana](https://www.djangoproject.com/weblog/2024/oct/28/2025-dsf-board-candidates/#abigail-gbadago) +- [Ariane Djeupang Jocelyne — Yaounde, Cameroon](https://www.djangoproject.com/weblog/2024/oct/28/2025-dsf-board-candidates/#ariane-djeupang-jocelyne) +- [Chris Achinga — Mombasa, Kenya](https://www.djangoproject.com/weblog/2024/oct/28/2025-dsf-board-candidates/#chris-achinga) +- [Julius Nana Acheampong Boakye — Accra, Ghana](https://www.djangoproject.com/weblog/2024/oct/28/2025-dsf-board-candidates/#julius-nana-acheampong-boakye) +- [Keanya Phelps — Chicago, USA](https://www.djangoproject.com/weblog/2024/oct/28/2025-dsf-board-candidates/#keanya-phelps) + +The mission of Black Python Devs is to _extend the Python Communities to communities of Black Pythonistas around the world_ and these individuals all represent leadership in their local communities. + +We wish each candidate the best of luck in this election. diff --git a/_posts/2024-11-02-black-python-devs-pyho-2024.md b/_posts/2024-11-02-black-python-devs-pyho-2024.md new file mode 100644 index 0000000..14da676 --- /dev/null +++ b/_posts/2024-11-02-black-python-devs-pyho-2024.md @@ -0,0 +1,26 @@ +--- +author: Kafui Alordo +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. + +BPD’s dedication to serving as a safe and inclusive space for Black “Pythonistas” of all skill levels is awe inspiring. Fostering a vibrant and supportive community through providing opportunities for connection, learning, and collaboration. + +We appreciate Abigail Afi Gbadago, a BPD executive council member for gracing us with her presence during our #Sponsors talk session. Sharing invaluable insights into BPD’s initiatives and the opportunities for participation and collaboration within our local user group. + +![Woman on stage looking at Black Python Devs Logo on screen](/assets/images/bpd_pyho_2024_2.jpeg) + +Looking ahead, we envisage to continue our collective journey to shaping the future of Python’s open source ecosystem from a collaboration mindset over competition. BPD’s focus on growth and collaboration aligns perfectly with our shared goals and we look forward to working together to achieve even greater heights for the community both locally and globally. + +![a group photo of PyHo 2024 attendees](/assets/images/bpd_pyho_2024_3.jpg) + +We celebrate the power of Python and the spirit of community and the positive impact of initiatives like Black Python Devs. + +**PyHo24** diff --git a/assets/css/bpd.css b/assets/css/bpd.css index 9c8557a..b82df24 100644 --- a/assets/css/bpd.css +++ b/assets/css/bpd.css @@ -517,50 +517,134 @@ ul.speaking-list { max-width: 60%; } } -header { - padding: 40px 20px; - margin-bottom: 20px; - /* background-color: black; */ + +.slider { + position: relative; + max-width: 1200px; + margin: 50px auto; + overflow: hidden; + border: 2px solid #ddd; + border-radius: 8px; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); } -.slider-container { - min-height: 300px; + +.slides { display: flex; + transition: transform 0.5s ease-in-out; +} + +.slide { + min-width: 100%; + box-sizing: border-box; + position: relative; + text-align: center; justify-content: center; align-items: center; - /* background-image: url("/assets/images/hero-bpd-background.jpg"); */ - background-color: #222; - padding: 40px; - border-radius: 10px; - margin: 0 auto; - width: 85%; - /* max-width: 1000px; */ } -.email-circle { - width: 200px; - height: 200px; - background-color: #fff; - border-radius: 50%; + +.slide .image-wrapper { + width: 100%; + height: 300px; display: flex; justify-content: center; align-items: center; - margin: 0 auto 15px; overflow: hidden; + background-color: #222; } -.email-circle img { + +.slide .image-wrapper img { width: 100%; height: 100%; - object-fit: cover; + object-fit: contain; } -.carousel-item { - text-align: center; + +.info { + padding: 15px; + background-color: #fff; +} + +.info h2 { + margin: 10px 0; + font-size: 1.5em; + color: #333; } -.post-title { - font-size: 25px; - font-weight: bold; + +.info p { + margin: 0; + font-size: 1em; + color: #666; +} + +button { + position: absolute; + top: 50%; + transform: translateY(-50%); + background-color: #666; + border: none; color: white; - margin-bottom: 10px; + font-size: 18px; + padding: 10px; + cursor: pointer; + z-index: 1000; + outline: none; +} + +button:focus { + outline: none !important; +} + +button:hover { + background-color: #333; +} + +button.prev:focus, +button.next:focus { + outline: none !important; +} + +:focus { + outline: none !important; +} + +.prev { + left: 10px; +} + +.next { + right: 10px; +} + +.latest-posts-grid { + display: flex; + flex-wrap: wrap; + gap: 20px; +} + +.post-item { + flex: 1 1 calc(33.333% - 20px); + box-sizing: border-box; + padding: 10px; + border: 1px solid #ddd; + border-radius: 8px; + background-color: #f9f9f9; +} + +.post-item h3 { + margin-top: 0; } -.post-summary { - font-size: 15px; - color: #f1f1f1; + +.post-item p { + margin: 10px 0 0; +} + +@media (max-width: 800px) { + .post-item { + flex: 1 1 calc(50% - 20px); + } +} + +@media (max-width: 500px) { + .post-item { + flex: 1 1 100%; + } } diff --git a/assets/images/PyconUG-BPD-X-Conference-Logos.png b/assets/images/PyconUG-BPD-X-Conference-Logos.png new file mode 100644 index 0000000..f68d5ef Binary files /dev/null and b/assets/images/PyconUG-BPD-X-Conference-Logos.png differ diff --git a/assets/images/bpd_pyho_2024.jpg b/assets/images/bpd_pyho_2024.jpg new file mode 100644 index 0000000..fd2bcd8 Binary files /dev/null and b/assets/images/bpd_pyho_2024.jpg differ diff --git a/assets/images/bpd_pyho_2024_2.jpeg b/assets/images/bpd_pyho_2024_2.jpeg new file mode 100644 index 0000000..eb4205b Binary files /dev/null and b/assets/images/bpd_pyho_2024_2.jpeg differ diff --git a/assets/images/bpd_pyho_2024_3.jpg b/assets/images/bpd_pyho_2024_3.jpg new file mode 100644 index 0000000..c95e136 Binary files /dev/null and b/assets/images/bpd_pyho_2024_3.jpg differ diff --git a/assets/images/django-foundation-election.webp b/assets/images/django-foundation-election.webp new file mode 100644 index 0000000..d8f89dc Binary files /dev/null and b/assets/images/django-foundation-election.webp differ diff --git a/assets/images/pyconug-bpd-group-photo-day-4.jpeg b/assets/images/pyconug-bpd-group-photo-day-4.jpeg new file mode 100644 index 0000000..690269c Binary files /dev/null and b/assets/images/pyconug-bpd-group-photo-day-4.jpeg differ diff --git a/assets/images/pyconug-toebias.jpeg b/assets/images/pyconug-toebias.jpeg new file mode 100644 index 0000000..9afd0ae Binary files /dev/null and b/assets/images/pyconug-toebias.jpeg differ diff --git a/assets/js/bpd.js b/assets/js/bpd.js index 27cc31a..c57e320 100644 --- a/assets/js/bpd.js +++ b/assets/js/bpd.js @@ -42,3 +42,20 @@ $(document).ready(function () { loadLanguage($("#language option:selected").val()); }); }); + +let currentIndex = 0; + +function moveSlide(direction) { + const slides = document.querySelector(".slides"); + const totalSlides = slides.children.length; + + currentIndex += direction; + + if (currentIndex < 0) { + currentIndex = totalSlides - 1; + } else if (currentIndex >= totalSlides) { + currentIndex = 0; + } + + slides.style.transform = `translateX(-${currentIndex * 100}%)`; +} diff --git a/index.html b/index.html index 4daba48..1bf2ad9 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ layout: index lang: en title: Home -list_title: Recently on the blog +list_title: Recent blog ---

    Our Mission

    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 ef28bd9..8ca1b66 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 @@ -12,7 +14,7 @@ def page_url(xprocess, url_port): url, port = url_port class Starter(ProcessStarter): - timeout = 20 + timeout = 60 # Start the process args = [ "bundle", @@ -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}") @@ -105,10 +107,75 @@ def test_carousel_displayed(page_url: tuple[Page, str]) -> None: page, live_server_url = page_url page.goto(live_server_url) - carousel = page.locator(".carousel") + carousel = page.locator(".slider") expect(carousel).to_be_visible() - next_button = page.locator(".carousel-control-next") - prev_button = page.locator(".carousel-control-prev") + next_button = page.locator(".next") + prev_button = page.locator(".prev") expect(next_button).to_be_visible() expect(prev_button).to_be_visible() + + +def test_first_slide_matches_latest_post(page_url: tuple[Page, str]) -> None: + page, live_server_url = page_url + page.goto(live_server_url) + + # First slide and its title + first_slide_title = page.locator(".slide .info h2").nth(0) + + # First slide's title is visible + expect(first_slide_title).to_be_visible() + + expected_title = page.locator(".info h2").nth(0).inner_text().strip() + + assert ( + first_slide_title.inner_text().strip() == expected_title.strip() + ), "The first slide's title does not match the expected title of the latest post." + + +@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()