8th December 2021
Coding⚑
Python⚑
GitPython⚑
-
New: Clone a repository.
from git import Repo Repo.clone_from(git_url, repo_dir)
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()
-
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')
Poetry⚑
- New: Debugging why a package is not updated to the latest version.
- New: Checking what package is using a dependency.
- New: Try to use
pass
as a keyring backend to store the PYPI token.