pytudes VS pre-commit

Compare pytudes vs pre-commit and see what are their differences.

pytudes

Python programs, usually short, of considerable difficulty, to perfect particular skills. (by norvig)

pre-commit

A framework for managing and maintaining multi-language pre-commit hooks. (by pre-commit)
Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
pytudes pre-commit
100 192
22,331 12,006
- 2.3%
7.7 8.0
7 days ago 13 days ago
Jupyter Notebook Python
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

pytudes

Posts with mentions or reviews of pytudes. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-19.
  • Ask HN: High quality Python scripts or small libraries to learn from
    12 projects | news.ycombinator.com | 19 Apr 2024
    Peter Norvig's work is great to learn from https://github.com/norvig/pytudes
  • Norvig's 2023 Advent of Code
    1 project | news.ycombinator.com | 28 Mar 2024
  • Ask HN: How to build mastery in Python?
    1 project | news.ycombinator.com | 8 Mar 2024
  • SQL for Data Scientists in 100 Queries
    5 projects | news.ycombinator.com | 6 Feb 2024
  • Bicycling Statistics
    1 project | news.ycombinator.com | 28 Nov 2023
  • Ask HN: How to deal with the short vs. long function argument
    1 project | news.ycombinator.com | 8 Nov 2023
    I've been a programmer for 25 years. A realization that has crept up on me in the last 5 is that not everyone thinks that functions should be short: there are two cultures, with substantial numbers of excellent programmers belonging to both. My question is: how do we maintain harmonious, happy, and productive teams when people can disagree strongly about this issue?

    The short-functions camp holds that functions should be short, tend toward the declarative, and use abstraction/implementation-hiding to increase readability (i.e. separable subsections of the function body should often be broken out into well-named helper functions). As an example, look at Peter Norvig's beautiful https://github.com/norvig/pytudes. For a long time I thought that this was how all "good programmers" thought code should be written. Personally, I spent over a decade writing in a dynamic and untyped language, and the only way that I and my colleagues could make that stuff reliable was to write code adhering to the tenets of the short-function camp.

    The long-functions camp is, admittedly, alien to me, but I'll try to play devil's advocate and describe it as I think its advocates would. It holds that lots of helper functions are artificial, and actually make it _harder_ to read and understand the code. They say that they like "having lots of context", i.e. seeing all the implementation in one long procedural flow, even though the local variables fall into non-interacting subsets that don't need to be in the same scope. They hold that helper functions destroy the linear flow of the logic, and that they should typically not be created unless there are multiple call sites.

    The short-function camp also claims an advantage regarding testability.

    Obviously languages play a major role in this debate: e.g. as mentioned above, untyped dynamic languages encourage short functions, and languages where static compilation makes strong guarantees regarding semantics at least make the long-function position more defensible. Expression-oriented and FP-influenced languages encourage short functions. But it's not obvious, e.g. Rust could go both ways based on the criteria just mentioned.

    Anyway, more qualified people could and have written at much greater length about the topic. The questions I propose for discussion include

    - Is it "just a matter of taste", or is this actually a more serious matter where there is often an objective reason for discouraging the practices of one or other camp?

    - How can members of the different camps get along harmoniously in the same team and the same codebase?

  • Pytudes
    1 project | /r/hypeurls | 25 Aug 2023
    3 projects | news.ycombinator.com | 23 Aug 2023
    I have the same impression. Reading the code, he uses global variables [1], obscure variable (k, bw, fw, x) and module names ("pal.py" instead of "palindromes.py"), doesn’t respect conventions about naming in general (uppercase arguments [2], which even the GitHub syntax highlighter is confused about). This feels like code you write for yourself to play with Python and don’t plan to read later.

    Some parts of the code feel like what I would expect from a junior dev who started learning the language a couple weeks ago.

    [1]: https://github.com/norvig/pytudes/blob/952675ffc70f3632e70a7...

    [2]: https://github.com/norvig/pytudes/blob/952675ffc70f3632e70a7...

  • Ask HN: Where do I find good code to read?
    22 projects | news.ycombinator.com | 24 Aug 2023
  • Using Prolog in Windows NT Network Configuration (1996)
    5 projects | news.ycombinator.com | 21 Jul 2023
    Prolog is excellent for bikeshedding, in fact that might be its strongest axis. It starts with everything you get in a normal language such as naming things, indentation, functional purity vs side effects, where to break code into different files and builds on that with having your names try to make sense in declarative, relational, logical and imperative contexts, having your predicates (functions) usable in all modes - and then performant in all modes - having your code be deterministic, and then deterministic in all modes. Being 50 years old there are five decades of learning "idiomatic Prolog" ideas to choose from, and five decades of footguns pointing at your two feet; it has tabling, label(l)ing, SLD and SLG resolution to choose from. Built in constraint solvers are excellent at tempting you into thinking your problem will be well solved by the constraint solvers (it won't be, you idiot, why did you think that was a constraint problem?), two different kinds of arithmetic - one which works but is bad and one which mostly works on integers but clashes with the Prolog solver - and enough metaprogramming that you can build castles in the sky which are very hard to debug instead of real castles. But wait, there's more! Declarative context grammars let you add the fun of left-recursive parsing problems to all your tasks, while attributed variables allow the Prolog engine to break your code behind the scenes in new and interesting ways, plenty of special syntax not to be sneezed at (-->; [_|[]] {}\[]>>() \X^+() =.. #<==> atchoo (bless you)), a delightful deep-rooted schism between text as linked lists of character codes or text as linked lists of character atoms, and always the ISO-Standard-Sword of Damocles hanging over your head as you look at the vast array of slightly-incompatible implementations with no widely accepted CPython-like-dominant-default.

    Somewhere hiding in there is a language with enough flexibility and metaprogramming to let your meat brain stretch as far as you want, enough cyborg attachments to augment you beyond plain human, enough spells and rituals to conjour tentacled seamonsters with excellent logic ability from the cold Atlantic deeps to intimidate your problem into submission.

    Which you, dear programmer, can learn to wield up to the advanced level of a toddler in a machine shop in a mere couple of handfuls of long years! Expertise may take a few lifetimes longer - in the meantime have you noticed your code isn't pure, doesn't work in all modes, isn't performant in several modes, isn't using the preferred idiom style, is non-deterministic, can't be used to generate as well as test, falls into a left-recursive endless search after the first result, isn't compatible with other Prolog Systems, and your predicates are poorly named and you use the builtin database which is temptingly convenient but absolutely verboten? Plenty for you to be getting on with, back to the drawing boar...bikeshed with you.

    And, cut! No, don't cut; OK, green cuts but not red cuts and I hope you aren't colourblind. Next up, coroutines, freeze, PEngines, and the second 90%.

    Visit https://www.metalevel.at/prolog and marvel as a master deftly disecting problems, in the same way you marvel at Peter Norvig's Pytudes https://github.com/norvig/pytudes , and sob as the wonders turn to clay in your ordinary hands. Luckily it has a squeaky little brute force searcher, dutifully headbutting every wall as it explores all the corners of your problem on its eventual way to an answer, which you can always rely on. And with that it's almost like any other high level mostly-interpreted dynamic programming / scripting language.

pre-commit

Posts with mentions or reviews of pre-commit. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-29.
  • How to setup Black and pre-commit in python for auto text-formatting on commit
    3 projects | dev.to | 29 Mar 2024
    Today we are going to look at how to setup Black (a python code formatter) and pre-commit (a package for handling git hooks in python) to automatically format you code on commit.
  • Implementing Quality Checks In Your Git Workflow With Hooks and pre-commit
    6 projects | dev.to | 13 Dec 2023
    # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-toml - id: check-added-large-files - repo: local hooks: - id: tox lint name: tox-validation entry: pdm run tox -e test,lint language: system files: ^src\/.+py$|pyproject.toml|^tests\/.+py$ types_or: [python, toml] pass_filenames: false - id: tox docs name: tox-docs language: system entry: pdm run tox -e docs types_or: [python, rst, toml] files: ^src\/.+py$|pyproject.toml|^docs\/ pass_filenames: false - repo: https://github.com/pdm-project/pdm rev: 2.10.4 # a PDM release exposing the hook hooks: - id: pdm-lock-check - repo: https://github.com/jumanjihouse/pre-commit-hooks rev: 3.0.0 hooks: - id: markdownlint
  • Embracing Modern Python for Web Development
    12 projects | dev.to | 8 Dec 2023
    Pre-commit hooks act as the first line of defense in maintaining code quality, seamlessly integrating with linters and code formatters. They automatically execute these tools each time a developer tries to commit code to the repository, ensuring the code adheres to the project's standards. If the hooks detect issues, the commit is paused until the issues are resolved, guaranteeing that only code meeting quality standards makes it into the repository.
  • EmacsConf Live Now
    4 projects | news.ycombinator.com | 2 Dec 2023
  • A Tale of Two Kitchens - Hypermodernizing Your Python Code Base
    31 projects | dev.to | 12 Nov 2023
    Pre-commit Hooks: Pre-commit is a tool that can be set up to enforce coding rules and standards before you commit your changes to your code repository. This ensures that you can't even check in (commit) code that doesn't meet your standards. This allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks.
  • Things I just don't like about Git
    6 projects | news.ycombinator.com | 8 Oct 2023
    Ah, fair enough!

    On my team we use pre-commit[0] a lot. I guess I would define the history to be something like "has this commit ever been run through our pre-commit hooks?". If you rewrite history, you'll (usually) produce commits that have not been through pre-commit (and they've therefore dodged a lot of static checks that might catch code that wasn't working, at that point in time). That gives some manner of objectivity to the "history", although it does depend on each user having their pre-commit hooks activated in their local workspace.

    [0]: https://pre-commit.com/

  • Django Code Formatting and Linting Made Easy: A Step-by-Step Pre-commit Hook Tutorial
    7 projects | dev.to | 4 Oct 2023
    Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. It supports hooks for various programming languages. Using this framework, you only have to specify a list of hooks you want to run before every commit, and pre-commit handles the installation and execution of those hooks despite your project’s primary language.
  • Git: fu** the history!
    2 projects | dev.to | 14 Sep 2023
    You can learn more here: pre-commit.com
  • [Tool Anouncement] github-distributed-owners - A tool for managing GitHub CODEOWNERS using OWNERS files distributed throughout your code base. Especially helpful for monorepos / multi-team repos
    2 projects | /r/github | 13 Sep 2023
    Note this includes support for pre-commit.
  • Packaging Python projects in 2023 from scratch
    2 projects | /r/Python | 6 Sep 2023
    As a nice next step, you could also add mypy to check your type hints are consistent, and automate running all this via pre-commit hooks set up with… pre-commit.

What are some alternatives?

When comparing pytudes and pre-commit you can also consider the following projects:

paip-lisp - Lisp code for the textbook "Paradigms of Artificial Intelligence Programming"

husky - Git hooks made easy 🐶 woof!

asgi-correlation-id - Request ID propagation for ASGI apps

gitleaks - Protect and discover secrets using Gitleaks 🔑

clerk - ⚡️ Moldable Live Programming for Clojure

ruff - An extremely fast Python linter and code formatter, written in Rust.

nbmake - 📝 Pytest plugin for testing notebooks

semgrep - Lightweight static analysis for many languages. Find bug variants with patterns that look like source code.

PySimpleGUI - Python GUIs for Humans! PySimpleGUI is the top-rated Python application development environment. Launched in 2018 and actively developed, maintained, and supported in 2024. Transforms tkinter, Qt, WxPython, and Remi into a simple, intuitive, and fun experience for both hobbyists and expert users.

Poetry - Python packaging and dependency management made easy

project-based-learning - Curated list of project-based tutorials

pre-commit-golang - Pre-commit hooks for Golang with support for monorepos, the ability to pass arguments and environment variables to all hooks, and the ability to invoke custom go tools.