Slide 1

Slide 1 text

EuroPython July 10, 2024 Embracing Python, AI, and Heuristics Optimal Path to Impactful Software 1 Carol Willing

Slide 2

Slide 2 text

Good morning 2 Dobré ráno https://bit.ly/4cQhK9L

Slide 3

Slide 3 text

Carol Willing Python Core Developer Python Steering Council (three terms) Python Software Foundation Fellow Jupyter Core Developer 2017 ACM Software System Award Papermill Maintainer pyOpenSci Advisory Board Chan Zuckerberg Open Science Board Quansight Labs Board VP of Engineering, Noteable

Slide 4

Slide 4 text

4 https://youtu.be/j4X8K6pcxuQ?si=s8d0DytF7-bmeBLB Thank you Nicholas and Josh

Slide 5

Slide 5 text

5 https://www.freepik.com/free-photo/breathtaking-shot-young-male-climbing-high- rock-champfromier-france_17244560.htm Today's climb Optimal path to impactful software Fear Con fi dence

Slide 6

Slide 6 text

6 1 Dynamic world

Slide 7

Slide 7 text

7 2 Python 1 Dynamic world

Slide 8

Slide 8 text

8 3 AI 1 Dynamic world 2 Python

Slide 9

Slide 9 text

9 3 AI 1 Dynamic world 4 Heuristics 2 Python

Slide 10

Slide 10 text

10 3 AI 1 Dynamic world 5 Your toolbox 4 Heuristics 2 Python

Slide 11

Slide 11 text

11 Let's begin

Slide 12

Slide 12 text

12 1 Dynamic world

Slide 13

Slide 13 text

13 Change Speed Complexity Scale Dynamic

Slide 14

Slide 14 text

Global issues

Slide 15

Slide 15 text

Developer decisions What should I learn? Which tool is best? How do I use this tool? When do I use this tool? 15 Dynamic world

Slide 16

Slide 16 text

Paradigm Shifts 16 Change how we work Dynamic world Transistors and mainframes Personal Computers Worldwide Web Generative AI and LLMs Cellular service Time 2012-present 1989-1996 1970-1995 1980-2020 1950-2000 Enterprise Government Individuals Expect tension between stakeholders until a steady state is reached

Slide 17

Slide 17 text

Paradigm Shifts 17 Hype is news. Consider the source. Dynamic world Pitfalls Success

Slide 18

Slide 18 text

Paradigm shifts evolve over time. 18 Dynamic world Think in years, not months or days. https://www.mckinsey.com/capabilities/quantumblack/our-insights/the-state-of-ai

Slide 19

Slide 19 text

19 Dynamic world https://blog.jupyter.org/jupyter-receives-the-acm-software-system-award-d433b0dfe3a2

Slide 20

Slide 20 text

20 Dynamic world https://github.com/dansuh17/alexnet-pytorch/tree/master https://paperswithcode.com/method/alexnet https://papers.nips.cc/paper_ fi les/paper/2012/hash/ c399862d3b9d6b76c8436e924a68c45b-Abstract.html

Slide 21

Slide 21 text

dynamic how to respond to change 21

Slide 22

Slide 22 text

Create a toolbox 22 Dynamic world Generated by ChatGPT 4o: make an image of a toolbox containing the words Python, AI, Heuristics Using cognitive science

Slide 23

Slide 23 text

23 Python 2 Proven language and tools

Slide 24

Slide 24 text

Strengths of Python Solid Foundation 24 Python 1. Readability 2. Extensive Standard Library 3. Large ecosystem 4. Cross-platform compatibility 5. Community support 6. Versatility 7. Rapid prototyping 8. Integrates with other languages 9. Typing fl exibility 10. Multidomain: web, science, data science, education, embedded

Slide 25

Slide 25 text

Performance Step 1: Releases 25 Python • Use a recent Python or pypy • Performance has steadily improved. • 3.13 in beta • Experimental freethreading without the gil (global interpreter lock) • Experimental JIT compiler • Release date: Tuesday, 2024-10-01 https://docs.python.org/3.13/whatsnew/3.13.html Stay up to date Special thanks to our release managers. Thomas Wouters 3.13 Hugo van Kemenade 3.14 and 3.15

