Planet Python

Subscribe to Planet Python feed
Planet Python - http://planetpython.org/
Updated: 23 hours 45 min ago

Real Python: Create Conway's Game of Life With Python

Tue, 2024-02-13 09:00

Wouldn’t it be cool to build a Python game that only requires initial user input and then seems to take on a mind of its own, creating mesmerizing patterns along the way? You can do exactly that with Conway’s Game of Life, which is about the evolution of cells in a life grid.

Implementing the Game of Life algorithm is a good exercise with many interesting challenges that you’ll have to figure out. Specifically, you’ll need to build the life grid and find a way to apply the game’s rules to all the cells on the grid so that they evolve through several generations.

In this video course, you’ll:

  • Implement Conway’s Game of Life algorithm with Python
  • Build a curses view to display the Game of Life grid
  • Create an argparse command-line interface for the game
  • Set up the game app for installation and execution

To get the most out of this video course, you should know the basics of writing object-oriented code in Python, creating command-line interface (CLI) apps with argparse, and setting up a Python project.

[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]

Categories: FLOSS Project Planets

Programiz: Python Program to Remove Duplicate Element From a List

Tue, 2024-02-13 06:28
In this example, you will learn to remove duplicate elements from a list.
Categories: FLOSS Project Planets

PyCharm: The Release Candidate for PyCharm 2023.3.4 Is Out!

Tue, 2024-02-13 05:33

PyCharm 2023.3.4 Release Candidate is now available!

You can get the latest build here, through the free Toolbox App, or via snaps for Ubuntu.

  • AI Assistant: Generate Python type annotations for a function.
  • AI Assistant: Generate Django views, admin or serializers for a model.
  • AI Assistant: Explain DataFrame action in Jupyter notebooks and Python scripts.
  • Django Structure: Quick navigation to settings.py directly from the tool window.
  • Quick Documentation tool window for Type Parameters and Type Aliases.
  • The bug causing the Unsatisfied package requirements notification is now fixed. [PY-65170]
  • Jupyter Notebook: Dropdown menus now work in ipywidget outputs. [PY-61554]

If you spot any bugs, please report them using our issue tracker. We’re also eager to hear your thoughts on the latest IDE updates, so feel free to connect with us on X (formerly Twitter) or drop a comment under this blog post. 

Categories: FLOSS Project Planets

Talk Python to Me: #449: Building UIs in Python with FastUI

