Skip to content

49th Week of 2021

Life Management

Music Management

  • New: Introduce how I manage my music library.

MusicBrainz

  • 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.

Coding

Python

GitPython

Python Snippets

  • 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()
    
  • New: Make temporal directory.

    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)
    

Poetry

DevOps

Continuous Integration

Dependency managers

  • Correction: Deprecate in favour of Poetry.

Automating Processes

cruft