Slide 26

Slide 26 text

Performance Step 2: Measure 26 Python • timeit or magic %timeit • cPro fi le (deterministic pro fi ler) • Pyinstrument (statistical pro fi ler) • py-spy (sampling pro fi ler) • pyperf (https://github.com/psf/pyperf) • GPU: CUDA, numba, cuPy Profile and Optimize

Slide 27

Slide 27 text

Performance Pro fi le running processes with py-spy 27 Python py-spy Search fit (implicit/als.py:159) calculate_similar_artists (lastfm.py:79) fit (implicit/als.py:163) _get_similarity_score (implic.. _get_similarity_score (implicit/recommender_.. argpartition (numpy/core/fromnumeric.py:757) _wrapfunc (numpy/core/fromnumeric.py:51) calculate_similar_artists (lastfm.py:95) similar_items (implicit/recommender_base.py:203) (lastfm.py:161) visualize with fl ame graphs https://docs.ray.io/en/latest/cluster/kubernetes/k8s-ecosystem/pyspy.html https://github.com/benfred/py-spy https://www.youtube.com/watch?v=p8s2fzqA07s Anthony Sottile, Sentry usage installation Step 3: Pro fi le processes

Slide 28

Slide 28 text

Polyglot friendly PyO3, Pydantic, Playwright 28 Python https://playwright.dev/python/ https://pyo3.rs/v0.22.1/ docs.pydantic.dev

Slide 29

Slide 29 text

Modernize web WASM • Pyodide • JupyterLite • PyScript • PyCafe • PySheets 29 Python https://www.willingconsulting.com/pysplashlive.html JupyterLite runs entirely in the browser.

Slide 30

Slide 30 text

Modernize mobile iOS, Android 30 Python https://peps.python.org/pep-0730/ PEP 730 – Adding iOS as a supported platform PEP 738 – Adding Android as a supported platform https://peps.python.org/pep-0738/

Slide 31

Slide 31 text

Innovation Packages 31 Python https://discuss.python.org/t/python-packaging-summit-at-pycon-us-2024- notes-and-thanks/54714 https://www.pyopensci.org https://pixi.sh/latest/ https://rye.astral.sh/ https://hatch.pypa.io/latest/ Supporting producers Enabling consumers pyOpenSci Hatch Rye pixi

Slide 32

Slide 32 text

User Success Developed by and for humans • Developer experience • Packaging experience • PEPs: How to teach • Documentation • Accessibility 32 Python Lessons learned maintaining open source Python projects (Bernat Gabor) https://youtube.com/watch?v=rcSLOqwpJk8

Slide 33

Slide 33 text

Recap 33 Python Strengths Performance Polyglot Mobile and Web Innovation User success Python provides a solid foundation.

Slide 34

Slide 34 text

34 AI 3 Transparent and trusted tools

Slide 35

Slide 35 text

35 AI

Slide 36

Slide 36 text

36 AI

Slide 37

Slide 37 text

Accurate? Biased? Conclusions? 37 AI

Slide 38

Slide 38 text

AI is a tool. AI is not a person. A person chooses an AI tool. An AI tool has limitations. Fit the tool to the job. Minimize the harm done by the tool. 38 AI ABCs

Slide 39

Slide 39 text

LLMs Black box or not 39 AI https://youtu.be/jkrNMKz9pWU A Hackers Guide to Language Models by Jeremy Howard LLM https://github.com/fastai/lm-hackers https://fastai.github.io/lm-hackers/lm-hackers.html Input Output

Slide 40

Slide 40 text

Transparent and Trusted Tension between people and pro fi ts 40 AI Incentives Costs Privacy Security Ethical matrix https://youtu.be/Z267wxOYPms https://www.oxford-aiethics.ox.ac.uk/ https://www.oxford-aiethics.ox.ac.uk/lyceum-project-ai-ethics-aristotle-white-paper https://dl.acm.org/doi/full/10.1145/3544548.3581318

Slide 41

Slide 41 text

Trust the tool Consider the source 41 AI Synthetic Lies: Understanding AI-Generated Misinformation and Evaluating Algorithmic and Human Solutions https://dl.acm.org/doi/full/10.1145/3544548.3581318 XAI: Explainable AI Explainability includes not only code, but also data, infrastructure, processes, and governance. Synthetic AI First major study of generated misinformation https://github.com/wangyongjie-ntu/Awesome-explainable-AI

Slide 42

Slide 42 text

– Jeremy Howard Claudette removes the complexity and boilerplate and makes using AI much easier. 42 AI https://www.answer.ai/posts/2024-06-21-claudette.html https://claudette.answer.ai/

Slide 43

Slide 43 text

– Jeremy Howard Claudette's literate notebook source shows a better way to write so ft ware -- a way that allows anyone to understand and contribute to a project. 43 AI https://youtu.be/p_8Zk6HUCV8?si=AxkVOBggTaNkQMwg

Slide 44

Slide 44 text

Understanding is key "We all are data people." • Context • Use case • Limitations • Criticality • Access 44 AI https://youtu.be/GBycch2OSx8 Interview with Scott Hanselman

Slide 45

Slide 45 text

Accelerating Science Decision support and idea generation 45 AI https://chanzuckerberg.com/blog/priscilla-chan-update-ai-biomedical-research/ https://tech.chanzuckerberg.com/scitech/ Universal Sequence-Based Embeddings Universal embeddings of cells and organelles from microscope images Explore the molecular underpinnings of human health and disease

Slide 46

Slide 46 text

Recap 46 Python ABCs Not a person Evolved over time Open source to closed commercial o ff erings Transparent and trusted Literate Understanding LLMs are tools with tradeo ff s. AI

Slide 47

Slide 47 text

47 Heuristics 4 Time saving tools

Slide 48

Slide 48 text

Heuristics 48 Heuristics • Real-world experience • Use when information is unknown, overwhelming, or random • Understandable • Pragmatic • Low friction to use

Slide 49

Slide 49 text

Ten Software Development Heuristics Rules of Thumb 49 Heuristics 1. YAGNI (You Aren’t Gonna Need It) 2. Divide and Conquer: Break down complex problems 3. KISS (Keep It Simple, Superheroes): Avoid complexity 4. User-Centric Design: Focus on the end-user 5. Fail Fast: Detect errors early

Slide 50

Slide 50 text

Ten Software Development Heuristics Rules of Thumb 50 Heuristics 6. Incremental development: feedback and adjustments 7. CI/CD: Catch errors early 8. DRY (Don't Repeat Yourself) 9. Code smells 10. Refactoring: Improve without changing behavior

Slide 51

Slide 51 text

Pythonic Heuristics 51 Heuristics

Slide 52

Slide 52 text

https://thenewstack.io/a-conversation-with-the-creators-behind-python-java-typescript-and-perl/ Guido van Rossum (Python) James Gosling (Java) Larry Wall (Perl) Anders Hejlsberg (Pascal, C#, TypeScript) me (Jupyter)

Slide 53

Slide 53 text

Problem-solving decisions SCAMPER 53 • Substitute • Combine • Adapt • Modify • Put to another use • Eliminate • Reverse https://www.designorate.com/a-guide-to-the-scamper-technique-for-creative-thinking/ Heuristics

Slide 54

Slide 54 text

Learning 54 Cognitive Science Tips Python Code vs Pythonic Code Heather Crawford - PyTexas 2024 Experts recognize Beginners reason Heuristics The human mind works quite di ff erently than a computer. Brown, Neil C. C., Felienne F. J. Hermans, and Lauren E. Margulieux. “10 Things Software Developers Should Learn about Learning.” Communications of the ACM 67, no. 1 (January 2024): 78–87. https://doi.org/10.1145/3584859. https://www.youtube.com/watch?v=RdkhRfRizf0

Slide 55

Slide 55 text

Recap 55 Python Rules of thumb Useful Easy to apply Real-world experience Heuristics save time when a problem is large in scope with lots of uncertainty Heuristics

Slide 56

Slide 56 text

56 Your toolbox 5 Python AI Heuristics Time saving tools Transparent and trusted tools Proven language and tools

Slide 57

Slide 57 text

Create your toolbox Curate often • complex challenges • changing requirements • make decisions • be con fi dent • impact human outcomes 57 Generated by ChatGPT 4o: make an image of a toolbox containing the words Python, AI, Heuristics

Slide 58

Slide 58 text

58 Call to Action Python AI Heuristics Time saving tools Transparent and trusted tools Proven language and tools

Slide 59

Slide 59 text

59 Adapt and thrive

Slide 60

Slide 60 text

60 Expect to make mistakes Adopt a musician's mindset. Loud and proud

Slide 61

Slide 61 text

61 Follow your North Star Value your time and energy

Slide 62

Slide 62 text

Impact your world 62 Python AI Heuristics Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. – Donald E. Knuth, Literate Programming (1984)

Slide 63

Slide 63 text

Fun builds resilience Enjoy EuroPython 63

Slide 64

Slide 64 text

Thank you 64 Carol Willing https://www.willingconsulting.com/ https://bit.ly/4cQhK9L @[email protected]

Slide 65

Slide 65 text

Resources 65 A selection of research

Slide 66

Slide 66 text

66 Brown, Neil C. C., Felienne F. J. Hermans, and Lauren E. Margulieux. “10 Things Software Developers Should Learn about Learning.” Communications of the ACM 67, no. 1 (January 2024): 78–87. https://doi.org/10.1145/3584859. Cai, Carrie J., and Philip J. Guo. “Software Developers Learning Machine Learning: Motivations, Hurdles, and Desires.” In 2019 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC), 25–34. Memphis, TN, USA: IEEE, 2019. https:// doi.org/10.1109/VLHCC.2019.8818751. Chakravorti, Bhaskar. “AI’s Trust Problem.” Harvard Business Review, May 3, 2024. https://hbr.org/2024/05/ais-trust-problem. Cogo, Filipe Roseiro, Xin Xia, and Ahmed E. Hassan. “Assessing the Alignment between the Information Needs of Developers and the Documentation of Programming Languages: A Case Study on Rust.” ACM Transactions on Software Engineering and Methodology 32, no. 2 (April 30, 2023): 1–48. https://doi.org/10.1145/3546945. Deters, Hannah, Jakob Droste, and Kurt Schneider. “A Means to What End? Evaluating the Explainability of Software Systems Using Goal-Oriented Heuristics.” In Proceedings of the 27th International Conference on Evaluation and Assessment in Software Engineering, 329–38. Oulu Finland: ACM, 2023. https://doi.org/10.1145/3593434.3593444. Ding, Jiepin, Mingsong Chen, Ting Wang, Junlong Zhou, Xin Fu, and Keqin Li. “A Survey of AI-Enabled Dynamic Manufacturing Scheduling: From Directed Heuristics to Autonomous Learning.” ACM Computing Surveys 55, no. 14s (December 31, 2023): 1–36. https://doi.org/10.1145/3590163. Donoho, David. “Data Science at the Singularity.” Harvard Data Science Review 6, no. 1 (January 31, 2024). https://doi.org/10.1162/99608f92.b91339ef. Dutta, Subhabrata, and Tanmoy Chakraborty. “Thus Spake ChatGPT.” Communications of the ACM 66, no. 12 (December 2023): 16–19. https://doi.org/10.1145/3616863. Eng, Richard Kenneth. “How to Measure Programming Language Complexity,” n.d., 4. Forrester, Jay W. “Digital Computers: Present and Future Trends.” In Papers and Discussions Presented at the Dec. 10-12, 1951, Joint AIEE-IRE Computer Conference: Review of Electronic Digital Computers on - AIEE-IRE ’51, 109–14. Philadelphia, Pennsylvania: ACM Press, 1951. https://doi.org/10.1145/1434770.1434789. Gonzalez, Eric. “Improvisational Research: How I Learned to Stop Worrying and Embrace Uncertainty.” XRDS: Crossroads, The ACM Magazine for Students 30, no. 3 (March 2024): 10–11. https://doi.org/10.1145/3652615. Gosline, Renée Richardson, Yunhao Zhang, Haiwen Li, Paul Daugherty, Arnab D. Chakraborty, Philippe Roussiere, and Patrick Connolly. “Nudge Users to Catch Generative AI Errors.” MIT Sloan Management Review, May 29, 2024. https://sloanreview.mit.edu/ article/nudge-users-to-catch-generative-ai-errors/. Guo, Philip J. “Six Opportunities for Scientists and Engineers to Learn Programming Using AI Tools Such as ChatGPT.” Computing in Science & Engineering 25, no. 3 (May 2023): 73–78. https://doi.org/10.1109/MCSE.2023.3308476. Guzdial, Mark, and Daniel Reed. “Securing the Future of Computer Science; Reconsidering Analog Computing.” Communications of the ACM 56, no. 4 (April 2013): 12–13. https://doi.org/10.1145/2436256.2436260. Hao, Karen. “Inside the Fight to Reclaim AI from Big Tech’s Control | MIT Technology Review.” Accessed June 24, 2021. https://www.technologyreview.com/2021/06/14/1026148/ai-big-tech-timnit-gebru-paper-ethics/. Hinsen, Konrad. “The Approximation Tower in Computational Science: Why Testing Scientific Software Is Difficult.” Computing in Science & Engineering 17, no. 4 (July 2015): 72–77. https://doi.org/10.1109/MCSE.2015.75. ———. “The Power to Create Chaos.” Computing in Science & Engineering 18, no. 4 (July 2016): 75–79. https://doi.org/10.1109/MCSE.2016.67. Hope, Tom, Doug Downey, Daniel S. Weld, Oren Etzioni, and Eric Horvitz. “A Computational Inflection for Scientific Discovery.” Communications of the ACM 66, no. 8 (August 2023): 62–73. https://doi.org/10.1145/3576896. Jacobs, Adam. “The Pathologies of Big Data.” Communications of the ACM 52, no. 8 (August 2009): 36–44. https://doi.org/10.1145/1536616.1536632. Kesari, Ganes. “Building a Data-Driven Culture: Three Mistakes to Avoid.” MIT Sloan Management Review, May 14, 2024. https://sloanreview.mit.edu/article/building-a-data-driven-culture-three-mistakes-to-avoid/.

Slide 67

Slide 67 text

67 Kirkpatrick, Keith. “The Carbon Footprint of Artificial Intelligence.” Communications of the ACM 66, no. 8 (August 2023): 17–19. https://doi.org/10.1145/3603746. Kohls, Christian. “Patterns for Innovation: 6 Patterns for Idea Implementation.” In Proceedings of the 24th European Conference on Pattern Languages of Programs, 1–8. Irsee Germany: ACM, 2019. https://doi.org/10.1145/3361149.3361156. Koreeda, Yuta, Terufumi Morishita, Osamu Imaichi, and Yasuhiro Sogawa. “LARCH: Large Language Model-Based Automatic Readme Creation with Heuristics.” In Proceedings of the 32nd ACM International Conference on Information and Knowledge Management, 5066–70. Birmingham United Kingdom: ACM, 2023. https://doi.org/10.1145/3583780.3614744. Kosch, Thomas, Jakob Karolus, Johannes Zagermann, Harald Reiterer, Albrecht Schmidt, and Paweł W. Woźniak. “A Survey on Measuring Cognitive Workload in Human-Computer Interaction.” ACM Computing Surveys 55, no. 13s (December 31, 2023): 1–39. https://doi.org/10.1145/3582272. Kugler, Logan. “What’s Old Is New Again.” Communications of the ACM 66, no. 11 (November 2023): 11–12. https://doi.org/10.1145/3624009. Lu, Yuwen, Tiffany Knearem, Shona Dutta, Jamie Blass, Clara Kliman-Silver, and Frank Bentley. “AI Is Not Enough: A Hybrid Technical Approach to AI Adoption in UI Linting With Heuristics.” In Extended Abstracts of the CHI Conference on Human Factors in Computing Systems, 1–7. Honolulu HI USA: ACM, 2024. https://doi.org/10.1145/3613905.3637135. Melbourne, Associate Professor Jenny Waycott and Dr Wafa Johal, University of. “The Women Putting the Intelligence in Artificial Intelligence.” Pursuit, March 7, 2023. https://pursuit.unimelb.edu.au/articles/the-women-putting-the-intelligence-in-artificial- intelligence. Melbourne, Dr Mor Vered and Associate Professor Tim Miller, University of. “What Were You Thinking?” Pursuit, August 23, 2018. https://pursuit.unimelb.edu.au/articles/what-were-you-thinking. Nassif, Mathieu, and Martin P. Robillard. “A Field Study of Developer Documentation Format.” In Extended Abstracts of the 2023 CHI Conference on Human Factors in Computing Systems, 1–7. Hamburg Germany: ACM, 2023. https://doi.org/ 10.1145/3544549.3585767. Norman, Donald A. “Twelve Issues for Cognitive Science.” Cognitive Science 4, no. 1 (1980): 1–32. https://doi.org/10.1207/s15516709cog0401_1. Perkel, Jeffrey M. “Ten Computer Codes That Transformed Science.” Nature 589, no. 7842 (January 20, 2021): 344–48. https://doi.org/10.1038/d41586-021-00075-2. Potter, Hannah, Ardi Madadi, René Just, and Cyrus Omar. “Contextualized Programming Language Documentation.” In Proceedings of the 2022 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, 1–15. Auckland New Zealand: ACM, 2022. https://doi.org/10.1145/3563835.3567654. Quinn, Clark. “The Cognitive Science Behind Learning.” Chief Learning Officer - CLO Media (blog), December 23, 2016. https://www.chieflearningofficer.com/2016/12/23/cognitive-science-behind-learning/. Savage, Neil. “Revamping Python for an AI World.” Communications of the ACM 66, no. 12 (December 2023): 13–14. https://doi.org/10.1145/3624987. Sochat, Vanessa. “The 10 Best Practices for Remote Software Engineering.” Communications of the ACM 64, no. 5 (May 2021): 32–36. https://doi.org/10.1145/3459613. Stigliani, Kimberly D. Elsbach and Ileana. “Evaluating New Technology? You’re More Biased Than You May Realize.” MIT Sloan Management Review, September 23, 2020. https://sloanreview.mit.edu/article/evaluating-new-technology-youre-more-biased-than-you- may-realize/. Teng, Shang-Hua. “‘Intelligent Heuristics Are the Future of Computing.’” ACM Transactions on Intelligent Systems and Technology 14, no. 6 (December 31, 2023): 1–39. https://doi.org/10.1145/3627708. Tshukudu, Ethel, and Quintin Cutts. “Understanding Conceptual Transfer for Students Learning New Programming Languages.” In Proceedings of the 2020 ACM Conference on International Computing Education Research, 227–37. Virtual Event New Zealand: ACM, 2020. https://doi.org/10.1145/3372782.3406270. Writer, AIT Staff. “Explainable AI: 5 Popular Frameworks in Python.” AiThority (blog), February 14, 2023. https://aithority.com/technology/explainable-ai-5-popular-frameworks-in-python-to-explain-your-models/. Ziegler, Albert, Eirini Kalliamvakou, X. Alice Li, Andrew Rice, Devon Rifkin, Shawn Simister, Ganesh Sittampalam, and Edward Aftandilian. “Measuring GitHub Copilot’s Impact on Productivity.” Communications of the ACM 67, no. 3 (March 2024): 54–63. https:// doi.org/10.1145/3633453.

Slide 68

Slide 68 text

EuroPython July 10, 2024 Embracing Python, AI, and Heuristics Optimal Path to Impactful Software 68 Carol Willing