ItsMyCode: [Solved] AttributeError: ‘int’ object has no attribute ‘get’

Planet Python - Wed, 2022-06-22 15:16

The AttributeError: ‘int’ object has no attribute ‘get’ mainly occurs when you try to call the get() method on the integer type. The attribute get() method is present in the dictionary and must be called on the dictionary data type.

In this tutorial, we will look at what exactly is AttributeError: ‘int’ object has no attribute ‘get’ and how to resolve this error with examples.

What is AttributeError: ‘int’ object has no attribute ‘get’?

If we call the get() method on the integer data type, Python will raise an AttributeError: ‘int’ object has no attribute ‘get’. The error can also happen if you have a method which returns an integer instead of a dictionary.

Let us take a simple example to reproduce this error.

# Method return integer instead of dict def fetch_data(): output = 100 return output data = fetch_data() print(data.get("name"))


AttributeError: 'int' object has no attribute 'get'

In the above example, we have a method fetch_data() which returns an integer instead of a dictionary.

Since we call the get() method on the integer type, we get AttributeError.

We can also check if the variable type using the type() method, and using the dir() method, we can also print the list of all the attributes of a given object.

# Method return integer instead of dict def fetch_data(): output = 100 return output data = fetch_data() print("The type of the object is ", type(data)) print("List of valid attributes in this object is ", dir(data))


The type of the object is <class 'int'> List of valid attributes in this object is ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_count', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes'] How to fix AttributeError: ‘int’ object has no attribute ‘get’?

Let us see how we can resolve the error.

Solution 1 – Call the get() method on valid dictionary

We can resolve the error by calling the get() method on the valid dictionary object instead of the integer type.

The dict.get() method returns the value of the given key. The get() method will not throw KeyError if the key is not present; instead, we get the None value or the default value that we pass in the get() method.

# Method returns dict def fetch_data(): output = {"Name": "Audi", "Release_Date": "2022", "Price": "$45000"} return output data = fetch_data() # Get the price of the car print(data.get("Price"))


$45000 Solution 2 – Check if the object is of type dictionary using type

Another way is to check if the object is of type dictionary; we can do that using the type() method. This way, we can check if the object is of the correct data type before calling the get() method.

# Method returns dict def fetch_data(): output = {"Name": "Audi", "Release_Date": "2022", "Price": "$45000"} return output data = fetch_data() # Check if the object is dict if (type(data) == dict): print(data.get("Price"))


$45000 Solution 3 – Check if the object has get attribute using hasattr

Before calling the get() method, we can also check if the object has a certain attribute. Even if we call an external API which returns different data, using the hasattr() method, we can check if the object has an attribute with the given name.

# Method returns dict def fetch_data(): output = {"Name": "Audi", "Release_Date": "2022", "Price": "$45000"} return output data = fetch_data() # Check if the object has get attribute if (hasattr(data, 'get')): print(data.get("Price"))


$45000 Conclusion

The AttributeError: ‘int’ object has no attribute ‘get’ occurs when you try to call the get() method on the integer type. The error also occurs if the calling method returns an integer instead of a dictionary object.

We can resolve the error by calling the get() method on the dictionary object instead of an integer. We can check if the object is of type dictionary using the type() method, and also, we can check if the object has a valid get attribute using hasattr() before performing the get operation.

Categories: FLOSS Project Planets

PyCharm: PyCharm 2022.1.3 Is Out!

Planet Python - Wed, 2022-06-22 15:13

We just released PyCharm 2022.1.3, which provides fixes for the important regressions that appeared in 2022.1 and 2022.1.1.

Please note: If you already have PyCharm 2022.1.2 installed, you will need to update to PyCharm 2022.1.3 manually via the Toolbox App or the website.

Download PyCharm 2022.1.3!

Here’s what we’ve done:

  • Fixed a regression with the debug console that was truncating outputs [PY-53983].
  • Fixed a regression causing .pth files to be ignored inside venv site-packages [PY-54321].
  • Cmd+Click / Ctrl+Click in the Git Log panel has been fixed and now works as expected [IDEA-292405].
  • The New Project button on the Welcome screen is once again working as intended [IDEA-276553].
  • Fixed the issue causing a misleading error message when using $var in the calc() function in SCSS files [WEB-54056].
  • Fixed the issue causing an Unexpected term error when using a variable in a min() and max() arguments list [WEB-52057].

