FLOSS Project Planets

Real Python: Single and Double Underscores in Python Names

Planet Python - Wed, 2023-11-29 09:00

Python has a few important naming conventions that are based on using either a single or double underscore character (_). These conventions allow you to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.

Following and respecting these conventions allows you to write code that looks Pythonic and consistent in the eyes of other Python developers. This skill is especially useful when you’re writing code that’s intended for other developers to work with.

In this tutorial, you’ll:

  • Learn about Python naming conventions that rely on using underscores (_)
  • Differentiate public and non-public names by using a single leading underscore
  • Use double leading underscores to leverage name mangling in Python classes
  • Explore other common uses of underscores in Python names

To get the most out of this tutorial, you should be familiar with Python variables, constants, functions, modules, and especially classes and object-oriented programming.

Get Your Code: Click here to download the free sample code that shows you how to use single and double underscores in Python names.

Public Interfaces and Naming Conventions in Python

As a Python programmer, you’ll frequently work with public interfaces, or application programming interfaces (API). An API is a type of programming interface that offers a service to other parts of a program or other programs.

For example, the Python standard library has many modules and packages that provide certain services. To use these modules and packages, you need to access their public components, such as classes, functions, variables, constants, and modules. All these objects are part of the module or package’s public interface. They’re available for you to use directly in your code.

However, many of these packages and modules define objects that aren’t intended for direct access. These objects are for the internal use of the specific package or module only. They’re not part of its public interface.

In the context of object-oriented programming, languages like C++ and Java have the notion of public and private methods and attributes. In these languages, you can use these types of class members as follows:

  • Public: You can use them in your own code or client code.
  • Private: You can use them only from inside the defining class and its subclasses.

These languages have specific keywords and syntax to define public and private members in their classes. Once you declare a member as private, you can’t use it outside the class because the language restricts access. So, private members aren’t part of the class’s public interface, and there’s no way to access them.

In contrast, Python doesn’t have the notion of public and private members. It has neither dedicated keywords nor syntax for defining them. So, you can always access the members of a Python class.

If Python doesn’t have a specific syntax to define when an object is part of a public interface, then how do you tell your users that they can or can’t use a given class, method, function, variable, constant, or even module in their code?

To approach this question, the Python community has well-established naming conventions. You should observe these naming conventions to explicitly indicate whether other developers should directly use your variables, constants, functions, methods, and modules in external code.

Note that the naming conventions don’t restrict access to objects. They’re just a warning to other developers using your code. Because of this, Python doesn’t use the terms public and private. Instead, it uses the terms public and non-public.

In Python, if a name starts with a letter in uppercase or lowercase, then you should consider that name public and, therefore, part of the code’s API. In contrast, if a name starts with an underscore character (_), then you should consider that name non-public, meaning it’s not a part of the code’s API.

The Python community uses the underscore character (_) as part of other naming conventions. Here’s a summary of what PEP 8 says about using this character in names:

Convention Example Meaning Single leading underscore _variable Indicates that the name is meant for internal use only Single trailing underscore class_ Avoids naming conflicts with Python keywords and built-in names Double leading underscore __attribute Triggers name mangling in the context of Python classes Double leading and trailing underscore __name__ Indicates special attributes and methods that Python provides Single underscore _ Indicates a temporary or throwaway variable

Note that only two of these conventions enforce specific Python behaviors. Using double leading underscores triggers name mangling in Python classes. You’ll learn more about this behavior in the section on name mangling.

Additionally, those names with double leading and trailing underscores that are listed in the Python data model trigger internal behaviors in specific contexts. You’ll also learn more about this topic in the section on dunder names in Python.

Note: Python gives special treatment to the single underscore (_), but only within match … case statements. You’ll learn more about this later.

In the following section, you’ll learn more about using a single leading underscore when naming your Python objects.

Single Leading Underscore in Python Names Read the full article at https://realpython.com/python-double-underscore/ »

