Written in Python, and stores into a Mercurial or Git repository:
The recordings even capture ANSI coloring:
The “arrow” package, to reduce the number of packages that you need to rely on to do what you need to do:
The use of print() is so commonplace and thoughtless that it’s easy to forget that it’s still a function. There are parameters often neglected. You may even find yourself using sys.stdout to avoid the automatic newline, which is folly.
This is the signature, as of 3.4:
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
None of the parameters need an explanation. The flush parameter was added in 3.3 .
The Python community is always looking to improve things in the way of consistency, and that’s its best and worst feature because from time to time, one method isn’t finished before another method is begun.
For example, when it comes to something, like packaging, you may need to account for what you need in several different ways, such as identifying non-Python files in both the “package data” clauses of your setup attributes and listing them in a MANIFEST.in (one is considered only when building source distributions, and another is considered only when building binary distributions). However, in order to do this, you also have to embed the non-Python files within one of your actual source directories (the “package” directories), because the package-data files are made to belong to particular packages. We won’t even talk about the complexities of source and binary packages when packaging into a wheel. Such divergences are the topic of many entire series of articles.
With similar compatibility problems, in order to use one of the module loaders, for the purposes of reflection, the recommended package will vary depending on whether you’re running 2.x, 3.2/3.3, and 3.4 .
It’s a pain. For your convenience, this is such a flow, used to determine the path of the package:
_MODULE_NAME = 'module name' _APP_PATH = None # Works in 3.4 try: import importlib.util _ORIGIN = importlib.util.find_spec(_MODULE_NAME).origin _APP_PATH = os.path.abspath(os.path.dirname(_ORIGIN)) except: pass # Works in 3.2 if _APP_PATH is None: try: import importlib _INITFILEPATH = importlib.find_loader(_MODULE_NAME).path _APP_PATH = os.path.abspath(os.path.dirname(_INITFILEPATH)) except: pass # Works in 2.x if _APP_PATH is None: import imp _APP_PATH = imp.find_module(_MODULE_NAME)