Anthony Shaw - Wily Python: Writing simpler and more maintainable Python - PyCon 2019

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • "Speaker: Anthony Shaw
    Everyone starts with the best intentions with their Python projects, ""this time it's going to be clean, simple and maintainable"". But code evolves over time, requirements change and codebases can get messy and complicated quickly.
    In this talk, you will learn how to use `wily` to measure and graph how complicated your Python code is and a series of practical techniques to simplify it. `wily` will show you which parts of your projects are becoming or have become hard to maintain and need a refactor. Once you know where the skeletons are, you will learn practical techniques for refactoring ""complex"" code and some resources to use to take your refactoring to the next level.
    Slides can be found at: speakerdeck.com/pycon2019 and github.com/PyCon/2019-slides"

ความคิดเห็น • 18

  • @stalinthomas9850
    @stalinthomas9850 3 ปีที่แล้ว +8

    05:12 Cyclomatic Complexity
    10:12 Halstead Metrics
    13:18 Maintainability Index
    14:56 Radon
    16:12 Wily
    16:54 Demo
    20:08 Gravity of Complexity
    21:36 Testing and refactoring
    24:01 Summary
    26:40 QnA

  • @dmitriyg1030
    @dmitriyg1030 5 ปีที่แล้ว +29

    Had anyone ever had an idea to measure code complexity of popular libs / frameworks such as pandas or Django , with this nice tool? That would be a nice research.

  • @SanemSSever
    @SanemSSever 4 ปีที่แล้ว +15

    Loved the readability counts joke :)

  • @02TLE
    @02TLE 4 ปีที่แล้ว +6

    Great Pycon talk, you should definitely do more of those

  • @dmitrysysoev4254
    @dmitrysysoev4254 4 ปีที่แล้ว +2

    Very useful tool in production! Thank you, authors.

  • @luckiertwin2
    @luckiertwin2 3 ปีที่แล้ว +1

    Excellent talk and tool.

  • @willd0g
    @willd0g 2 ปีที่แล้ว

    I really enjoyed that talk thanks.

  • @FinallyAFreeUsername
    @FinallyAFreeUsername 5 ปีที่แล้ว +3

    Oooh, that's clever!

  • @hotharvey2
    @hotharvey2 3 ปีที่แล้ว +1

    Nice talk. Would have appreciated some more complex practical examples of good refactoring from complex->simpler code.
    I will be using Wily :)

  • @patrickmullan8356
    @patrickmullan8356 4 ปีที่แล้ว

    How to record and (visually) replay the keystrokes on the shell, as he shows at around 17:00?

  • @sreeragm8366
    @sreeragm8366 3 ปีที่แล้ว

    Is there a way to identify why cc or mi affected?

  • @disenchitilapillydevassy6203
    @disenchitilapillydevassy6203 ปีที่แล้ว

    Do we have a github action file/docs for wiley ?

  • @jayprakashs
    @jayprakashs 5 ปีที่แล้ว +7

    github link mentioned is not correct. it opens "page not found". could not get the slides from speakerdeck as well. :( Please help.

    • @AnthonyShaw
      @AnthonyShaw 5 ปีที่แล้ว +20

      My website is tonybaloney.github.io/ that should have a link to most of the related repos. Wily is at github.com/tonybaloney/wily

    • @polares8187
      @polares8187 5 ปีที่แล้ว +5

      @@AnthonyShaw Awesome talk man. People like you makes me love python.

  • @unperrier5998
    @unperrier5998 4 ปีที่แล้ว +5

    Anyone who is willing to use radon and wily should also read this:
    avandeursen.com/2014/08/29/think-twice-before-using-the-maintainability-index/
    In particular the original formula is for languages like C and pascal, but it hasn't been updated fo python.

    • @DavidFarnan
      @DavidFarnan 3 ปีที่แล้ว +1

      Let me summarize the article: You should use lines of code because the weights in the equation for maintainability index are partly empirical and partly opinion. They were derived for other languages which vary a lot from python. Also LOC is stupid simple to use.
      But he doesn't have any compelling arguments to detract from the fundamental measures derived in the process of calculating MI, or any counter points to the issues with using lines of code blindly in languages like python where there can be strong motivation toward complex one liners that can make for heavy lines of code. Nor does propose anything better.
      I think the middle ground is to use the raw metrics for your project and modules, and to use good judgement when reviewing pull requests. There is no substitute for peer review and MI is no silver bullet.
      Technical debt if left untended will compound. Developers should learn to be mindful of technical debt, and as with all chores in programming we'll try to automate it. But these tools are never a substitute for experience and sound judgement, and if used as a blunt object to bludgeon your team will cause more harm than good.