Timnology
Timnology
  • Видео 3
  • Просмотров 15 317
Setup a modern Python Code Quality CI Pipeline using UV, Ruff and more
This video shows how to setup a modern CI Pipeline using various tools such as UV, Ruff, Pytest and Pyright.
A write-up is available at: www.timnology.io/articles/python-ci
The repo is available at github.com/timvancann/yt-python-ci
Buy me a coffee: buymeacoffee.com/timvancann
#code #python #tutorial #education #cicd #uv #ruff #pyright
00:00:00 Intro
00:00:18 Initialisation
00:00:35 Lock file
00:01:33 Linting
00:02:09 Formatting
00:03:01 Type Checking
00:04:17 Unit Tests
00:05:19 Building
00:05:49 Code Coverage
00:06:32 GitHub Action
00:06:44 Conclusion
Просмотров: 3 051

Видео

UV - A modern python project and dependency manager
Просмотров 10 тыс.3 месяца назад
This video showcase the latest features of UV after their impressive blogpost: astral.sh/blog/uv-unified-python-packaging A write-up is available at: www.timnology.io/articles/uv Buy me a coffee: buymeacoffee.com/timvancann #code #python #tutorial #education 00:00 Intro 00:28 Installation 00:45 Initialization 01:07 Adding dependencies 01:37 Running commands 03:24 Installing python 04:15 Speed t...
Master the python logging module
Просмотров 2,6 тыс.3 месяца назад
This video gives insight into the python logging module. Master handers, filters, formatters, log hierarchy and log configuration. A write-up is available at www.timnology.io/articles/python-logging Buy me a coffee: buymeacoffee.com/timvancann #python #code #tutorial #education 0:00 Intro 0:18 Logger 0:28 LogLevels 1:04 Handlers 1:42 Handler loglevel 2:07 Handler formatter 2:55 LastResort handl...