Tue, 2024-02-13 03:00
Building web UIs in Python has always been in interesting proposition. On one end, we have a the full web design story with artisanal HTML and CSS. On another end there are several Python platforms that aim to the bring RAD, rapid app development, style of building with Python. Those can be great, and I've covered a couple of them, but they usually reach a limit on what they can do or how they integrate with the larger web ecosystem. On this episode, we have Samuel Colvin to share his latest exciting project FastUI. With FastUI, you build responsive web applications using React without writing a single line of JavaScript, or touching npm. Yet designers and other tools can focus on React front-ends for a professional SPA like app experience.<br/> <br/> <strong>Episode sponsors</strong><br/> <br/> <a href='https://talkpython.fm/brightdata'>bright data</a><br> <a href='https://talkpython.fm/sentry'>Sentry Error Monitoring, Code TALKPYTHON</a><br> <a href='https://talkpython.fm/training'>Talk Python Courses</a><br/> <br/> <strong>Links from the show</strong><br/> <br/> <div><b>Samuel on Mastodon</b>: <a href="https://fosstodon.org/@samuelcolvin" target="_blank" rel="noopener">fosstodon.org</a><br/> <b>Samuel on X</b>: <a href="https://twitter.com/samuel_colvin" target="_blank" rel="noopener">x.com</a><br/> <br/> <b>FastUI</b>: <a href="https://github.com/pydantic/FastUI" target="_blank" rel="noopener">github.com</a><br/> <b>FastUI Demos</b>: <a href="https://fastui-demo.onrender.com" target="_blank" rel="noopener">fastui-demo.onrender.com</a><br/> <b>FastAPI</b>: <a href="https://fastapi.tiangolo.com" target="_blank" rel="noopener">fastapi.tiangolo.com</a><br/> <b>Pydantic</b>: <a href="https://pydantic.dev" target="_blank" rel="noopener">pydantic.dev</a><br/> <b>How Did REST Come To Mean The Opposite of REST Article</b>: <a href="https://htmx.org/essays/how-did-rest-come-to-mean-the-opposite-of-rest/" target="_blank" rel="noopener">htmx.org</a><br/> <b>Tailwind UI</b>: <a href="https://tailwindui.com/components/application-ui/lists/grid-lists" target="_blank" rel="noopener">tailwindui.com</a><br/> <b>Dropbase</b>: <a href="https://www.dropbase.io" target="_blank" rel="noopener">dropbase.io</a><br/> <b>Anvil</b>: <a href="https://anvil.works" target="_blank" rel="noopener">anvil.works</a><br/> <b>Flutter code example</b>: <a href="https://github.com/ajay-prabhakar/awesome-flutter-ui/blob/master/book_app_ui/lib/main.dart" target="_blank" rel="noopener">github.com</a><br/> <b>ReactJS code example</b>: <a href="https://github.com/Yog9/SnapShot/blob/master/src/App.js" target="_blank" rel="noopener">github.com</a><br/> <b>Watch this episode on YouTube</b>: <a href="https://www.youtube.com/watch?v=DzyxUVm_1cI" target="_blank" rel="noopener">youtube.com</a><br/> <b>Episode transcripts</b>: <a href="https://talkpython.fm/episodes/transcript/449/building-uis-in-python-with-fastui" target="_blank" rel="noopener">talkpython.fm</a><br/> <br/> <b>--- Stay in touch with us ---</b><br/> <b>Subscribe to us on YouTube</b>: <a href="https://talkpython.fm/youtube" target="_blank" rel="noopener">youtube.com</a><br/> <b>Follow Talk Python on Mastodon</b>: <a href="https://fosstodon.org/web/@talkpython" target="_blank" rel="noopener"><i class="fa-brands fa-mastodon"></i>talkpython</a><br/> <b>Follow Michael on Mastodon</b>: <a href="https://fosstodon.org/web/@mkennedy" target="_blank" rel="noopener"><i class="fa-brands fa-mastodon"></i>mkennedy</a><br/></div>
Categories: FLOSS Project Planets

Python Bytes: #371 Python in a Crate