[ 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

Jonathan Dowland: Useful vim plugins: AnsiEsc

Planet Debian - Wed, 2023-11-29 05:50

Sometimes I have to pore over long debugging logs which have originally been written out to a terminal and marked up with colour or formatting via ANSI escape codes. The formatting definitely makes reading them easier, but I want to read them in Vim, rather than a terminal, and (out of the box) Vim doesn't render the formatting.

Cue AnsiEsc.vim: an OG Vim script1 that translates some ANSI escape codes — in particular some colour specifying ones — into Vim syntax highlighting.

This makes viewing and navigating around multi-MiB console log files much nicer.

  1. AnsiEsc is old enough to have been distributed as a script, and then as a "vimball", an invention of the same author to make installing Vim scripts easier. It pre-dates the current fashion for plugins, but someone else has updated it and repackaged it as a plugin. I haven't tried that out.
Categories: FLOSS Project Planets

Gocept Weblog: The final teardown

Planet Python - Wed, 2023-11-29 05:13

After writing so many teardowns in tests for software projects for customers, open source projects and in house software, it is now time for the gocept folks to finally work on a last teardown of the company itself. After 23 years of existence gocept will close the doors and stop operating business at 2023-11-30. The developers found a new home at the wonderful company Minddistrict. There we will work in a product team and build software to empower people to take care of their mental well-being.

Customers

We want to thank all our customers for their trust in us over the years and for the often multi year long collaboration. Sometimes gocept was a bit on the bleeding edge of technology and often that was shining through in the development work. But we did our best to provide the individual software applications to the needs of our customers.

Open Source Software

It was in the very essence of gocept to work with open source software. The company grew with Zope and contributed to the Zope ecosystem. Out of this relationship many events were supported like DZUG-Tagung, a EuroPython Conference and in particular in the last years a round of Zope sprint to ensure compatibility and stability in the Python 3 wonderland. We are very happy, that Minddistrict also builds its core product on zope.* packages and that we can further contribute to the open source world.

Most of the gocept.* packages on https://github.com/gocept have been archived or given to the people and companies, that still use them. In case you need to work with them, please contact mail@gocept.com or the respective maintainers on PyPI. We will be able to unarchive the package and if necessary transfer the release rights.

gocept folks

Some parts of gocept already left the company in 2014 and formed https://flyingcircus.io/. They are more successful than ever providing a very good and individual hosting and, more important, operation solutions for bigger applications and complex setups. They took over the dedication to software and to new technology, and they are good colleagues to work with.

The remaining 4 developers at gocept join the Minddistrict company and will work there in a bigger team to empower people to take care of their mental well-being in the Netherlands, in Germany and the DACH-region. We will still keep an office in Halle, so there might be a chance to stop by.

The last Christian of gocept (in a row of many) will continue his management work within the Saltlabs and the Koffij – with the mission to develop modern, contemporary and flexible workplaces in Halle and build communities that motivate and offer pleasant working environments.

gocept.cleanup()

In case you need anything or want to reach us, please find us on GitHub (or the place to be in the future) or write an email to mail@gocept.com.

Categories: FLOSS Project Planets

LN Webworks: Google Tag Manager With Drupal : All You Need to Know

Planet Drupal - Wed, 2023-11-29 05:12

Maximizing website engagement and interactivity is a major goal of all marketers. However, the management of multitudinous third-party integrations and tracking tools is a laborious task. Gladly, Google created Google Tag Manager to simplify the complicated lives of marketing teams worldwide. It makes managing, upgradation, and tracking of tags, snippets, and third-party integrations a piece of cake for them.

The best part is that this platform is intuitive and user-friendly which contributes a fair share in its massive appeal. If you own a Drupal website and wonder how to use Google Tag Manager with Drupal like many others, this blog is all you need. It elucidates everything in a detailed yet simplified manner.

First, let’s delve into what Google Tag Manager is and what makes it special.

Categories: FLOSS Project Planets

KDE's 6th Megarelease - Beta 1

Planet KDE - Tue, 2023-11-28 19:00
En route to the new Plasma, Frameworks and Gear

Every few years we port the key components of our software to a new version of Qt, taking the opportunity to remove cruft and leverage the updated features the most recent version of Qt has to offer us.

It has been nearly 10 years since the last big release of our flagship Plasma desktop environment, and the time has come again. KDE is making available today the Beta version of all the software we will include in a megarelease scheduled for the end of February 2024.

To ensure all parts of KDE's software stack are working together, we are releasing all our major bundles at the same time. Today sees the continuation of that journey with the Beta releases of Plasma 6, KDE Frameworks 6 and the KDE Gear bundle of apps.

This is a very early preview intended for developers and testers only. We hope it will be picked up by rolling unstable distros, but it is far from being ready for day-to-day use yet.

Read on to find out more about KDE's 6th Megarelease, what it covers, and how you can help make the new versions of Plasma, KDE's apps and Frameworks a success now.

Plasma

Plasma is KDE's flagship desktop environment. Plasma is like Windows or macOS, but is renowned for being flexible, powerful, lightweight and configurable. It can be used at home, at work, for schools and research.

Plasma 6 is the upcoming version of Plasma that integrates the latest version of Qt, Qt 6, the framework upon which Plasma is built.

Plasma 6 incorporates new technologies from Qt and other constantly evolving tools, providing new features, better support for the latest hardware, and supports for the hardware and software technologies to come.

You can be part of the new Plasma. Download and install a Plasma 6-powered distribution (like Neon Unstable) to a test machine and start trying all its features. Check the Contributing section below to find out how you can deliver reports of what you find to the developers.

KDE Gear

KDE Gear is a collection of applications produced by the KDE community. Gear includes file explorers, music and video players, text and video-editors, apps to manage social media and chats, email and calendaring applications, travel assistants, and much more.

Developers of these apps also rely on the Qt toolbox, so most of the software will also be adapted to use the new Qt6 toolset and we need you to help us test them too.

Frameworks

KDE's Frameworks add tools created by the KDE community on top of those provided by the Qt toolbox. These tools give developers more and easier ways of developing interfaces and functionality that work on more platforms.

Among many other things, KDE Frameworks provide

  • widgets (buttons, text boxes, etc.) that make building your apps easier and their looks more consistent across platforms, including Windows, Linux, Android and macOS
  • libraries that facilitate storing and retrieving configuration settings
  • icon sets, or technologies that make the integration of the translation workflow of applications easier

KDE's Frameworks also rely heavily on Qt and will also be upgraded to adapt them to the new version 6. This change will add more features and tools, enable your applications to work on more devices, and give them a longer shelf life.

Contributing

KDE relies on volunteers to create, test and maintain its software. You can help too by...

  • Reporting bugs -- When you come across a bug when testing the software included in this Alpha Megarelease, you can report it so developers can work on it and remove it. When reporting a bug
    • make sure you understand when the bug is triggered so you can give developers a guide on how to check it for themselves
    • check you are using the latest version of the software you are testing, just in case the bug has been solved in the meantime
    • go to KDE's bug-tracker and search for your bug to make sure it does not get reported twice
    • if no-one has reported the bug yet, fill in the bug report, giving all the details you think are significant.
    • keep tabs on the report, just in case developers need more details.
  • Solving bugs -- Many bugs are easy to solve. Some just require changing a version number or tweaking the name of a library to its new name. If you have some basic programming knowledge of C++ and Qt, you too can help carry the weight of debugging KDE's software for the grand release in February.
  • Joining the development effort -- You may have a deeper knowledge development, and would like to contribute to KDE with your own solutions. This is the perfect moment to get involved in KDE and contribute with your own code.
  • Donating to KDE -- Creating, debugging and maintaining the large catalogue of software KDE distributes to users requires a lot of resources, many of which cost money. Donating to KDE helps keep the day-to-day operation of KDE running smoothly and allows developers to concentrate on creating great software. KDE is currently running a drive to encourage more people to become contributing supporters, but you can also give one-time donations if you want.
A note on pre-release software

Pre-release software is only suited for developers and testers. Alpha/Beta/RC software is unfinished, will be unstable and will contain bugs. It is published so volunteers can trial-run it, identify its problems, and report them so they can be solved before the publication of the final product.

The risks of running pre-release software are many. Apart from the hit to productivity produced by instability and the lack of features, the using pre-release software can lead to data loss, and, in extreme cases, damage to hardware. That said, the latter is highly unlikely in the case of KDE software.

The version of the software included in KDE's 6th Megarelease is beta software. We strongly recommend you do not use it as your daily driver.

If, despite the above, you want to try the software distributed in KDE's 6th Megarelease, you do so under your sole responsibility, and in the understanding that the main aim, as a tester, you help us by providing feedback and your know-how regarding the software. Please see the Contributing section above.

Categories: FLOSS Project Planets

Dirk Eddelbuettel: RcppSimdJson 0.1.11 on CRAN: Maintenance

Planet Debian - Tue, 2023-11-28 17:57

A new maintenance release 0.1.11 of the RcppSimdJson package is now on CRAN.

RcppSimdJson wraps the fantastic and genuinely impressive simdjson library by Daniel Lemire and collaborators. Via very clever algorithmic engineering to obtain largely branch-free code, coupled with modern C++ and newer compiler instructions, it results in parsing gigabytes of JSON parsed per second which is quite mindboggling. The best-case performance is ‘faster than CPU speed’ as use of parallel SIMD instructions and careful branch avoidance can lead to less than one cpu cycle per byte parsed; see the video of the talk by Daniel Lemire at QCon.

This release responds to a CRAN request to address issues now identified by -Wformat -Wformat-security. These are frequently pretty simple changes as it was here: all it took was an call to compileAttributes() from an updated Rcpp version which now injects "%s" as a format string when calling Rf_error().

The (very short) NEWS entry for this release follows.

Changes in version 0.1.11 (2023-11-28)
  • RcppExports.cpp has been regenerated under an update Rcpp to address a print format warning (Dirk in #88).

Courtesy of my CRANberries, there is also a diffstat report for this release. For questions, suggestions, or issues please use the issue tracker at the GitHub repo.

If you like this or other open-source work I do, you can now sponsor me at GitHub.

This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.

Categories: FLOSS Project Planets

Zero to Mastery: Python Monthly Newsletter 💻🐍

Planet Python - Tue, 2023-11-28 16:43
48th issue of Andrei Neagoie's must-read monthly Python Newsletter: Python 3.12 is Out, CLI Tools With Python, Career Advice, and much more. Read the full newsletter to get up-to-date with everything you need to know from last month.
Categories: FLOSS Project Planets

FSF News: Worldwide community of activists protest OverDrive and others forcing DRM upon libraries

GNU Planet! - Tue, 2023-11-28 16:22
BOSTON, Massachusetts, USA -- Tuesday, November 28, 2023 -- The Free Software Foundation (FSF) has announced its Defective by Design campaign's 17th annual International Day Against DRM (IDAD). It will protest uses of Digital Restrictions Management technology's hold over public libraries around the world, exemplified by corporations like OverDrive and Follett Destiny. IDAD will take place digitally and worldwide on December 8, 2023.
Categories: FLOSS Project Planets

Steinar H. Gunderson: Framework debt

Planet Debian - Tue, 2023-11-28 14:34

Today's shower thought:

Taking on a dependency is assuming some amount of technical debt. Using a framework is taking on a dependency that is very hard to get rid of.

(All the usual properties of technical debt, positive and negative, apply)

Categories: FLOSS Project Planets

PyCoder’s Weekly: Issue #605 (Nov. 28, 2023)

Planet Python - Tue, 2023-11-28 14:30

#605 – NOVEMBER 28, 2023
View in Browser »

Inline Dependencies for Small Python Scripts

Sabs wanted the ability to specify dependencies inside a single Python script, and although there are PEPs on this topic, their implementation is a ways off. Sabs decided to solve this problem directly: introducing pip.wtf a code snippet you copy into your script that does dependency loading through a function call.
PIP.WTF

Build Conway’s Game of Life With Python

In this step-by-step project, you’ll implement Conway’s Game of Life in Python. To make the game usable, you’ll create a user-friendly command-line interface (CLI) with several options that will allow you to run the game using different life patterns and configurations.
REAL PYTHON

Master Python With Pybites PDM 🚀

Are you stuck in tutorial paralysis? Crush imposter syndrome with the 12-week Pybites PDM Program. Learn advanced Python, build impactful real world apps, and get 1:1 mentorship. Stand out in tech interviews and elevate your developer journey. Join a thriving Python community. Enroll today! 🐍👩‍💻
PYBITES sponsor

The Categories of Bugs in Python Apps

This article categorizes errors in your Python code into three groups: type-checking, import explosions, and runtime errors. Learn how each is treated differently and how to better handle them in your programs.
TIN

Django Ninja 1.0 Released

DJANGO-NINJA.DEV

Python 3.13.0 Alpha 2 Is Now Available

CPYTHON DEV BLOG

Django 5.0 Release Candidate 1 Released

DJANGO SOFTWARE FOUNDATION

Discussions What’s the Coolest Thing You’ve Done With Python?

REDDIT

What’s It Like to Maintain an OSS Fork at Work?

LOBSTE.RS

Python Jobs Software Engineer - Intern (Summer 2024) (Dallas, TX, USA)

Causeway Capital Management

More Python Jobs >>>

Articles & Tutorials How to Render Markdown in a Django Application

In this tutorial, you’ll learn how to create and render web content in Django with the simplicity and flexibility of the Markdown text formatting language.
REAL PYTHON

10 Truths They Won’t Tell You About a Software Job

This opinion piece from Mensur addresses the wide gulf between what is learned in school and what is encountered in real world software development. He mentions topics ranging from the frequency of dealing with legacy code, to the reality of meetings and estimates. Associated HN discussion.
MENSUR DURAKOVIC

A Disorganized List of Maintainer Tasks

David is the maintainer of Flask and this list shows all that entails. Some things are obvious and others are things you might not be aware of. If you’re participating in the OSS community, it is good to know what is on here, if you just use libraries, appreciate all the work being done!
DAVID LORD

One Liners Python Edition

A collection of single-line Python snippets that cover common tasks in programming. Includes removing duplicates from lists, reversing strings, finding the most common element in a list, and much more.
MUHAMMAD RAZA

The Radiating Programmer

Love them or hate them, the daily stand-up is out there. It may have problems, but at its core, the three mains questions (what did you do? what are you planning? what is blocking you?) provide a tool for radiating information, and at core that’s a good idea.
JORGE MANRUBIA

Fixit 2: Meta’s Next-Generation Auto-Fixing Linter

Meta has a large collection of plug-ins for linting, which makes some of the usual solutions problematic at scale. This article introduces Fixit 2, an open source, pluggable linter.
AMETHYST REESE

Beginners Should Use Django, Not Flask

This opinion piece by Bite Code states why developers new to the web space should use Django, even though Flask has the simpler “hello world” which makes it attractive.
BITE CODE

Error Culture

This multi-part post talks about how getting notified about all errors leads to error fatigue from false positives and a culture where errors get ignored. Long term this can have disastrous consequences.
RYAN CHELEY

Python Basics Exercises: Modules and Packages

In this video course, you’ll practice separating your code into modules, using the import statement to access another module’s namespace, and creating Python packages.
REAL PYTHON course

How to Write Efficient Python Code: A Tutorial for Beginners

Are you a programmer looking to get better at Python? Learn some of Python’s features that’ll help you write more elegant and Pythonic code.
BALA PRIYA C • Shared by Bala Priya C

The Changing “Guarantees” Given by Python’s GIL

This article covers the changes the Global Interpreter Lock has undergone since Python 3.9 and how that impacts the assumptions you can make in your code.
STEFAN MARR

11 Fun Python Libraries to Make Your Day Better

This article covers 11 libraries that the author had fun playing with, including PyGame, Asciimatics, Arcade, and more.
MARINE GOSSELIN

datetime.utcnow() Is Now Deprecated

Python 3.12 has deprecated utcnow() and utcfromtimestamp(). This article covers why and what to use instead.
MIGUEL GRINBERG

Projects & Code Simple Async Queue

SAQ-PY.READTHEDOCS.IO • Shared by Nickolas Grigoriadis

toga: A Python Native, OS Native GUI Toolkit

GITHUB.COM/BEEWARE

lato: Microframework for Modular Monoliths

GITHUB.COM/PGORECKI

hexabyte: A Modern, Modular, and Robust TUI Hex Editor

GITHUB.COM/THETACOM

error-links: Add Links to Search Google to Your Tracebacks

GITHUB.COM/RODRIGOGIRAOSERRAO • Shared by Rodrigo Girão Serrão 🐍🚀

Events Weekly Real Python Office Hours Q&A (Virtual)

November 29, 2023
REALPYTHON.COM

SPb Python Drinkup

November 30, 2023
MEETUP.COM

PyLadiesCon 2023

December 2 to December 4, 2023
PYLADIES.COM

XtremePython 2023

December 5 to December 6, 2023
XTREMEPYTHON.DEV

PyData Global 2023

December 6 to December 9, 2023
PYDATA.ORG

Pyjamas Conf 2023

December 9 to December 11, 2023
PYJAMAS.LIVE

Sciwork 2023

December 9 to December 11, 2023
SCIWORK.DEV

Happy Pythoning!
This was PyCoder’s Weekly Issue #605.
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

FSF Events: Free Software Directory meeting on IRC: Friday, December 01, starting at 12:00 EST (17:00 UTC)

GNU Planet! - Tue, 2023-11-28 14:10
Join the FSF and friends on Friday, December 01, from 12:00 to 15:00 EST (17:00 to 20:00 UTC) to help improve the Free Software Directory.
Categories: FLOSS Project Planets

Off-Theme Presents: Shades of Purple

Planet KDE - Tue, 2023-11-28 11:51
In the third installment of Off-Theme, we cover Shades of Purple, a global theme with a rather striking set of shades that sets it apart from many other flat themes.
Categories: FLOSS Project Planets

Tag1 Consulting: A Guide to Estimating Migrations - How Much Will My Drupal Migration Cost? Part 2/3

Planet Drupal - Tue, 2023-11-28 09:00

This podcast series focuses on the strategies involved in upgrading and migrating Drupal websites and applications.

Read more michaelemeyers Tue, 11/28/2023 - 06:00
Categories: FLOSS Project Planets

Real Python: Advent of Code: Solving Puzzles With Python

Planet Python - Tue, 2023-11-28 09:00

Advent of Code is an online Advent calendar where you’ll find new programming puzzles offered each day from December 1 to 25. While you can solve the puzzles at any time, the excitement when new puzzles unlock is really something special. You can participate in Advent of Code in any programming language—including Python!

With the help of this Code Conversation, you’ll be ready to start solving puzzles and earning your first gold stars.

In this video course, you’ll learn:

  • What an online Advent calendar is
  • How solving puzzles can advance your programming skills
  • How you can participate in Advent of Code

Advent of Code puzzles are designed to be approachable by anyone with an interest in problem-solving. You don’t need a heavy computer science background to participate. Instead, Advent of Code is a great arena for learning new skills and testing out new features of Python.

[ 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

ListenData: How to Get Unique Values in a Column in Pandas DataFrame

Planet Python - Tue, 2023-11-28 07:17

This tutorial explains how to get unique values from a column in Pandas DataFrame, along with examples.

Find Unique Values in a Column df['columnName'].unique() To read this article in full, please click hereThis post appeared first on ListenData
Categories: FLOSS Project Planets

Enrico Zini: Introducing Debusine

Planet Debian - Tue, 2023-11-28 05:12
Abstract

Debusine manages scheduling and distribution of Debian-related tasks (package build, lintian analysis, autopkgtest runs, etc.) to distributed worker machines. It is being developed by Freexian with the intention of giving people access to a range of pre-configured tools and workflows running on remote hardware.

Freexian obtained STF funding for a substantial set of Debusine milestones, so development is happening on a clear schedule. We can present where we are and, we're going to be, and what we hope to bring to Debian with this work.

Categories: FLOSS Project Planets

Greg Casamento: Objective-C end of life?? Not a chance...

GNU Planet! - Mon, 2023-11-27 23:41
Recently, I saw this article regarding ObjCs "end of life" from JetBrains.

The tiobe index seems to disagree. It’s also important to remember that jetbrains recently had to take down their AppCode application (which sucked) since it didn’t sell.
Jetbrains is the creator of the kotlin language so they have a vested interest in their android customers. I would take their “index” with a grain of salt to say the least.

While it is certain that Apple won’t be investing into thing beyond ObjC 2.0, it is foolhardy to think that ObjC is going away anytime soon since there is an enormous installed base of stable code, not the least of which is Foundation and AppKit themselves. Also consider CocoaPods.

So, no, not worried about it. Also… look at Java and COBOL. For years people have declared the end of both languages. Java is still popular, though not in vogue and COBOL while not one of the “cool kids” has literally billions of lines of code being maintained and new code being written every year. This (admittedly biased as it is by the CTO of MicroFocus) article gives some reasons why….

Here is the article about COBOL...

Plus… Apple already has a mechanism for automatically allowing objc and swift to work together. Take a look at the frameworks in Xcode and you’ll notice some files called *.apinotes. These are YAML files that are used by the compiler to allow easy integration into swift projects. So, essentially, if Apple writes an ObjC version of a framework they get the swift version for absolutely free (minus the cost of writing the YAML file). If they write a swift only version they don’t get that benefit.

So, yeah, in conclusion… Yes, ObjC is NOT on the rise, but reports of its demise have been greatly exaggerated! ;)

PS. That being said, Apple dumping ObjC might spell a boom for us as all of the people who have installed codebases would suddenly need support for it either on macOS (on which we don’t currently work) or on other platforms. Something to think about…

PPS. All of the above being said. I admit I wouldn’t be terribly shocked to hear from Apple that “we have dropped support for the legacy objc language to provide you with the best support for our new swift language to make it the ‘greatest developer experience in the world’” or some grotesque BS like that. Lol

GC
Categories: FLOSS Project Planets

Dirk Eddelbuettel: RcppCNPy 0.2.12 on CRAN: More Maintenance

Planet Debian - Mon, 2023-11-27 19:36

A new (and again somewhat minor) maintenance release of the RcppCNPy package arrived on CRAN earlier today.

RcppCNPy provides R with read and write access to NumPy files thanks to the cnpy library by Carl Rogers along with Rcpp for the glue to R.

Recent changes in r-devel hone in on issues concerning printf format string inaccuracies the compiler can detect via the -Wformat -Wformat-security flags. Two fairly simplye ones were present here and have been addressed. In the time since the last release about twenty months ago two or three other minor packaging and setup details have also been taken care of, details are below.

Changes in version 0.2.12 (2022-11-27)
  • The continuous integration workflow received a trivial update, twice.

  • The C++ compilation standard is now implicit per CRAN and R preference.

  • The CITATION file format has been updated for the current usage.

  • Two print format string issues reported by current R-devel have been addressed.

CRANberries also provides a diffstat report for the latest release. As always, feedback is welcome and the best place to start a discussion may be the GitHub issue tickets page.

If you like this or other open-source work I do, you can now sponsor me at GitHub.

This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.

Categories: FLOSS Project Planets

François Marier: Automatically rebooting for kernel updates

Planet Debian - Mon, 2023-11-27 18:30

I use reboot-notifier on most of my servers to let me know when I need to reboot them for kernel updates since I want to decide exactly when those machines go down. On the other hand, my home backup server has very predictable usage patterns and so I decided to go one step further there and automate these necessary reboots.

To do that, I first installed reboot-notifier which puts the following script in /etc/kernel/postinst.d/reboot-notifier to detect when a new kernel was installed:

#!/bin/sh if [ "$0" = "/etc/kernel/postinst.d/reboot-notifier" ]; then DPKG_MAINTSCRIPT_PACKAGE=linux-base fi echo "*** System restart required ***" > /var/run/reboot-required echo "$DPKG_MAINTSCRIPT_PACKAGE" >> /var/run/reboot-required.pkgs

Note that unattended-upgrades puts a similar script in /etc/kernel/postinst.d/unattended-upgrades:

#!/bin/sh case "$DPKG_MAINTSCRIPT_PACKAGE::$DPKG_MAINTSCRIPT_NAME" in linux-image-extra*::postrm) exit 0;; esac if [ -d /var/run ]; then touch /var/run/reboot-required if ! grep -q "^$DPKG_MAINTSCRIPT_PACKAGE$" /var/run/reboot-required.pkgs 2> /dev/null ; then echo "$DPKG_MAINTSCRIPT_PACKAGE" >> /var/run/reboot-required.pkgs fi fi

and so you only need one of them to be installed since they both write to /var/run/reboot-required. It doesn't hurt to have both of them though.

Then I created the following cron job (/etc/cron.daily/reboot-local) to actually reboot the server:

#!/bin/bash REBOOT_REQUIRED=/var/run/reboot-required if [ -s $REBOOT_REQUIRED ] ; then cat "$REBOOT_REQUIRED" | /usr/bin/mail -s "Rebooting $HOSTNAME" root /bin/systemctl reboot fi

With that in place, my server will send me an email and then automatically reboot itself.

This is a work in progress because I'd like to add some checks later on to make sure that no backup is in progress during that time (maybe by looking for active ssh connections?), but it works well enough for now. Feel free to leave a comment if you've got a smarter script you'd like to share.

Categories: FLOSS Project Planets

FSF Events: FSF Free Software Community Meetup on December 15, 2023

GNU Planet! - Mon, 2023-11-27 14:26
We are inviting you to the first ever FSF Free Software Community Meetup on Friday, December 15, 2023, from 18:45 to 21:00 (6:45 PM to 9:00 PM) EST.
Categories: FLOSS Project Planets

Pages