Комментарии

  • @sglbl
    @sglbl 16 часов назад

    Thank you. One suggesstion; When you share the screen, there should be some space at the bottom of terminal text input place so that when we pause the video, youtube's bar will not block the input and we will still be able to see the input.

  • @AJXD2
    @AJXD2 День назад

    Its lowkey hard to tell that you have 600 subs. I got to 4:00 before I looked down by accident and saw it. Keep it up!

  • @porlando12
    @porlando12 День назад

    Amazing video! This channel is criminally underrated. It would be cool to see how you would migrate an existing project managed via poetry over to using uv in a future video!

  • @eboyd53
    @eboyd53 2 дня назад

    What IDE are you using?

    • @Timnology-r4s
      @Timnology-r4s 2 дня назад

      I wouldn't call it an IDE though it comes close to one: in this video I use neovim, with the astronvim.com/ distribution. Typically I use JetBrains IntelliJ for my day to day job.

  • @kamurashev
    @kamurashev 3 дня назад

    Cough npm cough… it might be good the only thing it must be adopted as a language standard first

  • @williansuarez3988
    @williansuarez3988 3 дня назад

    ¡Excelente! aunque no entendí todo ¿que puedo hacer para aprender y llegar a ese nivel?

  • @froozynoobfan
    @froozynoobfan 4 дня назад

    just working on my own package, any reason you did not use "uv build"?

    • @Timnology-r4s
      @Timnology-r4s 3 дня назад

      I see I made a boo Boo there. I wrote the repo before uv added a build backend, but recorded the video after they did. So the cli command uses `uv build`, but the CI uses `uv run build`. It should be `uv build` everywhere. Good catch!

  • @zuowang5185
    @zuowang5185 4 дня назад

    Is it fast on cold CI start? Does it generate cross platform lockfile?

    • @Timnology-r4s
      @Timnology-r4s 4 дня назад

      Yes it is fast. If not fast enough you can enable caching: github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching Yes, the lock file is cross platform compatible.

  • @tomasemilio
    @tomasemilio 4 дня назад

    High quality videos, congratulations!

  • @7006608
    @7006608 5 дней назад

    Tip: vertical flip your head video to point to the screen instead off screen thanks for the video!

    • @Timnology-r4s
      @Timnology-r4s 5 дней назад

      Oh snap, that's a good tip. I've never even thought about that!

  • @this-is-bioman
    @this-is-bioman 6 дней назад

    It does not look like any kind of breakthrough. Just another package manager on top of an existing one with even more new commands to learn.

  • @tomasemilio
    @tomasemilio 6 дней назад

    works great, but my lsp is complaning when i install other packages, as though they weren't installed

    • @Timnology-r4s
      @Timnology-r4s 6 дней назад

      99% chance your lsp is using the wrong interpreter. If you use neovim (or zed, or helix), there are plugins that allow you to easily switch venv, but what I found works great is: uv run nvim . That automatically launches vim with the correct venv. In vscode no clue, you probably have to setup a python interpreter by pointing to the .venv/bin/python script. The same holds true for Jetbrains products.

    • @tomasemilio
      @tomasemilio 6 дней назад

      @@Timnology-r4s hero! haha amazing and yeah that is it. i will slowly transition to UV, it really looks amazing.

  • @bigoper
    @bigoper 6 дней назад

    New SUB here Just flawless ❤

  • @SalahSaoud-j5s
    @SalahSaoud-j5s 7 дней назад

    Wonderful video. Just one question. In order to format and apply the fixes before commits, do you run each ruff, pytest, pyright ... commands manually or do you use some other tools like Tox?

    • @Timnology-r4s
      @Timnology-r4s 7 дней назад

      Good question! Perhaps I should do a video about that as well. I typically setup a solid pre-commit hook that does all that, as well as making sure my editor does formatting on auto-save.

    • @SalahSaoud-j5s
      @SalahSaoud-j5s 7 дней назад

      @@Timnology-r4s That would be a great follow up video for this one. I look forward for that. Thanks again for the great videos.

  • @juvewan
    @juvewan 8 дней назад

    A great video for using uv in CI. Do you use uv in pre commit hooks or in IDE? I am trying to automate python code formatting, so IDE and/or pre-commit hooks can take care of it, and CI won't complain about formatting error.

    • @Timnology-r4s
      @Timnology-r4s 8 дней назад

      Good question. I use both. For neovim none-ls with ruff, and in IntelliJ with the ruff plugin. This takes care of auto formatting on save. Pre-commit books are there to verify and pick up anything that the IDE missed (as well as doing a bunch of other things, like running tests)

    • @juvewan
      @juvewan 7 дней назад

      @@Timnology-r4s thank you!

  • @guidyouguy7306
    @guidyouguy7306 8 дней назад

    Poetry does the same thing

    • @Timnology-r4s
      @Timnology-r4s 8 дней назад

      Some of it, yes. Though poetry isn't fully PEP compliant and is significantly slower on large projects.

  • @noopurp123
    @noopurp123 9 дней назад

    What terminal are you using there?

  • @felipeadeildo
    @felipeadeildo 9 дней назад

    A thing that I really like at using poetry as my project dependency manager is that it's create the virtual environment folder outside the project, that's really a cool function So, how can I do the same thing with UV? I noticed that is has been created a .venv folder at the root project...

    • @Timnology-r4s
      @Timnology-r4s 9 дней назад

      Personally, I really like having the .venv folder right where the code lives. However, uv does give you the option to specify a custom folder: docs.astral.sh/uv/pip/environments/#creating-a-virtual-environment

  • @Anh_AI
    @Anh_AI 10 дней назад

    Sir, 2 Q that I want to ask: 1. How can train/run Yolo with GPU (that Pytorch only install with pip?) 2. How to build uv python app to exe?

    • @Timnology-r4s
      @Timnology-r4s 9 дней назад

      1. I never work with pytorch, but this github issue seems to have a solution running on GPU: github.com/astral-sh/uv/issues/7202#issuecomment-2447539317. 2. To get a python exe you can use pyinstaller.org/en/stable/. A simple `uv add --dev pyinstaller ` and `uv run pyinstaller` would do the trick :)

  • @tridibbiswas3361
    @tridibbiswas3361 11 дней назад

    Thank you for your video. I am newbie and learning. This was really helpful. Also, if you don’t mind a trivial ask , I liked your font and color scheme- could you share the names

    • @Timnology-r4s
      @Timnology-r4s 11 дней назад

      Glad you found it useful. All questions are welcome! I use the open source Jetbrains Mono Nerd font (www.nerdfonts.com/font-downloads), and Catppuccin Mocha color scheme (catppuccin.com/)

  • @mrttsmn
    @mrttsmn 11 дней назад

    Well this looks great but do i need to manually update and manually manage dependencies for every uv version?

    • @Timnology-r4s
      @Timnology-r4s 11 дней назад

      Not precisely, like with requirements.txt, or Poetry, you need to manage your dependencies per project. The version of uv you are running doesn't matter. UV is there to resolve the complicated dependency tree that is pip.

  • @agentDueDiligence
    @agentDueDiligence 12 дней назад

    Good content!

  • @agentDueDiligence
    @agentDueDiligence 12 дней назад

    This was a great video. I understand now, why you should maybe use uv in python projects

  • @rosslote1895
    @rosslote1895 12 дней назад

    I'm following this exactly and locally --locked is fine but when I trigger the action it fails. Any ideas? All of my code is commited and pushed

    • @rosslote1895
      @rosslote1895 12 дней назад

      I change the version of astral-sh/setup-uv@v3 to latest and it fixed the issue. Great content by the way.

    • @Timnology-r4s
      @Timnology-r4s 10 дней назад

      Glad you found the fix!

  • @1Docflash
    @1Docflash 12 дней назад

    lol. may be great tool but i followed your directions and only get error messages. bummer glad it worked for other people

    • @Timnology-r4s
      @Timnology-r4s 12 дней назад

      What kind of error messages did you get?

  • @jarrettbullion1545
    @jarrettbullion1545 15 дней назад

    partly why your dependencies installed so quick is because they are cached on your machine.

    • @Timnology-r4s
      @Timnology-r4s 14 дней назад

      That is correct, though even after removing the cache the installation is single digit seconds. The power of UV really shines in its completeness as a tool, PEP compliancy and lightning fast dependency resolution.

  • @DataScienceandAI-doanngoccuong
    @DataScienceandAI-doanngoccuong 19 дней назад

    tui thấy giống npm install (package.js) trong javaScripts.

  • @djpaulytee
    @djpaulytee 19 дней назад

    Hi Tim, interesting video. What is the plugin you are using for the popup terminal?

    • @Timnology-r4s
      @Timnology-r4s 19 дней назад

      It's the build in terminal In astronvim: toggleterm (github.com/akinsho/toggleterm.nvim)

  • @erfan_ops
    @erfan_ops 19 дней назад

    i was expecting to see a 'K' by the subscribers count

  • @samjiman
    @samjiman 24 дня назад

    Most of my Python code only uses the standard library (theres a heck of a lot you can do with those batteries) and a lot of modules I prefer to implement my own classes/functions. Might try with my Flask apps though or maybe if I made some of my stuff libraries on PIP.

  • @EmersonArenas-n1v
    @EmersonArenas-n1v 24 дня назад

    fantastic video, can you make a video of Granian and Rust based frameworks?

    • @Timnology-r4s
      @Timnology-r4s 22 дня назад

      Thank you! I'm not planning on doing a lot of lower level videos, if anything it's going to be a video of FastAPI which used Granian under the hood as ASGI framework.

  • @pyalgoGPT
    @pyalgoGPT 24 дня назад

    Sir, you are a fabulous teacher ,who can make familiar a new tool in project management in just 6 minutes !!! Its lesson on how to make learning simple, yet effective with time consciousness . Thank you & heartful respect from India. Looking for more such videos.

  • @froozynoobfan
    @froozynoobfan 26 дней назад

    i'm loving your vids, maybe something like metrics would be right up your alley

    • @Timnology-r4s
      @Timnology-r4s 22 дня назад

      I do have a video planned about metrics and tracing (e.g. Sentry, Datadog, Prometheus, otel etc). I'm still in the brainstorming phase though :)

  • @froozynoobfan
    @froozynoobfan 26 дней назад

    great video! i'll watch more of you!

  • @sergio.sepulveda
    @sergio.sepulveda 28 дней назад

    Subscribed! Your explanation is very professional, thank you from Chile 🇨🇱

  • @adrians.965
    @adrians.965 Месяц назад

    I watch youtube from my mobile phone most of the time. The font is too small for me. 🥲

  • @danfreimann
    @danfreimann Месяц назад

    Nice Video! That will definitely help me with creating some piplines for my python applications.

  • @rschalch
    @rschalch Месяц назад

    I used to have pyenv creating some venvs for my machine, not project related ... can uv do the same?

    • @Timnology-r4s
      @Timnology-r4s Месяц назад

      Yes, that is possible. Though you have to specify the path to the environment. docs.astral.sh/uv/pip/environments/#creating-a-virtual-environment

  • @abessesmahi4888
    @abessesmahi4888 Месяц назад

    Thank you so much for this great and high quality content. Please increase the editor font size a little bit. Subscribed <3

  • @0xBerto
    @0xBerto Месяц назад

    Question, so I can run any of my already existing Python projects just preface the command with UV (after installing)?

    • @Timnology-r4s
      @Timnology-r4s Месяц назад

      Provided your toml file is setup correctly, yes.

  • @0xBerto
    @0xBerto Месяц назад

    Great explanation in the right amount of time sir. Thank you 🙏 subbed

  • @rikaminski
    @rikaminski Месяц назад

    Thanks for easy share.

  • @2Tiny4U
    @2Tiny4U Месяц назад

    Thank you for this introductory video. Your terminal has a very clean look. Would you mind sharing information about the terminal, theme, fonts and file/folder icons? I already found out about bat in the other comments.

    • @Timnology-r4s
      @Timnology-r4s Месяц назад

      Of course! The terminal in the video is Warp (www.warp.dev/), I go back and forth between it and WezTerm. I use the basic prompt from Starship (starship.rs/) and Catppuccin Mocha as theme. I also aliased `exa` (github.com/ogham/exa) to `ll` which, together with the Jetbrains Mono font, gives the nice icons and colored `ls` output.

  • @danbochman
    @danbochman Месяц назад

    Great video! Keep at it 💪

  • @vidyesh
    @vidyesh Месяц назад

    UV is malfunctioning on Jetbrains fleet.

    • @Timnology-r4s
      @Timnology-r4s Месяц назад

      In which way? UV is a cli tool.

    • @vidyesh
      @vidyesh Месяц назад

      @@Timnology-r4s UV pip compile requirements in to requirements txt is writing in Chinese on Jetbrains fleet while in vscode not getting error.

    • @Timnology-r4s
      @Timnology-r4s Месяц назад

      That is not something I can help you with. Most likely an editor or OS language setting.

    • @vidyesh
      @vidyesh Месяц назад

      @@Timnology-r4s No problem and thank you for your time. I just mentioned the error I am getting on fleet maybe because its still in beta.

  • @SimoneGiacomelli
    @SimoneGiacomelli 2 месяца назад

    The content quality is amazing. Complete, concentrated and straight to the point. Awesome, thank you!

    • @Timnology-r4s
      @Timnology-r4s 2 месяца назад

      Thanks for the positive feedback!

  • @tiolv1174
    @tiolv1174 2 месяца назад

  • @akshayshinde8573
    @akshayshinde8573 2 месяца назад

    Great work, really high quality content.

  • @UTJK.
    @UTJK. 2 месяца назад

    What kind of terminal or configuration (not sure) do you use to have syntax highlighting and "cat" being able to output with that structure?

    • @Timnology-r4s
      @Timnology-r4s 2 месяца назад

      Most modern terminals have nice colors, I personally switch occasionally between Warp and Wezterm, mostly using catppuccin or rosepine color schemes. For `cat` specifically I aliased `bat` to `cat`: github.com/sharkdp/bat

    • @imonlyonesam
      @imonlyonesam Месяц назад

      The cat he's using in the video is `bat`, presumably just with `alias cat=bat`

  • @blanky_nap
    @blanky_nap 2 месяца назад

    Great tool! Clean explanation. Would like to see more tutorials on uv