Tue, 2024-02-13 03:00
<strong>Topics covered in this episode:</strong><br> <ul> <li><a href="https://fosstodon.org/@RhetTbull/111876913345192826"><strong>AppleCrate</strong></a></li> <li><a href="https://nedbatchelder.com/blog/202402/one_way_to_package_python_code_right_now.html?utm_source=pocket_reader"><strong>One way to package Python code right now</strong></a></li> <li><a href="https://fosstodon.org/@ihor/111456123685623940"><strong>Flask8 but why?</strong></a></li> <li><strong>Extra, Extra, Extra</strong></li> <li><strong>Extras</strong></li> <li><strong>Joke</strong></li> </ul><a href='https://www.youtube.com/watch?v=zVyw2qTO88c' style='font-weight: bold;'data-umami-event="Livestream-Past" data-umami-event-episode="371">Watch on YouTube</a><br> <p><strong>About the show</strong></p> <p>Sponsored by ScoutAPM: <a href="https://pythonbytes.fm/scout">pythonbytes.fm/scout</a></p> <p><strong>Connect with the hosts</strong></p> <ul> <li>Michael: <a href="https://fosstodon.org/@mkennedy"><strong>@mkennedy@fosstodon.org</strong></a></li> <li>Brian: <a href="https://fosstodon.org/@brianokken"><strong>@brianokken@fosstodon.org</strong></a></li> <li>Show: <a href="https://fosstodon.org/@pythonbytes"><strong>@pythonbytes@fosstodon.org</strong></a></li> </ul> <p>Join us on YouTube at <a href="https://pythonbytes.fm/stream/live"><strong>pythonbytes.fm/live</strong></a> to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.</p> <p><strong>Michael #1:</strong> <a href="https://fosstodon.org/@RhetTbull/111876913345192826"><strong>AppleCrate</strong></a></p> <ul> <li>By <a href="https://fosstodon.org/@RhetTbull/111876913345192826">Rhet Turnbull</a> (from <a href="https://talkpython.fm/episodes/show/383/textinator-and-building-macos-apps-with-python">Building macOS Apps episode</a>)</li> <li>AppleCrate is a tool for creating native macOS installers for your command line tools. </li> <li>It's useful for creating installers for command line tools written in any language. </li> <li>Tools written in interpreted languages like Python will need to be first processed with a tool like pyinstaller to create a standalone executable.</li> <li>AppleCrate uses <a href="https://jinja.palletsprojects.com/en/3.0.x/">Jinja2</a> templates to generate the files required for the installer. This allows you to use template variables in your files or command line parameters to customize the installer. </li> </ul> <p><strong>Brian #2:</strong> <a href="https://nedbatchelder.com/blog/202402/one_way_to_package_python_code_right_now.html?utm_source=pocket_reader"><strong>One way to package Python code right now</strong></a></p> <ul> <li>Ned Batchelder</li> <li>An example repo with all the parts for package</li> <li>A lot of discussion and what to think about in the README (unfortunately rst and not md, but we can’t have everything)</li> <li>Includes <ul> <li>pyproject.toml</li> <li>dev-requirements.txt</li> <li>README.rst</li> <li>Makefile</li> <li>LICENSE.txt</li> <li>.bitignore</li> <li>.editorconfig <ul> <li>see https://editorconfig.org</li> </ul></li> </ul></li> <li>Shout out to to <a href="https://packaging.python.org/en/latest/tutorials/packaging-projects/">Packaging Python Projects</a> on python.org, which is pretty good</li> </ul> <p><strong>Michael #3:</strong> <a href="https://fosstodon.org/@ihor/111456123685623940"><strong>Flask8 but why?</strong></a></p> <ul> <li>Ihor Kalnytskyi: Something I really like about <a href="https://fosstodon.org/tags/ruff">#ruff</a>, a new tool for both linting and formatting in the <a href="https://fosstodon.org/tags/python">#python</a> ecosystem. You can literally pick any lint rule it supports and see both reasoning and examples.</li> <li>Ruff supports over 700 lint rules, many of which are inspired by popular tools like Flake8, isort, pyupgrade, and others. </li> </ul> <p><strong>Brian #4:</strong> <strong>Extra, Extra, Extra</strong></p> <ul> <li><a href="https://flat.app/">Flat.app</a> <ul> <li>kinda like trello, etc. but a very simple interface that makes it pretty easy to use</li> </ul></li> <li><a href="https://tosdr.org/en/frontpage">tosdr.org</a> <ul> <li>Terms of Service; Didn’t Read</li> <li>Kind of a wikipeda way to summarize the terms of service of different web services, and give them ratings/grades</li> </ul></li> <li><a href="https://www.sheenaoc.com/articles/2024-02-06-why-i-write">Why I write</a> <ul> <li>I talked about blogging more last episode. Here’s a cool write-up by Sheena O'Connell</li> <li>reasons <ul> <li>to remember</li> <li>to refine my thinking</li> <li>to impact</li> <li>to get through hard times</li> <li>to connect</li> </ul></li> </ul></li> <li><a href="https://blog.jetbrains.com/pycharm/2024/02/pytest-features/">Three pytest Features You Will Love</a> <ul> <li>Helen Scott at JetBrains/PyCharm</li> <li>Fixtures, Markers, Parametrize</li> <li>Plus shoutouts to my <a href="https://courses.pythontest.com/p/complete-pytest-course">course</a> and <a href="https://pythontest.com/pytest-book/">book</a></li> </ul></li> </ul> <p><strong>Extras</strong> </p> <p>Brian:</p> <ul> <li><a href="https://en.wikipedia.org/wiki/List_of_common_misconceptions">Wikipedia List of common misconceptions</a> - just for fun</li> <li><a href="https://www.eartrumpetlabs.com/products/microphones/edwina">Ear Trumpet Labs (a Potland Company) Edwina mic</a> - just something on my wish list</li> </ul> <p>Michael</p> <ul> <li><a href="https://monitor.mozilla.org/">Mozilla Monitor</a></li> <li><a href="https://docs.python.org/release/3.12.2/whatsnew/changelog.html#python-3-12-2">Python 3.12.2</a> <ul> <li>Upgraded all the Python apps (11 of them) in about 2 minutes and one command</li> </ul></li> <li>Got a Vision Pro? Try the <a href="https://training.talkpython.fm/apps">Talk Python Courses app</a></li> <li>Great video event: <a href="https://www.youtube.com/watch?v=KeegA_uzzSo">Data Doodling with Martina Pugliese</a></li> </ul> <p><strong>Joke:</strong> <a href="https://ifunny.co/picture/why-would-a-fly-land-on-something-like-this-rats-7NlBlVArA?s=cl">Free Tier</a></p>
Categories: FLOSS Project Planets

