HNHacker News
TopNewBestAskShowJobs

cdrt

91 karma · joined October 16, 2020

submissionscomments
cdrt··on Fish – Update on the Rust port
Your example proves that not using arrays is worse. That loop will only run once and just print every element on one line. The array equivalent works as expected , _isn't_ affected by IFS, and can handle spaces in individual elements

    f='a b c d e'
    for i in "$f"; do echo $i; done
    # prints a b c d e

    f="a b c 'd e'"
    for i in $f; do echo $i; done
    # prints
    # a
    # b
    # c
    # 'd
    # e'

    f=(a b c 'd e')
    for i in "${f[@]}"; do echo $i; done
    # prints
    # a
    # b
    # c
    # d e
cdrt··on Fish – Update on the Rust port
You wouldn’t iterate over `echo *` anyway. This works just fine in bash/sh:

    for file in *; do
        echo "$file"
    done
cdrt··on Why GNU su does not support the `wheel' group (2002)
You’re thinking about it backwards

`su` predates `sudo` by a decade doesn’t offer the fine-grained control `sudo` has. With `su` if you have the root password, you can do anything you want as root. With `sudo` admins can configure what commands users are allowed to run as root and could specifically block `sudo bash` from running.

cdrt··on You shouldn't invoke setup.py directly
You don't need to completely change if you don't want to. setuptools will most likely continue supporting the old way for a long time since there is so much Python code out there that will probably never update to the new standards.

Also, it takes only minimal changes to bring a setuptools-based project into the present. You just need to add a `pyproject.toml` file to your project with the following:

    [build-system]
    requires = ["setuptools >= 40.9.0", "wheel"]
    build-backend = "setuptools.build_meta"
Then when it's time to distribute the project, instead of `setup.py sdist` and `setup.py bdist_wheel`, you can just use the official build[1] tool like so:

    pyproject-build --sdist --wheel
And that's all there is to it. Once that's in place and if you're feeling frisky, you can try taking advantage of new setuptools features that can allow you to eliminate `setup.py` entirely and specify everything in `setup.cfg`[2] so that all your project's information is static and no code needs to be run when installing it, assuming your project doesn't contain any compiled code.

As and added benefit, by putting pyproject.toml in your projects now, if you wanted to switch over to another tool like poetry or flit later on, the act of packaging the project doesn't have to change as long as you update the pyproject.toml file with the new build system. The same `pyproject-build` command will work for all three systems.

[1] https://pypi.org/project/build/

[2] https://setuptools.pypa.io/en/latest/userguide/declarative_c...

cdrt··on How journalists use youtube-dl
What browser are you using? Google has been known to make YouTube perform worse on browsers that aren’t Chrome.