For the full list of bug fixes, please take a look at the release notes. If you notice any bugs, please submit them to our issue tracker.

The PyCharm team

Categories: FLOSS Project Planets

Python Morsels: Appreciating Python's match-case by parsing Python code

Planet Python - Wed, 2022-06-22 14:16

Python's match-case blocks are complex structural pattern matching tools that are often more hassle than they're worth. But they're great for parsing abstract syntax trees.

Table of contents

  1. Why remove dataclasses?
  2. Oh, that's what that tool is for?
  3. Using "or patterns" to match multiple sub-patterns
  4. Conditional patterns with guard clauses
  5. Structural pattern matching visually describes the structure of objects
  6. When writing parsers and matchers, consider match-case

Why remove dataclasses?

First let's briefly talk about why I made this tool.

Why would anyone want to convert a dataclass into "not a dataclass"?

There are trade offs with using dataclasses: performance concerns (which don't usually matter) and edge cases where things get weird (__slots__ and slots=True are both finicky). But my reason for creating this dataclass to regular class converter was to help me better teach dataclasses. Seeing the equivalent code for a dataclass helps us appreciate what dataclasses do for us.

Okay let's dive into match-case.

Oh, that's what that tool is for?

I knew the adventure I …

Read the full article: https://www.pythonmorsels.com/match-case-parsing-python/
Categories: FLOSS Project Planets

Lullabot: Paper Prototyping for Websites and Digital Products

Planet Drupal - Wed, 2022-06-22 12:23

Have you ever spent a lot of time on something for your project, only to throw it away? Often someone else interacts with your work and uncovers something important. Perhaps the issue came from a stakeholder, real users, or the implementation team, and their input is important. But now, you have to go back to the drawing board. We can relate.

Categories: FLOSS Project Planets

Peoples BLOG: Quick reference of Code Reviews for Drupal Application

Planet Drupal - Wed, 2022-06-22 12:15
In this article we are going to see how your Drupal team can do code reviews and available tools or libraries which help people in the team to do the code reviews seamlessly. It’s pretty important to follow a few guidelines as well, so that all people or developers in the team are on the same page. Firstly, for the code reviews to be at their best, the committed code should be more organis
Categories: FLOSS Project Planets

LakeDrops Drupal Consulting, Development and Hosting: ECA rules engine for Drupal: RC1 released

Planet Drupal - Wed, 2022-06-22 11:25
ECA rules engine for Drupal: RC1 released Jürgen Haas Wed, 06/22/2022 - 17:25

A huge milestone for the ECA team has finally being reached: it is available for everyone to give it a try. ECA and its main modeller BPMN.iO are considered stable and ready for testing and almost production ready. This is a big achievement after 11 months and around 3.000 hours of architecting, developing and testing the new rules engine for Drupal 9 and 10.

Categories: FLOSS Project Planets

Real Python: Effective Python Testing With Pytest

Planet Python - Wed, 2022-06-22 10:00

Testing your code brings a wide variety of benefits. It increases your confidence that the code behaves as you expect and ensures that changes to your code won’t cause regressions. Writing and maintaining tests is hard work, so you should leverage all the tools at your disposal to make it as painless as possible. pytest is one of the best tools that you can use to boost your testing productivity.

In this tutorial, you’ll learn:

  • What benefits pytest offers
  • How to ensure your tests are stateless
  • How to make repetitious tests more comprehensible
  • How to run subsets of tests by name or custom groups
  • How to create and maintain reusable testing utilities

Free Bonus: 5 Thoughts On Python Mastery, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.

How to Install pytest

To follow along with some of the examples in this tutorial, you’ll need to install pytest. As most Python packages, pytest is available on PyPI. You can install it in a virtual environment using pip:

PS> python -m venv venv PS> .\venv\Scripts\activate (venv) PS> python -m pip install pytest $ python -m venv venv $ source venv/bin/activate (venv) $ python -m pip install pytest

The pytest command will now be available in your installation environment.

What Makes pytest So Useful?

If you’ve written unit tests for your Python code before, then you may have used Python’s built-in unittest module. unittest provides a solid base on which to build your test suite, but it has a few shortcomings.

A number of third-party testing frameworks attempt to address some of the issues with unittest, and pytest has proven to be one of the most popular. pytest is a feature-rich, plugin-based ecosystem for testing your Python code.

If you haven’t had the pleasure of using pytest yet, then you’re in for a treat! Its philosophy and features will make your testing experience more productive and enjoyable. With pytest, common tasks require less code and advanced tasks can be achieved through a variety of time-saving commands and plugins. It’ll even run your existing tests out of the box, including those written with unittest.

As with most frameworks, some development patterns that make sense when you first start using pytest can start causing pains as your test suite grows. This tutorial will help you understand some of the tools pytest provides to keep your testing efficient and effective even as it scales.

Less Boilerplate

Most functional tests follow the Arrange-Act-Assert model:

  1. Arrange, or set up, the conditions for the test
  2. Act by calling some function or method
  3. Assert that some end condition is true

Testing frameworks typically hook into your test’s assertions so that they can provide information when an assertion fails. unittest, for example, provides a number of helpful assertion utilities out of the box. However, even a small set of tests requires a fair amount of boilerplate code.

Imagine you’d like to write a test suite just to make sure that unittest is working properly in your project. You might want to write one test that always passes and one that always fails:

# test_with_unittest.py from unittest import TestCase class TryTesting(TestCase): def test_always_passes(self): self.assertTrue(True) def test_always_fails(self): self.assertTrue(False)

You can then run those tests from the command line using the discover option of unittest:

(venv) $ python -m unittest discover F. ====================================================================== FAIL: test_always_fails (test_with_unittest.TryTesting) ---------------------------------------------------------------------- Traceback (most recent call last): File "...\effective-python-testing-with-pytest\test_with_unittest.py", line 10, in test_always_fails self.assertTrue(False) AssertionError: False is not true ---------------------------------------------------------------------- Ran 2 tests in 0.006s FAILED (failures=1)

As expected, one test passed and one failed. You’ve proven that unittest is working, but look at what you had to do:

  1. Import the TestCase class from unittest
  2. Create TryTesting, a subclass of TestCase
  3. Write a method in TryTesting for each test
  4. Use one of the self.assert* methods from unittest.TestCase to make assertions

That’s a significant amount of code to write, and because it’s the minimum you need for any test, you’d end up writing the same code over and over. pytest simplifies this workflow by allowing you to use normal functions and Python’s assert keyword directly:

Read the full article at https://realpython.com/pytest-python-testing/ »

[ 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

www @ Savannah: New Article by Richard Stallman

GNU Planet! - Wed, 2022-06-22 09:42

The GNU Education Team has published a new article by Richard Stallman on the threats of Big Tech in the field of education.

Many Governments Encourage Schools to Let Companies Snoop on Students

Human Rights Watch studied 164 software programs and web sites  recommended by various governments for schools to make students use.  It found that 146 of them gave data to advertising and tracking companies.

The researchers were thorough and checked for various snooping methods, including fingerprinting of devices to identify users. The targets of the investigation were not limited to programs and sites specifically “for education;” they included, for instance, Zoom and Microsoft Teams.

I expect that each program collected personal data for its developer. I'm not sure whether the results counted that, but they should. Once the developer company gets personal data, it can provide that data to advertising profilers, as well as to other companies and governments, and it can engage directly in manipulation of students and teachers.

The recommendations Human Rights Watch makes follow the usual approach of regulating the use of data once collected.  This is fundamentally inadequate; personal data, once collected, will surely be misused.

The only approach that makes it possible to end massive surveillance starts with demanding that the software be free. Then users will be able to modify the software to avoid giving real data to companies.

More at gnu/education...

Categories: FLOSS Project Planets

Python for Beginners: Append Dictionary to CSV File in Python

Planet Python - Wed, 2022-06-22 09:00

CSV files are one of the most efficient tools to store structured, tabular data. Sometimes, we might need to append data to the CSV file from a python dictionary. In this article, we will discuss how we can append the values in a dictionary to a CSV file in python. 

Append Dictionary to CSV File Using csv.writer()

You can append a dictionary to CSV file using CSV.writer() method and CSV.writerow() method. For this, we will first open the CSV file in append mode using the open() function. The open() function takes the filename as its first input argument and the literal “a” as its second input argument to denote that the file is opened in the append mode.

After opening the file, we will create a CSV writer object using the CSV.writer() function. The CSV.writer() function takes the file object containing the CSV file as its input argument and returns a writer object. 

After creating the writer object, we will append the dictionary to the CSV file using the writerow() method. The writerow() method, when invoked on a writer object, takes the values in the dictionary as its input argument and appends it to the CSV file.

After execution of the writerow() method, you must close the CSV file using the close() method. Otherwise, the changes won’t be saved in the CSV file. The source code for this approach to append a dictionary to a CSV file is given below.

import csv myFile = open('Demo.csv', 'r+') print("The content of the csv file before appending is:") print(myFile.read()) myDict = {'Roll': 4, 'Name': 'Joel', 'Language': 'Golang'} print("The dictionary is:") print(myDict) writer = csv.writer(myFile) writer.writerow(myDict.values()) myFile.close() myFile = open('Demo.csv', 'r') print("The content of the csv file after appending is:") print(myFile.read())


The content of the csv file before appending is: Roll,Name,Language 1,Aditya,Python 2,Sam, Java 3, Chris, C++ The dictionary is: {'Roll': 4, 'Name': 'Joel', 'Language': 'Golang'} The content of the csv file after appending is: Roll,Name,Language 1,Aditya,Python 2,Sam, Java 3, Chris, C++ 4,Joel,Golang Append Dictionary to CSV File using csv.DictWriter()

Instead of using the csv.writer() method, we can use the csv.DictWriter() function along with the csv.writerow() method to append a python dictionary to csv file. The approach is almost similar to the approach using the csv.writer() method with the following differences.

  • Instead of the csv.writer() method, we will use the csv.DictWriter() method. The DictWriter() method takes the file object containing the csv file as its input argument and returns a DictWriter object.
  • When the writerow() method is executed on the DictWriter object, it takes a dictionary as the input argument instead of the values in the dictionary.

The python code to append a dictionary to a csv file using csv.DictWriter() is as follows.

import csv myFile = open('Demo.csv', 'r+') print("The content of the csv file before appending is:") print(myFile.read()) myDict = {'Roll': 4, 'Name': 'Joel', 'Language': 'Golang'} print("The dictionary is:") print(myDict) writer = csv.DictWriter(myFile, fieldnames=list(myDict.keys())) writer.writerow(myDict) myFile.close() myFile = open('Demo.csv', 'r') print("The content of the csv file after appending is:") print(myFile.read())


The content of the csv file before appending is: Roll,Name,Language 1,Aditya,Python 2,Sam, Java 3, Chris, C++ The dictionary is: {'Roll': 4, 'Name': 'Joel', 'Language': 'Golang'} The content of the csv file after appending is: Roll,Name,Language 1,Aditya,Python 2,Sam, Java 3, Chris, C++ 4,Joel,Golang Conclusion

In this article, we have discussed two ways to append a dictionary to csv file in python. In these approaches, the dictionary will be appended irrespective of whether it has same number of items as compared to the columns in the csv file or it has the same keys as compared to the column names in the csv file. Thus it advised to make sure that the dictionary should have the same number of keys as compared to the columns in the csv file. Also You should make sure that the order of columns of the csv file should be same as the order of the keys present in the dictionary. Otherwise, the data appended to the csv file will become inconsistent and will lead to errors. 

I hope you enjoyed reading this article.To know more about dictionaries in python, you can read this article on dictionary comprehension in python. You might also write this article on list comprehension in python.

Stay tuned for more informative articles.

Happy Learning!

The post Append Dictionary to CSV File in Python appeared first on PythonForBeginners.com.

Categories: FLOSS Project Planets

ANNAI Magazine: Migrating Japanese Digital Agency's website to Drupal: ANNAI's talk at Drupalcon Portland 2022

Planet Drupal - Wed, 2022-06-22 08:51

We gave a talk at Drupalcon Portland 2022 about the Unified Government Website project we have been working on, as well as the migration of the Japanese Digital Agency website to a Headless CMS (Drupal + Next.js) as a feasibility study.

The talk consisted of three parts:

  1. Migration of the Digital Agency website to a headless CMS
  2. Research project for the realisation of a unified government website
  3. The future direction of the project

This blog post describes the first part above.

Categories: FLOSS Project Planets

Talk Python to Me: #370: OpenBB: Python's Open-source Investment Platform

Planet Python - Wed, 2022-06-22 04:00
You may have heard of the Bloomberg terminal. It's expensive software that can monitor and analyze real-time financial market data and place trades on the electronic trading platform. But have you heard of OpenBB? It's similar software for real-time and long term analysis for finance and investing. The difference is it's open source and built entirely with Python and gives you access to analyze a massive amount of real-time and historical data using the full Python data science stack. On this episode, we have one of the cofounders, James Maslek here to give us a look inside this cool piece of Python-based software.<br/> <br/> <strong>Links from the show</strong><br/> <br/> <div><b>James Maslek</b>: <a href="https://www.linkedin.com/in/james-maslek/" target="_blank" rel="noopener">linkedin.com</a><br/> <b>OpenBB</b>: <a href="https://www.openbb.co" target="_blank" rel="noopener">openbb.co</a><br/> <b>OpenBB Feature Gallery</b>: <a href="https://openbb.co/products/terminal" target="_blank" rel="noopener">openbb.co</a><br/> <b>$8.5M seed funding announcement</b>: <a href="https://www.openbb.co/blog/gme-didnt-take-me-to-the-moon-but-gamestonk-terminal-did" target="_blank" rel="noopener">openbb.co/blog</a><br/> <b>How to get rich talk by Naval (less money-focused than the title implies)</b>: <a href="https://www.youtube.com/watch?v=1-TZqOsVCNM" target="_blank" rel="noopener">youtube.com</a><br/> <b>Watch this episode on YouTube</b>: <a href="https://www.youtube.com/watch?v=BbqvRqMbVFU" target="_blank" rel="noopener">youtube.com</a><br/> <b>Episode transcripts</b>: <a href="https://talkpython.fm/episodes/transcript/370/openbb-pythons-open-source-investment-platform" 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 Twitter</b>: <a href="https://twitter.com/talkpython" target="_blank" rel="noopener">@talkpython</a><br/> <b>Follow Michael on Twitter</b>: <a href="https://twitter.com/mkennedy" target="_blank" rel="noopener">@mkennedy</a><br/></div><br/> <strong>Sponsors</strong><br/> <a href='https://talkpython.fm/sentry'>Sentry Error Monitoring, Code TALKPYTHON</a><br> <a href='https://talkpython.fm/python-at-scale'>Python at Scale</a><br> <a href='https://talkpython.fm/assemblyai'>AssemblyAI</a><br> <a href='https://talkpython.fm/training'>Talk Python Training</a>
Categories: FLOSS Project Planets

Python Anywhere: Anaconda Acquisition FAQs

Planet Python - Tue, 2022-06-21 20:00
In June 2022, Anaconda announced its acquisition of PythonAnywhere. This acquisition expands Python team collaboration in the cloud and adds capabilities designed to unite teams and create access to more robust cloud resources. We’ve compiled the following list of frequently asked questions to aid users in navigating the transition. – Will this affect my PythonAnywhere account? For now, it won’t! There are no plans to change PythonAnywhere user accounts, and you can continue to use yours as usual without interruption.
Categories: FLOSS Project Planets

FSF Events: Free Software Directory on IRC: Friday, June 24 starting at 12:00 p.m. EDT (14:00 UTC)

GNU Planet! - Tue, 2022-06-21 16:34
Join the FSF and friends Friday, June 24, from 12:00 p.m. to 3 p.m. EDT (14:00 to 17:00 UTC) to help improve the Free Software Directory.
Categories: FLOSS Project Planets

PyCoder’s Weekly: Issue #530 (June 21, 2022)

Planet Python - Tue, 2022-06-21 15:30

#530 – JUNE 21, 2022
View in Browser »

Objects, Functions, Generators, and Coroutines

Although different concepts, objects, functions, generators, and coroutines can be used almost interchangeably because of Python’s dynamic nature. Learn more about how these mechanisms are related and how to switch between them.

Combining Data in pandas With concat() and merge()

In this video course, you’ll learn two techniques for combining data in pandas: merge() and concat(). Combining Series and DataFrame objects in pandas is a powerful way to gain new insights into your data.

ButterCMS Melts Into Your Python app. Try the #1 Headless CMS for Python and Django

ButterCMS is your content backend. Enable your marketing team to update website + app content without bothering you. Try the #1 rated Headless CMS for Python today. Free for 30 days →

Getting Lazy With Python Imports and PEP 690

Talk Python interviews all three authors involved in PEP 690, a proposal to add the ability to delay library importation until time of use.

Django CMS Fellowship Program: Apply Now


DjangoCon Europe Call for Hosting Proposals for 2023


PyOhio Talks Announced; Free Registration; Streams July 30


Discussions Most Common Issue You Have Coding With Python?


What’s a Powerful Python Feature That Not Many People Use?


Python Jobs Senior Python Software Engineer (San Francisco, CA, USA)


Senior Full-Stack Web Developer (Anywhere)


Backend Software Developer (Draper, UT, USA)


Gameful Learning Developer (Ann Arbor, MI, USA)

University of Michigan

Python Technical Architect (USA)


Software Engineer (Los Angeles or Dallas) (Los Angeles, CA, USA)

Causeway Capital Management LLC

DevOps Engineer (Ann Arbor, MI, USA)

University of Michigan

Academic Innovation Developer (Ann Arbor, MI, USA)

University of Michigan

Software Development Lead (Ann Arbor, MI, USA)

University of Michigan

Principal Python Engineer (100% Remote) (San Francisco, CA, USA)


More Python Jobs >>>

Articles & Tutorials Build Your Python Project Documentation With MkDocs

In this tutorial, you’ll learn how to build professional documentation for a Python package using MkDocs and mkdocstrings. These tools allow you to generate nice-looking and modern documentation from Markdown files and, more importantly, from your code’s docstrings.

Getting the Stack Trace of a Running Python Program

“I recently wanted to examine a multi-threaded Python program, which took a long time to complete, appeared to be stuck, and even crashed occasionally. I was hoping to get the stack trace.” Peter shares the code that solved his problem and how to test with it.

Connect, Integrate, & Automate Your Data—From Python, or Any Other Application or Tool

CData makes it easier to unlock the value of data — simplifying connectivity between applications and data sources. Our SQL-based connectors streamline data access making it easy to access real-time data from on-premise and cloud databases, SaaS, APIs, NoSQL and more. Visit cdata.com to learn more →

Getting Started in Python Cybersecurity and Forensics

Are you interested in a career in security using Python? Would you like to stay ahead of potential vulnerabilities in your Python applications? This week on the show, James Pleger talks about Python information security, incident response, and forensics.

Tools To Visualize Your Data and System State

This overview covers a variety of tools for visualizing data formats such as JSON, regexes, SQL, and Git history. If that’s not enough, it then goes on to describe tools to better understand your Docker and Kubernetes configurations.

Python Logging: Do’s and Don’ts

Python’s logging library can be a daunting to new users, with lots of options and configuration. Learn more about some key things you should and shouldn’t do when using logger.

Utilising Caching in Your Django Applications

Minimizing the number of database calls can have significant performance impacts. Learn about select_related and prefetch_related and how they can improve your Django code.

Illustrating the Duality of Closures and Objects

In functional programming languages, closures are used for similar purposes to classes in object oriented languages. Python supports both, learn more about how they compare.

Get Started With This PyCharm Debugging Tutorial From Rookout

Need to hit the ground running with a new app in a cool IDE? This tutorial will cover an example of debugging Python in PyCharm, the pros and cons of “remote debugging,” and where a tool like Rookout fills in the gaps on syncing with source code.
ROOKOUT sponsor

Create Dashboards From Jupyter Notebooks

This article shows you how to transform a Jupyter Notebook with stock information into a web-based dashboard using the Mercury framework.

A Beginner’s Guide to CI/CD and Automation on GitHub

“CI/CD and workflow automation are native capabilities on GitHub platform. Here’s how to start using them and speed up your workflows.”

Projects & Code onto_merger: Deduplicate Knowledge Graph Nodes

GITHUB.COM/ASTRAZENECA • Shared by Benedek Rozemberczki

deny: Python Authorization Library


Task Queues: List of Task Queues and Message Brokers


pedalboard: Audio Effects Library


euchre: Interactive, Text-Based Euchre Game in Python


Events GeoPython 2022

June 20 to June 23, 2022

Weekly Real Python Office Hours Q&A (Virtual)

June 22, 2022

PyKla Monthly Meetup

June 22, 2022


June 22, 2022

PythOnRio Meetup

June 25, 2022

PyCon Israel 2022

June 28 to June 30, 2022

(Hybrid) a Deep Dive Into Containerized Model Serving With FastAPI

June 28, 2022

Happy Pythoning!
This was PyCoder’s Weekly Issue #530.
View in Browser »

[ Subscribe to 🐍 PyCoder’s Weekly 💌 – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]

Categories: FLOSS Project Planets

Community Working Group posts: Code of Conduct team update: June 15, 2022

Planet Drupal - Tue, 2022-06-21 14:53

As previously reported, the Community Health Team has started to have regular, bi-weekly meetings in an effort to develop and update the Code of Conduct for the Drupal community.

Community Health Team members present at this week's meeting were

The main goal for this meeting was to get status updates from all tasks discussed at the previous meeting in an effort to better understand the Code of Conduct landscape in other communities. In addition, some updates were provided related to identifying other community stakeholders in the overall process of updating our Code of Conduct.

The following Codes of Conduct were reviewed by individual team members and discussed during the meeting:

Much of the discussion was related to how each Code of Conduct provided examples of negative and/or positive behaviors and the pros and cons of each approach. The level of prescription for infractions was also a common thread in the discussion, including how some CoCs provide very clear and precise guidance while others (like the current Drupal Code of Conduct) provide a great deal of leeway to those responsible for enforcement.

We also discussed the fact that many CoCs are not stand-alone documents, but rely on supporting documents, much like the Drupal Values and Principles.

Finally, a number of Drupal-related groups and individuals have confirmed their willingness to provide feedback to this effort as the process proceeds. If you, or a Drupal-related group, is interested in being part of this process, please let us know at drupal-cwg at drupal dot org.

Categories: FLOSS Project Planets

Evolving Web: Drupal 9.4.0 Is Out: Here’s All You Need to Know

Planet Drupal - Tue, 2022-06-21 14:05

Drupal 9.4.0 was released on June 15, bringing us some highly anticipated updates. We discussed some of these latest improvements—and some other ones still in development—in an article about how to get ready for Drupal 10, scheduled to be released in December. Here, we'll roll out what's available for developers right now with the launch of Drupal 9.4.0.

Default Front-End Theme: Olivero

The most accessible Drupal theme to date, Olivero is WCAG AA compliant right out of the box. It uses a design system carefully designed to be both accessible and beautiful, with a simple, high-contrast colour palette, ample whitespace, and sparing use of effects like drop shadows and gradients. The Olivero theme is also built for optimal compatibility with Drupal's current site building features.

Olivero is named after Rachel Olivero, who passed away in 2019 at the age of 36. Rachel was a long-time member of the Drupal community, bringing her expertise and advocacy for technology accessibility from her work with the National Federation of the Blind and her life experience.

A New Default Back-End Theme: Claro

Site builders, administrators, and content creators get a shiny new theme as well. Claro is now stable and officially the default theme for the Drupal admin.

The Claro admin theme uses a new design system created to be user-friendly and significantly more accessible than prior themes. It is visually simple and features a high-contrast colour palette, minimalist iconography, and carefully designed visual cues emulating physical properties like depth and shadows.

New Experimental Starterkit Theme and Generator

It's here! The new Starterkit theme and theme generator is now available on an experimental basis in Drupal core.

The Starterkit theme is essentially the same as Classy and provides the same markup to get themers started. The Starterkit theme generator, however, marks a major shift in how Drupal themes work in production.

Historically, we've started with a base theme, like Classy, and created a subtheme to run on top of that with our customizations. At runtime, the production theme would grab the code from the base theme and add its own modifications. That gave us the benefit of letting the base theme do the heavy lifting of Drupal-specific markup, basic responsiveness, and other infrastructure, while our subthemes provided our unique design and functionality.

The drawback of this approach, however, is that any change to the base theme risks creating errors in subthemes. This risk has resulted in stagnation between major versions, due to an inability to make iterative changes to base themes like Classy.

With the Starterkit theme generator, an independent copy of the base theme is created to serve as a starting point for the custom theme. By removing runtime inheritance, the core Starterkit theme can be updated with minor releases without the risk of disrupting production themes.

UI Performance Boost: Lazy Image Loading

At long last, Drupal core includes an image field configuration option for lazy loading. If you are not familiar with lazy loading, it means that instead of all the images on an entire page loading at once, images further down the page only load when and if they are needed.

With lazy loading, an image-heavy page is ready to use much more quickly than it would be if all images were loaded at once. This improves engagement and makes pages more accessible to users relying on slow, unreliable, or expensive data connections.

Pain Relief: Easier Permissions Management

Administrators can now configure permissions in-context for content types, vocabularies, and other entity bundles via a "Manage permissions" tab. Previously, they had to go into the sitewide Roles and Permissions, causing potential confusion and errors.

Better Security: Patch-Level Composer Dependency Updates

With Drupal 9.4, site owners using drupal/core-recommended are now able to apply patch-level updates for Composer dependencies. This allows them to apply Composer dependency security updates as they are released, rather than waiting for an update to Drupal core.

This is accomplished with a small change to the code in drupal/core-recommended, which now allows patches to be installed until they reach the next minor version. For example, a dependency constraint set to a patch version 3.2.6 can now be updated through 3.2.9 without waiting for a new Drupal core release.

It's Time to Get Your Migration Going

If you're still running on Drupal 7, you are missing out on the best Drupal has to offer. Today's Drupal is more flexible, more secure, more accessible, more user-friendly, and much more powerful than the Drupal of 2011. Also, Drupal 7 end of life is closing in, so migrating now is the best way to go to ensure your Drupal-based websites are fully supported.

However, we know migrating can be a daunting task, so we're here to help. Check out a few resources to help you get started!

👩‍💻 Still think you need support for your Drupal migration? Get in touch!

+ more awesome articles by Evolving Web
Categories: FLOSS Project Planets

OpenUK Awards 2022

Planet KDE - Tue, 2022-06-21 13:27
OpenUK is the non-profit body which promotes Open tech in the UK.

Nominations are now open for the OpenUK Awards 2022.

We’ve run our annual awards ceremony to recognise great Open tech contributions for the last two years with great success and this year nominations are open for you to join or point is to the best people, organisations and projects that need rewarded.

Two years ago it we had dinner sent to your door during Covid. Last year we dined at the centre of the world at COP26. This year we’re Lording it up with a ceremony and dinner in the House of Lords on 30 November.

House of Commons

Last week we had a preview of the event, a delayed Burns supper in the House of Commons. One of the wonderful aspects of Open tech is how it gets you to exciting places and meet interesting people. In this case SNP MPs hosted and we got to promote KDE and tech freedom.

So please nominate yourself, your project, your company or your org. Or if you know someone else who should be nominated go and nominate them. We have three fine judges lined up who will go over the entries so remember to give a good writeup of what the work done is and why it deserves recognition along with links to code repos etc so we can research it.

Categories are: software, sustainability, data, belonging, young person, finance, individual, hardware and security.

Nominate now. And take a look at the 2021 OpenUK awards for more inspiration.

Categories: FLOSS Project Planets

Louis-Philippe Véronneau: Montreal's Debian & Stuff - June 2022

Planet Debian - Tue, 2022-06-21 13:15

As planned, we held our second local Debian meeting of the year last Sunday. We met at the lovely Eastern Bloc (an artists' hacklab) to work on Debian (and other stuff!), chat and socialise.

Although there were fewer people than at our last meeting1, we still did a lot of work!

I worked on fixing a bunch of bugs in Clojure packages2, LeLutin worked on podman and packaged libinfluxdb-http-perl and anarcat worked on internetarchive, trocla and moneta. Olivier also came by and worked on debugging his Kali install.

We are planning to have our next meeting at the end of August. If you are interested, the best way to stay in touch is either to subscribe to our mailing list or to join our IRC channel (#debian-quebec on OFTC). Events are also posted on Quebec's Agenda du libre.

Many thanks to Debian for providing us a budget to rent the venue for the day and for the pizza! Here is a nice picture anarcat took of (one of) the glasses of porter we had afterwards, at the next door brewery:

  1. Summer meetings are always less populous and it also happened to be Father's Day... 

  2. #1012824, #1011856, #1011837, #1011844, #1011864 and #1011967

Categories: FLOSS Project Planets