Python⇒Speed: Not just NVIDIA: GPU programming that runs everywhere

Mon, 2024-02-12 19:00

If you’re doing computations on a GPU, NVIDIA is the default, alongside its CUDA libraries. Some libraries like PyTorch support do support AMD GPUs and Macs. But from the re-implementations of NumPy, SciPy, and Pandas in the RAPIDS project, to Numba’s GPU support, NVIDIA has best software support in the Python world.

Sticking to NVIDIA-specific software has some downsides, however:

  • It won’t run on modern Mac laptops.
  • Testing in CI is more difficult: you need custom runners that have NVIDIA GPUs.
  • You can’t use any other GPUs you might have access to, like AMD GPUs.

What can you do if you want to use GPUs in a portable manner? In this article we’ll cover one option, the wgpu-py library.

Read more...
Categories: FLOSS Project Planets

Ned Batchelder: Updated multi-parameter interactive Jupyter notebook

Mon, 2024-02-12 14:21

A few years ago I wrote Multi-parameter Jupyter notebook interaction about a Jupyter notebook. It worked at the time, but when I dusted it off recently, it didn’t. I’ve renovated it and cleaned it up a little, and now it works again.

It’s a Jupyter notebook with a simulation of late-career money flows to figure out possibilities for retirement. It uses widgets to give you sliders to adjust parameters to see how the outcome changes. It also lets you pick one of the parameters to auto-plot with multiple values, which gives a more visceral way to understand the effect different variables have.

You can get the notebook itself if you like.

Categories: FLOSS Project Planets

Real Python: Primer on Python Decorators

Mon, 2024-02-12 09:00

In this tutorial on Python decorators, you’ll learn what they are and how to create and use them. Decorators provide a simple syntax for calling higher-order functions.

By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it. This sounds confusing, but it’ll make more sense after you’ve seen a few examples of how decorators work.

In this tutorial, you’ll learn:

  • What it means for functions to be first-class objects
  • How to define functions so they can be used as decorators
  • Which practical use cases can be tackled with decorators
  • How to create decorators so that they follow best practices

You can find all the examples from this tutorial by downloading the accompanying materials below:

Get Your Code: Click here to download the free sample code that shows you how to create and use Python decorators.

Free Bonus: Click here to get access to a free "The Power of Python Decorators" guide that shows you three advanced decorator patterns and techniques you can use to write cleaner and more Pythonic programs.

Decorators Cheat Sheet: Click here to get access to a free three-page Python decorators cheat sheet that summarizes the techniques explained in this tutorial.

Decorators Q&A Transcript: Click here to get access to a 25-page chat log from our Python decorators Q&A session in the Real Python Community Slack where we discussed common decorator questions.

Take the Quiz: Test your knowledge with our interactive “Decorators” quiz. Upon completion you will receive a score so you can track your learning progress over time:

Take the Quiz »

Python Functions

In order to understand decorators, you must first understand some finer points of how functions work. There are many aspects to functions, but in the context of decorators, a function returns a value based on the given arguments. Here’s a basic example:

Python >>> def add_one(number): ... return number + 1 ... >>> add_one(2) 3 Copied!

In general, functions in Python may also have side effects rather than just turning an input into an output. The print() function is an example of this: it returns None while having the side effect of outputting something to the console. However, to understand decorators, it’s enough to think about functions as tools that turn given arguments into values.

First-Class Objects

In functional programming, you work almost entirely with pure functions that don’t have side effects. While not a purely functional language, Python supports many functional programming concepts, including treating functions as first-class objects.

This means that functions can be passed around and used as arguments, just like any other object like str, int, float, list, and so on. Consider the following three functions:

