Replace py3_path by standard os.fsdecode and use native os.cpu_count.
These functions had been written before builtins achieving the same have
been made available (in Python 3.2 and 3.4).
Now that they are available though, this PR updates the codebase to use
builtin implementations rather than the custom ones.
## Description
This is a very simple PR, just removing the (apparently unused) `beet`
executable from the repository and substituting `bin/env python` for
`bin/python3` where possible.
Fixes#4604.
This adds a step to the GitHub release so that it sends a toot on
Fosstodon, beets' Mastodon account, to publicise that and get some
engagement!
Not tested, but this is lifted straight from the action repo so it
*should* be okay. @snejus for a sanity check if you wouldn't mind
Apparently, this script isn't actually used for anything; the build
system will automatically generate a script like this when installing
`beets`.
See <https://github.com/beetbox/beets/issues/4604>.
## Description
I noticed that some development work was waiting on cleaner `mypy` runs,
so I thought I would help out a bit. This PR just contains a number of
miscellaneous fixes across the codebase that I hit. I'm happy to add
more, or remove any problematic changes (though I don't think I've
broken anything, only type annotations have changed).
## To Do
- [x] ~Documentation~
- [ ] Changelog
- [x] ~Tests~
Some functions used by the bash completion script have become
deprecated. This was causing the test suite to break on faster-moving
distributions (e.g. Arch Linux and Gentoo). The issue is only noticeable
because the tests for the completion function explicitly disallow
compatibility implementations from being loaded. Rather than allowing
compatibility implementations, I've added some basic logic to the
completion script so that older and newer versions of `bash-completion`
can be supported simultaneously.
Debian 10 LTS only has 'bash-completion' v2.8, but support for it
expires at the end of the month (2024-06-30). Still, this completion
script apparently worked there, so there's no harm in reducing the
version requirement, which I had previously picked arbitrarily.
See https://github.com/beetbox/beets/pull/5301#issuecomment-2164297308.
I haven't run git blame, but this script hasn't been updated in a while.
Apparently development in 'bash-completion' is moving a lot faster now,
so supporting multiple mutually-incompatible versions of it has become
necessary.
For some reason, this issue wasn't caught on CI - I think the newer
'bash-completion' hasn't reached the distribution used there. Still,
this code is now forward-compatible.
I had misinterpreted the pattern type for this query to be 'NoReturn',
thinking that it accepted no pattern at all (even so, I should have
typed it as 'None'). However, it does accept a pattern, and uses it to
decide whether to select only singletons or none at all.
See <https://github.com/beetbox/beets/pull/5282#discussion_r1633212742>.
In changing the implementation of the 'AttrDict' class to eliminate
'mypy' errors, I had accidentally removed support for storing 'None'
values in the dict. This commit restores support for them.
'typing.Never' was introduced later, and 'typing.Type' was used instead
of just 'type' until 3.9. This commit will likely be reverted over time
as these 3.8 etc. get dropped.
Migrate `beets` package configuration to Poetry which nowadays seems to
be the gold standard.
I have been using Poetry since 2019 and I have mostly been happy a happy
user: it makes local dev setup easy and has the tools I need to maintain
python packages day to day, including reliable dependency resolution,
versioning and publishing to Pypi.
It's a user-friendly tool, so it should make it more straightforward for
contributors to setup and navigate the codebase, and ultimately,
hopefully facilitate more frequent releases!
Since poetry manages local virtual environment, we do not have much need
for tox any more. Therefore, it was replaced by a task runner
`poethepoet`. Type `poe` in the project directory to see the available
commands.
- [x] Documentation. (If you've added a new command-line flag, for
example, find the appropriate page under `docs/` to describe it.)
- [x] Changelog. (Add an entry to `docs/changelog.rst` to the bottom of
one of the lists near the top of the document.)
- [x] Tests. (Very much encouraged but not strictly required.)