Posts Tagged ‘PyConUS’
[PyConUS2025] Enshittification and the Path to a New Good Internet: Cory Doctorow
Lecturer
Cory Doctorow is a science fiction author, activist, journalist, and special advisor to the Electronic Frontier Foundation. He maintains the daily blog Pluralistic.net and has authored numerous works, including the recent novels Picks and Shovels and The Bezzle (sequels to Red Team Blues), the solarpunk novel The Lost Cause, and the nonfiction volume The Internet Con: How to Seize the Means of Computation. Earlier books encompass the Little Brother series, Chokepoint Capitalism, Red Team Blues, and How to Destroy Surveillance Capitalism. Doctorow co-founded the UK Open Rights Group, serves as a MIT Media Lab Research Affiliate and Visiting Professor of Computer Science at the Open University, and holds a Visiting Professorship of Practice at the University of North Carolina’s School of Library and Information Science. Born in Toronto, he resides in Los Angeles. He was inducted into the Canadian Science Fiction and Fantasy Hall of Fame in 2020, received the Sir Arthur Clarke Imagination in Service to Society Award in 2022, the Neil Postman Award for Career Achievement in Public Intellectual Activity in 2024, and honorary doctorates from York University and the Open University. His professional site is craphound.com and his X handle is @doctorow.
Abstract
Cory Doctorow examines the concept of enshittification—the progressive degradation of digital platforms—and situates it within broader economic, legal, and technological structures. Drawing on examples ranging from nursing labor apps to Google search, he argues that platform decay arises not from technological inevitability or novel forms of corporate malice but from deliberate policy choices that dismantled four traditional disciplining forces: competition, regulation, interoperability, and labor power. Doctorow contends that reversing these choices can restore a functional digital commons and enable a “new good internet” capable of supporting collective resistance to larger crises.
The Anatomy of Enshittification and the Mechanism of Twiddling
Doctorow opens by redirecting expectations away from a conventional critique of online platforms toward an unexpected domain: nursing labor. A January 2025 report from the Groundwork Collective documented the rise of three dominant “Uber for nursing” applications—ShiftKey, ShiftMed, and CareRev—that allocate shifts through opaque algorithmic pricing. Before offering a wage, these platforms purchase a nurse’s real-time financial data from brokers. Nurses carrying substantial or delinquent credit-card debt receive systematically lower offers because desperation reduces reservation wages. Doctorow presents this practice as paradigmatic of enshittification: a three-stage process in which platforms first court end users with high-quality service while locking them in, then degrade the user experience to extract value for business customers, and finally extract remaining surplus for themselves until only a minimal residual value keeps both sides attached.
He illustrates the sequence with Google. In its early years the company minimized advertising and invested heavily in engineering, producing superior search results while simultaneously purchasing default placement across browsers, operating systems, and carriers—expenditures that eventually rivaled the cost of acquiring an entire Twitter every eighteen months. Once users were locked in, Google increased the proportion of advertising and rendered ad labels ever more subtle, enriching publishers and advertisers at the expense of searchers. When growth plateaued at roughly 90 percent market share, internal documents revealed a deliberate decision to degrade result quality so that users would issue multiple queries, thereby multiplying ad impressions. Concurrently Google entered collusive arrangements such as “Jedi Blue” with Meta to rig advertising markets against publishers. The contemporary search results page—dominated by AI-generated material, barely labeled advertisements, and SEO spam—exemplifies the terminal stage of enshittification: a “homeopathic residue” of utility sufficient only to prevent mass defection.
The technical enabler of these shifts is what Doctorow terms “twiddling.” Because modern platforms rest on Turing-complete machines, they possess effectively infinite adjustable parameters. Prices, rankings, recommendations, and wages can be altered on every interaction according to real-time data. Algorithmic wage discrimination, the term coined by legal scholar Veena Dubal, is merely one instance of twiddling applied to labor markets. Uber pioneered a similar technique with drivers: initially elevated offers induce acceptance of rides; subsequent micro-adjustments gradually erode compensation below sustainable levels once drivers have incurred sunk costs such as vehicle purchases. Digitization converts what would have been prohibitively labor-intensive wage theft into an automated, low-cost process.
Doctorow rejects the popular maxim that “if you are not paying for the product, you are the product.” Payment confers no protection. Apple’s simultaneous introduction of a third-party tracking opt-out and a secret first-party advertising surveillance system demonstrates that even customers who pay a premium can be productized. In the nursing example, nurses, patients, and hospitals are all subject to extraction. Enshittification productizes anyone who can be productized; dignified treatment is not a loyalty perk exchanged for money rather than attention.
Policy Origins and the Collapse of Disciplining Forces
Platforms were not born enshittified. Early Google, the original iPhone, and early Facebook delivered genuine value. Doctorow insists that the transformation resulted from policy decisions enacted within living memory by identifiable actors who were warned of the consequences yet faced no subsequent accountability. These decisions dismantled four constraints that once moderated corporate behavior.
The first constraint is market competition. Classical antitrust, exemplified by Senator John Sherman’s 1890 legislation, sought to prevent the emergence of “autocrats of trade.” Beginning in the 1980s, Chicago-school economics inverted this logic, treating monopolies as presumptively efficient. The result was concentrated markets across pharmaceuticals, hospitals, insurance, beer, athletic shoes, and professional wrestling. Mark Zuckerberg’s internal memo that “it is better to buy than to compete,” followed by the unchallenged acquisition of Instagram, exemplifies the new orthodoxy. Hospital consolidation, itself a defensive response to pharmaceutical mergers, left nurses and patients exposed to monopsonistic power and algorithmic wage platforms.
The second constraint is regulation. Concentrated sectors readily capture their regulators. A sector of one hundred firms is a rabble; a sector of five is a cartel capable of coordinated lobbying. Doctorow cites the United Kingdom’s Competition and Markets Authority, previously an effective investigator of technology monopolies, whose leadership was replaced by a former Amazon executive. In the United States, the last comprehensive federal privacy statute dates to 1988—the Video Privacy Protection Act—leaving data brokers free to sell financial dossiers that enable wage discrimination against nurses.
The third constraint is interoperability. In the physical world, interoperability requires careful standardization; in software it is nearly free because any valid program can be executed. Ad blockers, alternative ink cartridges, and tools that reveal hidden tips for DoorDash drivers are all forms of adversarial interoperability that discipline platforms. The 1998 Digital Millennium Copyright Act’s Section 1201, however, criminalizes the circumvention of access controls, converting reverse engineering into a potential felony. Parallel anti-circumvention provisions were exported through trade agreements to Europe, Canada, and elsewhere. Consequently, apps—websites wrapped in digital rights management—became preferred over open web interfaces, and independent repair of tractors, ventilators, and automobiles became legally hazardous.
The fourth constraint is labor power. Technology workers historically enjoyed scarcity-based leverage without formal unionization. They could refuse to implement degrading features and simply change employers. Mass layoffs since 2023—half a million jobs—and simultaneous executive bonus increases have eroded that leverage. The current enthusiasm for AI coding tools is, in Doctorow’s view, driven less by productivity gains than by the prospect of replacing workers who might otherwise resist enshittification.
Pathways Out of the Enshittocene
Because enshittification is the product of specific policy choices rather than technological destiny or inevitable historical forces, those choices can be reversed. Doctorow surveys an emerging global antitrust revival that is largely bipartisan and independent of billionaire funding. The European Union’s Digital Markets Act and Digital Services Act, parallel statutes in Australia, Japan, South Korea, and even China, and coordinated enforcement actions demonstrate renewed vigor. Market studies produced by one jurisdiction are readily adapted by others, creating a multiplier effect.
Regulatory capture can be mitigated by shifting enforcement away from captured national venues (for example, moving GDPR claims out of Irish courts). Right-to-repair legislation in Europe and Canada remains partially frustrated by residual anti-circumvention rules, yet the political opportunity now exists to repeal those rules. Doctorow argues that any jurisdiction willing to legalize reverse engineering, jailbreaking, and independent app stores would instantly become a technology export powerhouse. A Canadian app store charging a three-percent transaction fee rather than thirty percent would raise authors’, musicians’, and software developers’ revenues by roughly twenty-five percent overnight. Diagnostic tools priced at one hundred dollars per month rather than ten thousand dollars per manufacturer would attract global demand. The resulting competition would simultaneously lower costs for users worldwide and attack the most profitable lines of business of the largest American technology firms.
Doctorow situates these technical and legal interventions within a larger polycrisis—climate change, authoritarianism, genocide, and xenophobia—whose perpetrators have weaponized centralized platforms. The “insidete” was purpose-built for such co-option: giant corporations willing to trade a habitable planet for modest tax advantages, default algorithmic feeds, and government-backed intellectual-property barriers to exit. Yet the architecture was chosen, not inevitable. A new good internet combining the technical self-determination of the early web with the accessibility of Web 2.0 services remains possible. Such an internet would enable coordination and mutual aid in the face of cascading crises. Doctorow closes with the injunction that the community must build it.
Links:
[PyConUS2025] Python Software Foundation Welcome and Ecosystem Updates
Lecturer
Deb Nicholson is the Executive Director of the Python Software Foundation. She joined the organization in April 2022 after prior roles at the Open Source Initiative (Interim General Manager), Software Freedom Conservancy (Director of Community Operations), and the Open Invention Network. A founding organizer of the Seattle GNU/Linux Conference, she has received the O’Reilly Open Source Award and the Award for the Advancement of Free Software. Nicholson resides in Cambridge, Massachusetts. Her professional profile is available on LinkedIn at https://www.linkedin.com/in/denicholson and on X under the handle @baconandcoconut.
Abstract
This multi-part welcome session presents the current state of the Python Software Foundation, its infrastructure challenges, security initiatives, and community programs, interwoven with short addresses from major sponsors. Deb Nicholson surveys growth metrics for PyPI, the grants program, staffing, and fiscal sponsorships while reflecting on the social strengths and external pressures facing the community. Accompanying remarks from representatives of AWS, Alpha Omega, Meta, and Google highlight collaborative investments in security, tooling, and language evolution.
Security Initiatives and Infrastructure Stewardship
The session opened with brief sponsor remarks. An NVIDIA representative invited attendees to discussions on faster Python and smaller downloads. Hannah Aubrey of AWS Open Source then framed the company’s commitment to long-term security of critical open-source projects, noting that AWS depends on Python’s reliability. Michael Windsor of Alpha Omega described the organization’s four-pronged approach—staffing dedicated security roles, improving package managers, conducting audits, and funding experiments—initiated in response to supply-chain crises such as Log4Shell. He credited Seth Larson and Mike Fiedler for leadership within the Python ecosystem.
Seth Larson, Security Developer in Residence at the PSF, outlined the contemporary threat landscape: vulnerability exploitation, package poisoning, and social-engineering attacks on maintainers. His mandate is to establish secure-by-default experiences for millions of users. He displayed a visualization of social relationships among top PyPI packages, underscoring that security work is distributed across a dense contributor network rather than concentrated in a single office. Larson invited participation in security-focused talks, open spaces, and a meet-the-experts session at the AWS booth later that day.
Ian Barber of Meta, a visionary sponsor, reported that Python is now the most-used language inside the company, with more than three thousand developers. Meta’s investments include Pyfly, an IDE plugin and type-check engine released in alpha for instant autocomplete and navigation on large codebases; free-threaded Python aimed at true multi-threading without the GIL, particularly beneficial for AI workloads; and continued development of Triton and PyTorch, the latter now supporting NVIDIA’s Blackwell architecture and flex attention. Barber directed attendees to the typing summit and the Meta booth.
Deb Nicholson then assumed the podium. She restated the PSF mission: to promote, protect, and advance the Python language and to foster a diverse international community. The Foundation serves as the nonprofit home for both the language and its community, providing infrastructure, security, and legal support while channeling grants and fiscal sponsorships. Python’s ascent to the most-popular language on GitHub was noted with measured pride, accompanied by gratitude to Fastly for a five-year commitment that underpins CDN capacity.
PyPI growth figures illustrated the scale of demand: an 84 percent rise in download counts and 48 percent rise in bandwidth in 2024, following 57 percent and 45 percent increases in the two preceding years. The newly launched PyPI Organizations feature, intended to support collaborative teams and to generate modest administrative revenue for further improvements, attracted 8 500 initial requests—many duplicates or low-quality. Maria Asha cleared the resulting backlog, and the feature is now fully operational under the stewardship of infrastructure lead E.
The grants program has undergone substantial redesign under Community Communications Manager Marie Nordon. Application processes are shorter, more transparent, and more equitable; community updates are regular. Demand has expanded in every dimension—events, amounts, and geographic reach—while revenue has not kept pace, prompting an open invitation for new funding ideas and corporate partnerships.
Community Resilience, Staffing, and Forward Outlook
Nicholson turned to the social character of the Python community, describing its historic openness to “weird kids” and unconventional projects—ranging from analysis of pre-Columbian tooth enamel to experimental tooling. This receptivity, she argued, keeps the language fresh and expands its application domains. Yet she acknowledged the broader context of geopolitical and economic uncertainty that has deterred hundreds of potential international attendees and complicated nonprofit operations. Layoffs, regulatory flux, and funding volatility place additional strain on a small organization whose largest single budget item remains PyCon US itself.
Despite these pressures, the human infrastructure of the PSF remains robust. Nicholson introduced the approximately thirteen staff members who support more than eight million users worldwide. Olivia Sauls directs the conference; Seth Larson and Mike Fiedler manage security reporting and infrastructure; E oversees core systems with assistance from Jacob Coffee; Marie Nordon handles grants, D&I, fellows, and communications; Jamie has transitioned from contractor to full-time events staff; accountants Phyllis and Laura manage fiscal sponsorships, payroll, and compliance; and Lauren has been promoted to Deputy Executive Director with expanded responsibilities for partnerships and strategic planning. Three CPython Developer-in-Residence positions—Lucas, Peter, and Siri—support core development, with Wukush also present for the language summit.
The Board of Directors and a suite of volunteer working groups (code of conduct, diversity and inclusion, education and outreach, fellows, grants, infrastructure, jobs board, packaging, trademarks) extend capacity further. The Foundation acts as fiscal sponsor for twenty projects, most prominently the global PyLadies network. Thousands of additional volunteers worldwide organize local conferences, meetups, and educational programs that sustain Python’s growth.
Sponsor advocacy received special thanks: the individuals inside corporations who repeatedly champion larger contributions and greater conference attendance. Nicholson closed by urging the community to “stay weird and keep welcoming all the nice weirdos,” then introduced Lisa of Google. Lisa, attending her first PyCon, praised the energy and the dedicated newcomers’ session. She reaffirmed Google’s reliance on Python across scripting, DevOps, and machine learning, and expressed particular interest in free-threaded Python, typing-standard evolution, and performance work. Multiple Google colleagues were present for the typing summit, a talk on programming for oneself, and a supply-chain security open space.
Collectively the addresses portray a Foundation that has scaled its technical and social infrastructure in step with extraordinary adoption while remaining attentive to inclusion, security, and long-term sustainability. The interplay of staff, volunteers, sponsors, and core developers illustrated in the session constitutes the operational backbone that enables the language’s continued vitality.
Links:
[PyConUS2025] Welcome Address by the Conference Chair
Lecturer
Elaine Wong serves as the Conference Chair for PyCon US 2025. A long-standing contributor to the Python community, she previously chaired PyCon Canada in 2018 and co-chaired it in 2019. Wong has organized PyLadies Toronto and the CSV Conference, supported video production at multiple community events, and co-hosts a monthly virtual meetup for conference organizers. Recognized with a Python Software Foundation Community Service Award in 2020 and designated a PSF Fellow, she brings extensive experience in community building, livestreaming, and event logistics. Her professional background includes media and broadcasting work. Further details appear on her personal website at https://eswong.ca/ and her presence on X under the handle @elthenerd.
Abstract
This address opens PyCon US 2025 in Pittsburgh, Pennsylvania, by outlining the logistical framework, community resources, and programmatic highlights of the multi-day gathering. Elaine Wong introduces the organizing team, sponsors, and volunteers while providing essential orientation on venue navigation, code of conduct, accessibility measures, and special tracks. The presentation emphasizes participatory opportunities such as open spaces, hatcheries, and lightning talks, situating the conference within the broader ethos of inclusive Python community practice.
Conference Orientation and Community Infrastructure
Elaine Wong began by expressing enthusiasm for the assembled attendees and offering a light-hearted musical greeting adapted to the occasion. She introduced herself as Conference Chair and acknowledged her co-chair, John, who stood ready to assist with questions throughout the event. Together they form the primary points of contact for logistical support and guidance.
Central to the success of the conference, Wong stressed, is the dedicated staff of the Python Software Foundation. She listed Olivia, Deb, Lauren, Jamie, Phyllis, Laura, E, Marie, Jacob, Maria, Seth, and Mike, inviting a round of applause for their year-long efforts in preparing the venue, program, and infrastructure. Equally vital are the sponsors whose financial contributions underwrite food service, utilities, and overall operations; attendees were encouraged to visit the expo hall and express personal thanks via a provided QR code linking to the full sponsor roster.
The volunteer cohort received particular recognition. More than one hundred individuals had already signed up, with a target of three hundred on-site volunteer hours. Wong directed participants to a QR code and website for short-term shifts ranging from one to several hours, noting that such engagement offers both practical insight into conference operations and an eventual pathway toward leadership roles such as chair.
Practical orientation followed. Wi-Fi credentials and a QR code for network access were displayed, alongside announcement of a new mobile application available for both iOS and Android platforms. The application supplies schedules, maps, and session favoriting capabilities. Venue layout received detailed treatment: general sessions, keynotes, lightning talks, and special guest presentations occupy Hall B on the second floor. Parallel talk tracks are located in Hall C and on the third floor, reachable via escalators or elevators and a pedestrian walkway. Breakfast is served outside Hall B beginning at 7:30 each morning; lunch and snacks appear in Hall A, which also houses the expo hall on Friday and Saturday as well as swag pickup for pre-ordered t-shirts. Surplus shirts become available for purchase on Sunday at 11:00 on a first-come basis. Luggage storage operates Saturday and Sunday outside Show Office C from 8:00 to 18:00, with later retrieval possible from the staff office in rooms 306–307. A mothering and nursing room occupies Show Office B; the travel-grant office is in Show Office A, with posted hours for recipients. Gender-neutral restrooms are clearly marked. The fourth floor hosts summits and the PyLadies lunch, while room 405 provides a quiet space and a rooftop terrace offers outdoor respite. Emergency procedures direct participants to call 911 and notify staff wearing light-blue shirts or DLCC attire; on-site EMTs are stationed behind Hall B on the main conference days.
Code-of-conduct provisions received careful attention. Wong summarized the expected standard of conduct by reference to the kindness and consideration associated with Mr. Rogers. Concerns may be reported by text, email, or in person to the committee led by Molly, whose members wear distinctive orange shirts and maintain a presence in the staff room. Photo policy is signaled by lanyard color: orange indicates preference against photography, black indicates consent. Health and safety guidance encourages but does not require masking; free masks and testing kits remain available at registration.
A brief recap of the preceding two days noted completed tutorials, the language summit, education summit, WebAssembly summit, sponsored presentations, newcomers’ orientation, and a lively opening reception. Keynote speakers Jeff, Tom, Lynn, Corey, and Dr. Corey Jordan were introduced, with the added note that all would hold meet-and-greet sessions at the PSF booth; the Carpentries, led by Dr. Jordan, maintain an expo presence. Special programming includes a diversity-and-inclusion panel, a security-engineer update, and a Python Steering Council session. The Charlas Spanish-language track occupies rooms 310 and 311 for two days, inviting participants of every proficiency level. Live human captioning, provided by White Coat Captioning, accompanies all talks.
Hatchery events expand the formal program: FlaskCon occupies the afternoon of the current day, a community-organizer summit and Hometown Heroes showcase occur on Saturday, and a beginner-oriented Humble Data workshop runs on Sunday, all centered in room 317. Additional summits address typing, maintainership, packaging, and mentor sprints. Open spaces have been digitized; participants register via website or QR code for one-hour self-organized sessions on a first-come basis. Lightning-talk sign-ups likewise proceed through an online form linked to each attendee’s dashboard, with four scheduled rounds. Tickets remain available for the PyLadies auction, a dinner-and-bidding event that constitutes the principal fundraiser for the PyLadies Foundation and supports both global chapters and travel grants. The PyLadies luncheon on Sunday offers further reflection and networking. Sunday also features posters, a job fair, and a community showcase that invites regional conferences, meetups, and open-source projects to claim tables.
Local recommendations for Pittsburgh attractions, including the baseball stadium and neighborhood eateries, appear under a provided URL. Wong closed by endorsing the informal “hallway track” and the Pac-Man rule—leaving physical space in conversational circles so that newcomers may join readily. Official social-media channels and the hashtag #PyConUS complete the orientation.
Programmatic Opportunities and Inclusive Practices
Beyond logistics, the address situates PyCon US within a deliberately inclusive framework. The multi-track structure, language accessibility via Charlas and live captioning, quiet rooms, gender-neutral facilities, and explicit photo and health policies collectively lower barriers to participation. Hatcheries and open spaces democratize content creation, allowing attendees to surface emerging ideas outside the formal call-for-proposals process. Lightning talks lower the threshold for first-time speakers. Volunteer pathways and the explicit invitation to future leadership roles reinforce the conference’s self-renewing character. Financial underwriting by sponsors and the travel-grant system further extend reach. Collectively these measures illustrate how a large-scale technical gathering can embed community values of accessibility, mutual support, and continuous expansion of the Python ecosystem.
Links:
[PyConUS 2024] Pandas + Dask DataFrame 2.0: A Leap Forward in Distributed Computing
At PyCon US 2024, Patrick Hoefler delivered an insightful presentation on the advancements in Dask DataFrame 2.0, particularly its enhanced integration with pandas and its performance compared to other big data tools like Spark, DuckDB, and Polars. As a maintainer of both pandas and Dask, Patrick, who works at Coiled, shared how recent improvements have transformed Dask into a robust and efficient solution for distributed computing, making it a compelling choice for handling large-scale datasets.
Enhanced String Handling with Arrow Integration
One of the most significant upgrades in Dask DataFrame 2.0 is its adoption of Apache Arrow for string handling, moving away from the less efficient NumPy object data type. Patrick highlighted that this shift has resulted in substantial performance gains. For instance, string operations are now two to three times faster in pandas, and in Dask, they can achieve up to tenfold improvements due to better multithreading capabilities. Additionally, memory usage has been drastically reduced—by approximately 60 to 70% in typical datasets—making Dask more suitable for memory-constrained environments. This enhancement ensures that users can process large datasets with string-heavy columns more efficiently, a critical factor in distributed workloads.
Revolutionary Shuffle Algorithm
Patrick emphasized the complete overhaul of Dask’s shuffle algorithm, which is pivotal for distributed systems where data must be communicated across multiple workers. The previous algorithm scaled poorly, with a logarithmic complexity that hindered performance as dataset sizes grew. The new peer-to-peer (P2P) shuffle algorithm, however, scales linearly, ensuring that doubling the dataset size only doubles the workload. This improvement not only boosts performance but also enhances reliability, allowing Dask to handle arbitrarily large datasets with constant memory usage by leveraging disk storage when necessary. Such advancements make Dask a more resilient choice for complex data processing tasks.
Query Planning: A Game-Changer
The introduction of a logical query planning layer marks a significant milestone for Dask. Historically, Dask executed operations as they were received, often leading to inefficient processing. The new query optimizer employs techniques like column projection and predicate pushdown, which significantly reduce unnecessary data reads and network transfers. For example, by identifying and prioritizing filters and projections early in the query process, Dask can minimize data movement, potentially leading to performance improvements of up to 1000x in certain scenarios. This optimization makes Dask more intuitive and efficient, aligning it closer to established systems like Spark.
Benchmarking Against the Giants
Patrick presented comprehensive benchmarks using the TPC-H dataset to compare Dask’s performance against Spark, DuckDB, and Polars. At a 100 GB scale, DuckDB often outperformed others due to its single-node optimization, but Dask held its own. At larger scales (1 TB and 10 TB), Dask’s distributed nature gave it an edge, particularly when DuckDB struggled with memory constraints on complex queries. Against Spark, Dask showed remarkable progress, outperforming it in most queries at the 1 TB scale and maintaining competitiveness at 10 TB, despite some overhead issues that Patrick noted are being addressed. These results underscore Dask’s growing capability to handle enterprise-level data processing tasks.
Links:
Hashtags: #Dask #Pandas #BigData #DistributedComputing #PyConUS2024 #PatrickHoefler #Coiled #Spark #DuckDB #Polars
[PyConUS 2024] How Python Harnesses Rust through PyO3
David Hewitt, a key contributor to the PyO3 library, delivered a comprehensive session at PyConUS 2024, unraveling the mechanics of integrating Rust with Python. As a Python developer for over a decade and a lead maintainer of PyO3, David provided a detailed exploration of how Rust’s power enhances Python’s ecosystem, focusing on PyO3’s role in bridging the two languages. His talk traced the journey of a Python function call to Rust code, offering insights into performance, security, and concurrency, while remaining accessible to those unfamiliar with Rust.
Why Rust in Python?
David began by outlining the motivations for combining Rust with Python, emphasizing Rust’s reliability, performance, and security. Unlike Python, where exceptions can arise unexpectedly, Rust’s structured error handling via pattern matching ensures predictable behavior, reducing debugging challenges. Performance-wise, Rust’s compiled nature offers significant speedups, as seen in libraries like Pydantic, Polars, and Ruff. David highlighted Rust’s security advantages, noting its memory safety features prevent common vulnerabilities found in C or C++, making it a preferred choice for companies like Microsoft and Google. Additionally, Rust’s concurrency model avoids data races, aligning well with Python’s evolving threading capabilities, such as sub-interpreters and free-threading in Python 3.13.
PyO3: Bridging Python and Rust
Central to David’s talk was PyO3, a Rust library that facilitates seamless integration with Python. PyO3 allows developers to write Rust code that runs within a Python program or vice versa, using procedural macros to generate Python-compatible modules. David explained how tools like Maturin and setup-tools-rust simplify project setup, enabling developers to compile Rust code into native libraries that Python imports like standard modules. He emphasized PyO3’s goal of maintaining a low barrier to entry, with comprehensive documentation and a developer guide to assist Python programmers venturing into Rust, ensuring a smooth transition across languages.
Tracing a Function Call
David took the audience on a technical journey, tracing a Python function call through PyO3 to Rust code. Using a simple word-counting function as an example, he showed how a Rust implementation, marked with PyO3’s @pyfunction attribute, mirrors Python’s structure while offering performance gains of 2–4x. He dissected the Python interpreter’s bytecode, revealing how the CALL instruction invokes PyObject_Vectorcall, which resolves to a Rust function pointer via PyO3’s generated code. This “trampoline” handles critical safety measures, such as preventing Rust panics from crashing the Python interpreter and managing the Global Interpreter Lock (GIL) for safe concurrency. David’s step-by-step breakdown clarified how arguments are passed and converted, ensuring seamless execution.
Future of Rust in Python’s Ecosystem
Concluding, David reflected on Rust’s growing adoption in Python, citing over 350 projects monthly uploading Rust code to PyPI, with downloads exceeding 3 billion annually. He predicted that Rust could rival C/C++ in the Python ecosystem within 2–4 years, driven by its reliability and performance. Addressing concurrency, David discussed how PyO3 could adapt to Python’s sub-interpreters and free-threading, potentially enforcing immutability to simplify multithreaded interactions. His vision for PyO3 is to enhance Python’s strengths without replacing it, fostering a symbiotic relationship that empowers developers to leverage Rust’s precision where needed.
Links:
Hashtags: #Rust #PyO3 #Python #Performance #Security #PyConUS2024 #DavidHewitt #Pydantic #Polars #Ruff
[PyConUS 2023] Fixing Legacy Code, One Pull Request at a Time
At PyCon US 2023, Guillaume Dequenne from Sonar presented a compelling workshop on modernizing legacy codebases through incremental improvements. Sponsored by Sonar, this session focused on integrating code quality tools into development workflows to enhance maintainability and sustainability, using a Flask application as a practical example. Guillaume’s approach, dubbed “Clean as You Code,” offers a scalable strategy for tackling technical debt without overwhelming developers.
The Legacy Code Conundrum
Legacy codebases often pose significant challenges, accumulating technical debt that hinders development efficiency and developer morale. Guillaume illustrated this with a vivid metaphor: analyzing a legacy project for the first time can feel like drowning in a sea of issues. Traditional approaches to fixing all issues at once are unscalable, risking functional regressions and requiring substantial resources. Instead, Sonar advocates for a pragmatic methodology that focuses on ensuring new code adheres to high-quality standards, gradually reducing technical debt over time.
Clean as You Code Methodology
The “Clean as You Code” approach hinges on two principles: ownership of new code and incremental improvement. Guillaume explained that developers naturally understand and take responsibility for code they write today, making it easier to enforce quality standards. By ensuring that each pull request introduces clean code, teams can progressively refurbish their codebase. Over time, as new code replaces outdated sections, the overall quality improves without requiring a massive upfront investment. This method aligns with continuous integration and delivery (CI/CD) practices, allowing teams to maintain high standards while delivering features systematically.
Leveraging SonarCloud for Quality Assurance
Guillaume demonstrated the practical application of this methodology using SonarCloud, a cloud-based static analysis tool. By integrating SonarCloud into a Flask application’s CI/CD pipeline, developers can automatically analyze pull requests for issues like bugs, security vulnerabilities, and code smells. He showcased how SonarCloud’s quality gates enforce standards on new code, ensuring that only clean contributions are merged. For instance, Guillaume highlighted a detected SQL injection vulnerability due to unsanitized user input, emphasizing the tool’s ability to provide contextual data flow analysis to pinpoint and resolve issues efficiently.
Enhancing Developer Workflow with SonarLint
To catch issues early, Guillaume introduced SonarLint, an IDE extension for PyCharm and VSCode that performs real-time static analysis. This tool allows developers to address issues before committing code, streamlining the review process. He demonstrated how SonarLint highlights issues like unraised exceptions and offers quick fixes, enhancing productivity. Additionally, the connected mode between SonarLint and SonarCloud synchronizes issue statuses, ensuring consistency across development and review stages. This integration empowers developers to maintain high-quality code from the outset, reducing the burden of post-commit fixes.
Sustaining Codebase Health
The workshop underscored the long-term benefits of the “Clean as You Code” approach, illustrated by a real-world project where issue counts decreased over time as new rules were introduced. By focusing on new code and leveraging tools like SonarCloud and SonarLint, teams can achieve sustainable codebases that are maintainable, reliable, and secure. Guillaume’s presentation offered a roadmap for developers to modernize legacy systems incrementally, fostering a culture of continuous improvement.
Links:
Hashtags: #LegacyCode #CleanCode #StaticAnalysis #SonarCloud #SonarLint #Python #Flask #GuillaumeDequenne #PyConUS2023