Python greeters.py def say_hello(name): return f"Hello {name}" def be_awesome(name): return f"Yo {name}, together we're the awesomest!" def greet_bob(greeter_func): return greeter_func("Bob") Copied!

Here, say_hello() and be_awesome() are regular functions that expect a name given as a string. The greet_bob() function, however, expects a function as its argument. You can, for example, pass it the say_hello() or the be_awesome() function.

To test your functions, you can run your code in interactive mode. You do this with the -i flag. For example, if your code is in a file named greeters.py, then you run python -i greeters.py:

Python >>> greet_bob(say_hello) 'Hello Bob' >>> greet_bob(be_awesome) 'Yo Bob, together we're the awesomest!' Copied!

Note that greet_bob(say_hello) refers to two functions, but in different ways: greet_bob() and say_hello. The say_hello function is named without parentheses. This means that only a reference to the function is passed. The function isn’t executed. The greet_bob() function, on the other hand, is written with parentheses, so it will be called as usual.

This is an important distinction that’s crucial for how functions work as first-class objects. A function name without parentheses is a reference to a function, while a function name with trailing parentheses calls the function and refers to its return value.

Inner Functions

It’s possible to define functions inside other functions. Such functions are called inner functions. Here’s an example of a function with two inner functions:

Read the full article at https://realpython.com/primer-on-python-decorators/ »

[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]

Categories: FLOSS Project Planets

PyCharm: Three pytest Features You Will Love

Mon, 2024-02-12 04:00

One of the most popular frameworks for Python is pytest, and it comes with several cool features. I’m going to show you three of them in this blog post:

  • Fixtures
  • Markers
  • Parametrize

As you’d expect, PyCharm has full support for pytest, including a dedicated test runner, code completion, and code navigation. To get started with pytest in PyCharm, you need to install and enable pytest as your test runner.

Get started for free

Fixtures

It’s not unusual to set up resources and conditions for our tests and then tear them down after our tests have finished. Fixtures in pytest allow us to set up these resources and conditions in a consistent, reliable, and repeatable way. This can include mocking/stubbing, database connections, file creation, dependency injection, and more. 

By automating your test preconditions in this way, you can better organize your code to ensure that your tests focus on business logic, not the setup.

In order to tell pytest that some code is a fixture, we need to add the @pytest.fixture decorator. In this example, we are using a fixture to get a character list, which is required for the function test_get_minimum_height.

@pytest.fixture def fake_characters(): return [ {"name": "Luke", "height": 100}, {"name": "Leia", "height": 50}, ] def test_get_minimum_height(fake_characters): result = swapi.get_minimum_height(fake_characters, 75) assert len(result) == 1

Fixtures in pytest enable you to maximize code reusability, be specific about your test set-up and tear-down, and define the scope you want them to apply across your test suite.

For example, you can use the decorator @pytest.fixture(scope="module") in this context:

@pytest.fixture(scope=”module”) def fake_characters(): return [ {"name": "Luke", "height": 100}, {"name": "Leia", "height": 50}, ] def test_get_minimum_height(fake_characters): result = swapi.get_minimum_height(fake_characters, 75) assert len(result) == 1

Now the fake_characters fixture is set up at the start of the test file or module and is cached for future use. All of our test functions will share the same instance of the fixture.

Markers

Sometimes one size doesn’t fit all. Perhaps we need to run a subset of tests when a certain condition is true or skip other tests when a different condition is false. We can do both of these with pytest. 

Let’s look at built-in pytest markers first. In this example, we’ve added the decorator @pytest.mark.skip(reason="skipping while I hunt bug-18463") to tell pytest not to run this test. You shouldn’t routinely skip tests, but sometimes it’s a good tool to have. For example, it’s more helpful than commenting out your test and accidentally checking that in to version control!

@pytest.mark.skip(reason="skipping while I hunt bug-18463") def get_shortest(self, threshold): return [character for character in self if int(character['height']) < threshold]

You can also skip tests based on certain conditions by using the -skipif argument. 

For example, you can decorate a test with @pytest.mark.skipif() to say that a test does (or doesn’t) run on a specific operating system:

