49th Week of 2021
- New: Introduce how I manage my music library.
New: How to contribute to MusicBrainz.
MusicBrainz is an open music encyclopedia that collects music metadata and makes it available to the public.
MusicBrainz aims to be:
- The ultimate source of music information by allowing anyone to contribute and releasing the data under open licenses.
- The universal lingua franca for music by providing a reliable and unambiguous form of music identification, enabling both people and machines to have meaningful conversations about music.
Like Wikipedia, MusicBrainz is maintained by a global community of users and we want everyone — including you — to participate and contribute.
New: Clone a repository.
from git import Repo Repo.clone_from(git_url, repo_dir)
New: Create a branch.
new_branch = repo.create_head('new_branch') assert repo.active_branch != new_branch # It's not checked out yet repo.head.reference = new_branch assert not repo.head.is_detached
New: Get the latest commit of a repository.
New: Capture the stdout of a function.
import io from contextlib import redirect_stdout f = io.StringIO() with redirect_stdout(f): do_something(my_object) out = f.getvalue()
import tempfile dirpath = tempfile.mkdtemp()
New: Change the working directory of a test.
import unittest import os from src.main import get_cwd class TestMain(unittest.TestCase): def test_get_cwd(self): os.chdir('src') print('testing get_cwd()') current_dir = get_cwd() self.assertIsNotNone(current_dir) self.assertEqual(current_dir, 'src')
New: Copy a directory.
import shutil shutil.copytree('bar', 'foo')
Correction: Use fixture to change the working directory of a test.
The previous code didn't work, instead use the next fixture:
@pytest.fixture(name="change_test_dir") def change_test_dir_(request: SubRequest) -> Any: os.chdir(request.fspath.dirname) yield os.chdir(request.config.invocation_dir)
- New: Debugging why a package is not updated to the latest version.
- New: Checking what package is using a dependency.
- New: Try to use
passas a keyring backend to store the PYPI token.
- Correction: Deprecate in favour of Poetry.
Last update: 2022-04-29