Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#312: AI Goes on Trial For Writing Code

Published Tue, Nov 29, 2022, recorded Tue, Nov 29, 2022
Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

About the show

Sponsored by Complier Podcast from RedHat

Connect with the hosts

Brian #1: Coping strategies for the serial project hoarder

  • Simon Willison
  • Also a talk from DjangoCon2022
  • I’m actually not sure what title would be best, but this is an incredible video that I’m encouraging every developer to watch, whether or not you work with open source projects.
  • Covers
    • The perfect commit
      • Implementation, Tests, Documentation, and a link to an issue thread
    • Tests
      • Prove the implementation works, pass if it works, fails otherwise
      • A discussion of how adding tests is way easier than starting testing a project, so get the framework in place early, and devs won’t be afraid to add to it.
    • Cookiecutter repo templates for projects you will likely start
      • super cool idea to have your own that you keep up to date with your preferred best practices
    • A trick for using GitHub actions to use those templates to populate new repos
      • Trying this out is on my todo list
    • Documentation must live in the same repo as the code
      • and be included in PRs for the PR to be accepted by code review
      • maybe even test this using documentation unit tests
    • Everything links to an issue thread
      • Keep all of your thoughts in an issue thread
      • Doesn’t have to be a dialog with anyone but yourself
      • This allows you to NOT HAVE TO REMEMBER ANYTHING
    • Tell people what you did
      • This is just as important in work projects as it is in open source
      • Blog about it
      • Post on Twitter (or Mastodon, etc.)
    • Avoid side projects with user accounts
      • “If you build something that people can sign into, that’s not a side-project, it’s an unpaid job. It’s a very big responsibility, avoid at all costs!” - this is hilarious and something I’m probably not going to follow

Michael #2: GitHub copilot lawsuit

  • First, we aren’t lawyers
  • Lawsuit filed on November 3, 2022
  • We’ve filed a lawsuit challenging GitHub Copilot, an AI product that relies on unprecedented open-source software piracy.
  • GitHub copilot is trained on projects on GitHub, including GPL and other restrictive licenses
  • This is the first class-action case in the US challenging the training and output of AI systems.

Brian #3: Use Windows Dialog Boxes from Python with no extra libraries

  • Actual title: Display a message box with Python without using a non-standard library or other dependency (Windows)
  • By Matt Callahan / learned about from from PyCoders weekly
  • When I need a simple pop up dialog box that’s cross platform, PySimpleGUI is awesome and so easy.
  • But when I KNOW it’s only going to run on Windows, why not just use native dialog boxes?
  • Matt’s article shows you how, using ctypes to call into a Windows dll.
  • Small example from article:

    import ctypes
    
        def main():
            WS_EX_TOPMOST = 0x40000
            windowTitle = "Python Windows Message Box Test"
            message = "Hello, world!"
            # display a message box; execution will stop here until user acknowledges
            ctypes.windll.user32.MessageBoxExW(None, message, windowTitle, WS_EX_TOPMOST)
            print("User clicked OK.")
    
        if __name__ == "__main__":
            main()
    
    
  • Notes:

    • The uType (fourth) parameter is a multi-use value that can be or-ed for things like:
      • Type of dialog box: Help, OK, OK/Cancel, Retry/Cancel, Yes/No, etc.
      • The icon to use: Exclamation, Info, Question, etc.
      • Modality, …
    • Return value is used to understand how user reacted:
      • 1 - OK, 2 - Cancel (or x), …, 6 - Yes, 7 - No, …

Michael #4: Extra Extra Extra


Want to go deeper? Check our projects