@pytest.mark.skipif(platform.system() == 'Darwin', reason="Test doesn't run on macOS") def test_get_characters(fake_characters): assert fake_characters[0]["name"] == "Luke"

The above code would tell pytest to skip this test if the operating system is macOS, but run it for other operating systems. As a side note, the macOS identifier here is ‘Darwin’ because of its Linux heritage. You can check the identifier by using the platform.system() method. 

Another use for @pytest.mark.skipif is to define a minimum Python version for the test:

@pytest.mark.skipif(sys.version_info < (3, 9), reason="Test only runs on Python 3.9 and higher") def test_get_characters(fake_characters): assert fake_characters[0]["name"] == "Luke"

This code says that the test only runs on Python 3.9 or higher. You can view a list of the built-in markers in pytest by running the following command in your terminal:

$ pytest --markers

You can also add your own custom metadata to markers. For example, we can add the pytest.mark.comparison() decorator to this test:

@pytest.mark.height(reason="This is a height test") def get_shortest(self, threshold): return [character for character in self if int(character['height']) < threshold]

When we run this test, pytest will only run tests decorated with this marker by specifying the marker (height):

$ pytest -m height

While pytest will run your test for you, it will also warn you that custom marks should be registered in your configuration file. The pytest documentation for custom markers has instructions on how to do this. 

Parametrize

@parametrize is another marker decorator in pytest that allows you to tell pytest to run the same test with different input parameters. That means if you have a function that accepts different inputs and expected outputs, you can write one test and use the @parametrize decorator, which vastly simplifies your code and improves the readability.

For example, in this code, we have used @pytest.mark.parametrize() to pass three lots of arguments into the test_get_minimum_heights() test. 

def test_get_minimum_height(fake_characters): result = swapi.get_minimum_height(fake_characters, 75) assert len(result) == 1 @pytest.mark.parametrize('threshold, count', [ [120, 0], [75, 1], [200, 2], ]) def test_get_minimum_heights(fake_characters, threshold, count): result = swapi.get_minimum_height(fake_characters, threshold) assert len(result) == count

When we run this test, pytest runs it three times, treating each run as a separate test:

The @parametrize decorator is helpful when you want one test to receive multiple inputs and expected outcomes.

Resources and further reading

If you want to learn more about fixtures, markers, and parametrize in pytest, here are some resources that you can check out:

Categories: FLOSS Project Planets

TechBeamers Python: Difference Between First-Class and Higher-Order Functions

Sun, 2024-02-11 01:29

In most programming languages like Python, Java, or JavaScript, two important terms often come to use are First-Class Functions and Higher-Order Functions. These concepts are fundamental to understanding the flexibility and power of programming. Hence, in this tutorial, we will explore the differences between first-class functions and higher-order functions. Must Read:1. Higher Order Functions in […]

The post Difference Between First-Class and Higher-Order Functions appeared first on TechBeamers.

Categories: FLOSS Project Planets

Django Weblog: Django accessibility in 2023 and beyond

Sat, 2024-02-10 23:25

Happy birthday, Django accessibility team! 🌈

The team has been up and running for three years, and is now looking for new members. With a lot happening in this space, we thought we were overdue for an update on what we’re up to.

Django accessibility in 2023

We’re very happy with the work done to date. There have been a lot of efforts to improve the accessibility of core Django features such as forms, and of the administrative interface. Beyond Django core, there has also been progress on djangoproject.com, Django packages, and community awareness via talks and events.

Django core

We made a lot of improvements this year. Django forms saw big fixes, which shipped in Django 5.0:

With forms being such a core feature of Django, reused across countless websites, those changes will lead to accessibility improvements across big parts of the web.

The admin interface also saw a lot of fixes and improvements:

Some of those improvements will reflect for everyone, and some will only be beneficial for users of specific assistive technologies, such as Contrast themes in Windows:

→ Screenshot of the admin interface in a “Change redirect” form, in Windows high contrast mode with the “Black” theme.

Can you spot the five issues in this screenshot? Though Contrast Themes isn’t well known, it’s a built-in feature of Windows which is essential for people with low vision. There is a lot of room for improvement to better support it in Django.

We’ve also made a lot of progress on documenting accessibility considerations, though there is still work to be done there:

And finally tooling improvements such as running accessibility checks in the CI pipeline is still a big topic for us, with in-progress efforts to add checks in Selenium tests and standalone with Pa11y.

Django website

In 2023, the website saw its first ever accessibility audit with a focus on the homepage, as well as a good number of accessibility improvements. Those are all very welcome iterative steps in the context of user research on the usability of the website, led by 20tab.

Thank you to our website contributors Sarah Abderemane, Thibaud Colas, ontowhee, Sanyam Khurana, Hana Burtin, Paolo Melchiorre, and Tom Carrick ❤️.

Accessibility in our community

We’re elated to see accessibility being such a prominent topic in our community. In 2023, there were a lot of accessibility talks at Django events. There were accessibility contributors at the sprints for DjangoCon Europe, and DjangoCon US. The #accessibility channel on the Django Discord was also very active, and we got a new Accessibility forum category.

There were a lot of accessibility-focused talks at Django events:

Our very own accessibility team member Sarah Abderemane was also featured on Django Chat: Accessibility - Sarah Abderemane 🎉, while Tom and Thibaud signed up for Djangonaut Space’s first session as navigators.

Behind the scenes, the accessibility team also started maintaining a backlog of django accessibility improvement, and also publish their accessibility team meeting notes on the forum.

Django accessibility in numbers

This year, we were able to produce statistics on the accessibility of Django projects, thanks to reports from the HTTP Archive. There is clear room for improvement, with Django websites generally scoring lower than sites built with other technologies:

→ Median Lighthouse website accessibility score of websites by framework. Source: HTTP Archive cwvtech.report, December 2023. Next.js: 85/100, Rails: 83, “All”: 82.5, Django: 80.5, ASP.NET: 79, Laravel: 78.5.

There is also clear data to establish exactly which accessibility issues are common on Django websites:

→ Difference in Lighthouse audit success rate for sites built with Django vs. average site, HTTP Archive 2023-04-01 data, Django vs. “All”. We see 8 metrics where Django does worse than average, and 8 where it does better.

We see those numbers as a good challenge for the Django community to explore ways in which the framework could be improved. There is clear room for improvement, and we have a lot of ideas on how to go about it.

Accessibility plans for 2024

There are a lot of ways in which the accessibility of Django could be improved in 2024. Here are a few ideas that have been discussed so far, where our accessibility team is looking for help:

  • Django ecosystem accessibility audits: Testing Trac or the Forum; or popular Django packages.
  • An official Django demo site: django-admin-demo with even more features.
  • Stylesheets linting: To catch and fix common issues such as small font sizes or poor focus states.
  • Accessibility in docs: A possible big docs overhaul as a Google Season of Docs project.
  • New, accessible admin components: Addressing big gaps in the admin interface.
  • User testing: Working directly with users of assistive technologies.
  • An official Django accessibility statement: On the website, loud and clear.
New members

With this roadmap of improvements in mind, our accessibility team is looking for six new members in 2024. If this sounds like the type of valuable, high-purpose work you want to contribute to – reach out on the Django Discord in #accessibility, or on the forum.

Thank you

Thank you to everyone who took part in making Django more accessible in 2023 and early 2024. You rock!


Marijke Luttekes

code, tickets
Denis Anuschewski

tickets
Alexander Lazarević

code, tickets
Baptiste Mispelon

reviews
Mike Schem

code
janelle-caktus

talk
Dmitriy Chukhin

tickets, talk
jsuchan-reef

code
Hrushikesh Vaidya

code
Andrew Godwin

reviews
lparsons396

talk
Michael J. Nicholson

talk
Benoît Durand

reviews
Paolo Melchiorre

reviews
Durval Carvalho

code
Scott Cranfill

reviews, talk
yushanfans2233

code
jed212

code
Louis-Cloud

tickets
Chris Frisina

code
laserhyena

code
DaraSilvera-Oct

code, tickets
erosselli

code, tickets
ontowhee

code
Fabian Braun

code, tickets
David Sanders

reviews
Lemuel Sta Ana

code
Coen van der Kamp

code, reviews
Howard Cox

code
Bhuvnesh

reviews
Nina Menezes

code
Cheuk Ting Ho

tickets, code
Mariana

code
Alexander Freyr Lúðvíksson

