Planet Python

The website Planet Python is a planet site that aggregates Python-related content from various sources, including blogs, news sites, and other online publications. The website provides a one-stop destination for individuals to stay up-to-date with the latest developments in the Python programming world. The content on the site includes tutorials, news, project announcements, and discussions about various Python-related topics. Users can visit the site to stay informed about the Python community, new releases, conferences, and best practices in using the Python programming language. The website's purpose is to help promote and disseminate Python-related content, thereby contributing to the growth and development of the Python community.

Thread Of Notes

The author developed a novel approach to documentation testing using AI. After updating project tutorials and documentation in Markdown files, they considered using AI to test their effectiveness. They instructed ChatGPT to create an isolated chat environment where it would read the documentation and attempt to use the described tool. The AI agreed, generating a detailed prompt for the new chat and monitoring its progress.The AI then reported back on documentation deficiencies it found. For instance, it noted the documentation lacked an explicit statement about the tool's intended Linux use, despite providing setup details for Linux and WSL. This led the AI to try running the tool in a Windows environment, highlighting an implicit assumption by the author that needed clarification.The author appreciates this method of having AI act as a new user, actively trying to complete tasks and reporting encountered issues. This goes beyond mere wording review, providing a practical test of the documentation's followability. While the AI may present invalid points, human judgment remains crucial in deciding what changes to implement.The author emphasizes that documentation must serve both human readers and AI assistants. With a growing number of users likely to employ AI for project interaction, documentation needs to be clear enough for direct human use and for AI to effectively assist users. This means considering how well documentation supports AI interaction, not just writing exclusively for AI.Ultimately, the author proposes testing documentation similarly to code, by assessing whether a user, human or AI, can successfully follow it to achieve a task. This innovative testing method offers a new perspective for improving documentation effectiveness on future projects.
CdXz5zHNQW_Tocx7RtYip.png
This text introduces Gnomon, a solution to communication breakdowns in software development, where different stakeholders interpret system descriptions differently. The author, with diverse experience, highlights how terms like "fix" in "We are building an agent to fix invoices" lead to divergent understandings and project failures. The rise of large language models (LLMs) exacerbates this by generating plausible but potentially inaccurate architectural drawings.Gnomon addresses this by providing a small language, gnomocode, and a compiler that validates statements against an ontology. An LLM translates natural language into gnomocode, the compiler checks its validity, and the output can be visualized, queried, or converted back into prose. The compiler, written in Python, uses Lark, rdflib, and pySHACL.The motivation behind Gnomon is to bridge the gap between spoken words and actionable diagrams, ensuring consistency and accountability. It aims to work in both directions: from conversation to model and from code/diagrams to readable text. The forward direction, from conversation to model, is the primary focus of the article.Key requirements for Gnomon include unambiguous terms, native support for modern architectural elements (LLMs, memory, tools), readability for humans and models, multiple views from a single model, version control, and the ability to express uncertainty. The approach evolved from trying simpler methods like directly asking LLMs or using structured objects, which failed to address the complexity of architectural graphs and missing information.Existing notations like UML or C4 were also found insufficient due to their fixed symbols, lack of "maybe" statements, and limited semantic checking. The custom language with a compiler proved to be the most viable solution. The compiler provides localized errors and feedback to the LLM for correction.The core of Gnomon is its ontology, built upon existing RDF vocabularies like SKOS, PROV-O, and DPV. This kernel of 57 terms and twelve modules defines relationships and rules, ensuring consistency. The ontology dictates the lexicon, compiler error messages, prose generation, and diagram views.Gnomocode itself is designed for readability and precision, using a syntax that borrows from Markdown, Python, and graph query languages. It supports concepts like declarations, property assignments, actions, and flows. A crucial feature is the ability to express confidence levels for facts, allowing the system to identify information requiring further confirmation.The compiler, written in Python, uses Lark for parsing. Its grammar is generated directly from the ontology, meaning extending the language involves modifying data, not code. This modular design allows for flexible vocabulary expansion without altering core parsing rules.
CdXz5zHNQW_IUf3kDkWHC.png
biwak.info developed a mobile-first map for Alpine huts, adding 33,437 named peaks with detailed information sourced from OpenStreetMap and Wikidata. To optimize for mobile devices with limited connectivity, the substantial 15.4 MB peaks data needed to be efficiently loaded. The solution was to segment the data into smaller, tile-based JSON files, mirroring the existing slippy map tile grid used by Leaflet. This allows the browser to fetch only the relevant peak data visible in the user's current map view.A fixed zoom level of 10 was chosen for the data grid, providing a balance between the number of network requests and the size of each downloaded file. At this level, an Alpine tile is roughly 27x27 km, and a typical phone screen at zoom 12 touches at most six tiles, with median tile sizes of 13 KB (3.6 KB gzipped).A Python script creates these tile files, along with a manifest of non-empty tiles, ensuring that only necessary files are requested. Each tile's JSON data is compact, using integer coordinates and a fields header to minimize file size. Peaks are ranked by prominence or isolation to control visibility at different map zoom levels, displaying only more significant peaks at lower zooms.The client-side JavaScript uses Leaflet's 'moveend' event to determine which tiles are needed, fetching them with a maximum of four parallel requests to prevent overload on slower connections. An LRU cache of 64 tiles manages downloaded data, dropping least recently used tiles if not in the current view. Peak data is rendered on a single canvas rather than using individual Leaflet markers, enhancing performance.Tapping on the map performs a nearest-neighbor search within loaded tiles to identify nearby peaks. The tile-based grid also naturally supports deep links, allowing stable URLs for specific peaks. Future enhancements include adding more categories of data like passes and viewpoints, and potentially migrating to vector tiles (MVT) for integration with mapping libraries like MapLibre. This system effectively handles a large dataset without a server or database, demonstrating the power of a simple file grid.
CdXz5zHNQW_7Oo4LQLM3G.webp
CdXz5zHNQW_jwz7YqFtlb.png
This issue of PyCoder's Weekly covers a range of Python topics. A tutorial explores Django ORM and migrations, detailing how to build, break, and fix them, including addressing performance issues in Django 6.1. Functional programming in Python is explained, discussing its paradigm and practical application. PropelAuth is highlighted for its security features, particularly for AI agent integrations. The Model-View-Controller (MVC) pattern in Python web apps is explored with a Flask example. Python 3.16.0 Alpha 1 is now available, and the Python Bytes podcast celebrated its 500th episode. The PyPy v8.0.1 release is also noted. A Claude Code course teaches building Python CLI apps without excessive ChatGPT reliance. OpenTeams reviews their 2026 PyTorch contributions, noting increased AI agent usage. Bayesian optimization for hyperparameter search is demonstrated with scikit-learn. The unique "+" operator in the Pendulum datetime library is examined. PyPI has updated its email reputation calculation, allowing Outlook addresses again. Parquet's advantages in data engineering are explained using Polars, DuckDB, and PyArrow. Gemini 4 Argon's capabilities are showcased with Python code generation. Project structure in Python is discussed, offering guidance on choosing between flat and src/ layouts. Comparisons are made between Docling and LlamaParse for PDF table extraction. Basic Python concepts like strings, data types, and first steps are covered in tutorials. Finally, a list of upcoming Python events is provided.
CdXz5zHNQW_wpqLkNZyB4.png
Nod is a JupyterLab extension allowing users to pause Python programs and open a notebook at any specific line for debugging. This tool helps in examining variables and the call stack directly within a running program. Polars 2.0 has been released, featuring a default streaming engine for improved memory and speed. However, this new engine does not guarantee row order for certain operations, requiring explicit handling if order is critical. Polars 2.0 also enables out-of-core processing by default, allowing it to spill data to disk when memory is exhausted. The update introduces a native Map data type, enhancing performance and introducing new map manipulation functions. Django-cachalot is presented as a solution for caching ORM queries, automatically invalidating them when underlying data changes. It offers significant speedups for read-heavy applications but is less suitable for tables with frequent write operations. Progress is being made towards supporting asynchronous transactions in Django, aiming to improve how asyncio tasks interact within database transactions. Current proposals involve new designs that allow sibling tasks to continue writing even if a transaction rolls back. Jazzband, a significant project, is set to shut down, prompting exploration of alternative platforms. Treemd is highlighted as a useful TUI for viewing Markdown files. Discussions also touch upon Talk Python membership, visual topic guides, and recent Python Enhancement Proposals. An observation is made about the potential staleness of a free threaded Polars version on PyPI. Finally, a brief mention of a joke concludes the episode's diverse technical discussions.
The eMudhra CA compromise highlighted systemic issues within the Python ecosystem's handling of certificate authorities. CPython relies on OpenSSL, which needs CA root certificates, and Python bundles these via the certifi package for platforms lacking native support. Historically, certifi was crucial, but Linux distributions now provide their own better-managed certificate stores. A significant problem is the lack of a default, active certificate revocation mechanism in OpenSSL-based Python installations. Upgrading certifi as a dependency causes cascading updates across the entire Python and pip ecosystem. Pip bundles certifi, meaning a compromise can necessitate urgent updates to both pip and Python itself. The Python Security Response Team must then coordinate releases across multiple Python branches. Pip is transitioning to use truststore by default, which would reduce its reliance on certifi, especially for Linux users. This incident required many other packaging tools and infrastructure components to act quickly. Alerting users to upgrade dependencies after patches are applied remains a major challenge. The author suggests that PyPI should cease being a certificate distribution channel, given that most platforms now offer adequate CA bundles. A shift towards relying more on system-provided certificate stores is proposed to alleviate the burden on Python and pip maintainers. The open question of effective certificate revocation for OpenSSL-based systems needs addressing to reduce future volunteer strain.
The release of Python 3.15.0 was chronicled through a series of updates, beginning two weeks before the final release. Initial excitement built up, with inquiries about anticipated features. On the planned release day, a certificate issue caused a 503 error on crucial Python websites, delaying the process. Once the server issues were resolved, a flaky test and several release-blocker issues, including last-minute lazy import fixes, required attention. To properly incorporate these fixes, a surprise third release candidate, 3.15.0rc3, was announced and released, pushing the final release date back by a week. A dependency on unbackported tests caused a delay in merging one of the lazy import blockers. After the successful release of rc3, the team prepared for the final launch. On the second attempt at the final release, all blockers were cleared, and buildbots were green. However, a bug in the changelog tool, blurb, necessitated a quick fix, update, and backport. Following this, the release artifact build failed due to another blurb-related lockfile issue, which was promptly resolved. Installer builds for macOS and Windows were initiated, with the Windows process requiring manual approval for binary signing. Finally, Python 3.15.0 was released, boasting new features like lazy imports, frozendict, and a faster JIT. The post-release tasks included updating PEP 790, rebuilding documentation, and unlocking the 3.15 branch for further core team merges. The release manager then signaled the next alpha release for Python 3.16.
CdXz5zHNQW_5t7QXRxkX2.png
CdXz5zHNQW_eyYaVLyYu6.jpeg