code
Carlton Gibson

reviews
Nimra

code
Sarah Boyce

reviews
Tushar

code
Demetris Stavrou

code
Hasan Ramezani

code
nessita

reviews
Mariusz Felisiak

reviews
Gregor Jerše

code
David Smith

reviews, code
Sarah Abderemane

code, reviews, talk, tickets
Thibaud Colas

tickets, reviews
Tom Carrick

reviews, code, tickets
You?

Come say hi on the forum
Categories: FLOSS Project Planets

TechBeamers Python: How to Generate Extent Report in Selenium with Python, Java, and C#

Sat, 2024-02-10 16:34

Hello friends, this tutorial provides you with a practical overview of how to generate Extent reports in Selenium with Python, Java, and C#. In this guide, we’ll first explore what is Extent report and what benefits it offers. Both Python and Java provide two distinct ways to generate the Exten reports, so we’ll be covering […]

The post How to Generate Extent Report in Selenium with Python, Java, and C# appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort Lists Alphabetically With Examples

Sat, 2024-02-10 13:39

Sorting lists alphabetically is a common programming task that Python makes simple and efficient. In this tutorial, we will explore various methods to sort lists alphabetically, covering both strings and other data types. Whether you are a beginner or an experienced programmer, this guide will provide you with insights into different sorting techniques in Python. […]

The post Python Sort Lists Alphabetically With Examples appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort Dictionary by Value With Examples

Sat, 2024-02-10 12:44

Sorting a dictionary by its values is a common task in Python programming. In this tutorial, we will explore multiple methods to achieve this, providing you with a solid understanding of how to efficiently sort dictionaries based on their values. By the end of this tutorial, you’ll be equipped with various techniques that you can […]

The post Python Sort Dictionary by Value With Examples appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort List of Numbers or Integers

Sat, 2024-02-10 12:07

Welcome to this Python tutorial where we will explore various methods to sort a list of numbers or integers. Sorting numerical data is a common task in programming, and Python provides multiple efficient approaches to achieve this. By the end of this tutorial, you’ll have a solid understanding of different techniques for sorting lists of […]

The post Python Sort List of Numbers or Integers appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort List of Strings With Examples

Sat, 2024-02-10 12:07

Welcome to this Python tutorial where we will explore various methods to sort a list of strings. Sorting strings is a common task in programming, and Python provides multiple efficient approaches to achieve this. By the end of this tutorial, you’ll have a solid understanding of different techniques for sorting lists of strings in Python, […]

The post Python Sort List of Strings With Examples appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort Using Lambda With Examples

Sat, 2024-02-10 12:07

Sorting is a common operation in programming, and Python provides powerful tools to make it efficient and flexible. In this tutorial, we will focus on sorting using lambda functions in Python. Ther also known as anonymous functions, are concise and convenient for one-time use, making them a perfect fit for sorting tasks. By the end […]

The post Python Sort Using Lambda With Examples appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort Array Values With Examples

Sat, 2024-02-10 07:50

Welcome to this Python tutorial where we will explore various methods to sort array values. Sorting arrays is a fundamental operation in programming, and Python provides multiple approaches to achieve this efficiently. By the end of this tutorial, you’ll be able to learn several techniques to sort array values in Python. It will help you […]

The post Python Sort Array Values With Examples appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort a Dictionary by Key With Examples

Sat, 2024-02-10 07:50

Welcome to this Python tutorial where we will explore different methods to sort a dictionary by its keys. Sorting dictionaries is a common task in programming, and Python provides multiple ways to achieve this. By the end of this tutorial, you’ll have a clear understanding of various approaches to sorting dictionaries and be able to […]

The post Python Sort a Dictionary by Key With Examples appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: Python Sort a List in Descending Order With Examples

Sat, 2024-02-10 07:49

Welcome to this Python tutorial where we will explore various methods to sort a list in descending order. Sorting is a fundamental operation in programming, and Python offers multiple approaches to accomplish this task efficiently. By the end of this tutorial, you’ll have a clear understanding of different techniques for sorting lists in descending order […]

The post Python Sort a List in Descending Order With Examples appeared first on TechBeamers.

Categories: FLOSS Project Planets

Pages