PEX files are single-file lightweight virtual Python environments.
pex.pex is a utility that:
- creates PEX files
- provides a single use run-environment
Installation
mba=science=; PANTS_VERBOSE=1 ./pants src/python/twitter/aurora/client/bin:aurora_client | |
Build operating on targets: OrderedSet([PythonBinary(src/python/twitter/aurora/client/bin/BUILD:aurora_client)]) | |
Building PythonBinary PythonBinary(src/python/twitter/aurora/client/bin/BUILD:aurora_client): | |
Building PythonBinary PythonBinary(src/python/twitter/aurora/client/bin/BUILD:aurora_client): | |
Dumping library: PythonLibrary(src/python/twitter/aurora/client/bin/BUILD:aurora_client_source) | |
Dumping library: PythonLibrary(src/python/twitter/common/app/BUILD:app) | |
Dumping library: PythonLibrary(src/python/twitter/common/BUILD:common) | |
Dumping library: PythonLibrary(src/python/twitter/common/collections/BUILD:collections) | |
Dumping library: PythonLibrary(src/python/twitter/common/config/BUILD:config) | |
Dumping library: PythonLibrary(src/python/twitter/common/lang/BUILD:lang) |
PEX files are single-file lightweight virtual Python environments.
pex.pex is a utility that:
Installation
Pystachio 1.0 redesign | |
1. Documents: | |
Essentially a set of hierarchical key/value pairs a la a JSON document. | |
Documents may contain: | |
1. Leaves (string or numeric [integer, long, float, etc]) |
# E.g. TaskClass = CaseClass('name', 'owner', 'pid') | |
# task1 = TaskClass(name = "hello", owner = "brian", pid = 15) | |
# task2 = TaskClass(name = "world", owner = "brian", pid = 13) | |
# tasks = [task1, task2] | |
# | |
# filter(lambda task: task.where(owner = "brian"), tasks) => [task1, task2] | |
# filter(lambda task: task.where(owner = "brian", pid = 13), tasks) => [task2] | |
# | |
# matcher = TaskClass(pid = 13) | |
# filter(lambda task: task.match(matcher), tasks) => [task2] |
Most of the commons python environment has been developed against CPython 2.6. Things mostly work with CPython 2.7 and recent efforts have been made to improve CPython 3.x and PyPy compatibility. We've explicitly ignored anything prior to CPython 2.6 and in fact generally discourage use against anything less than CPython 2.6.5 as there are known bugs that we're unwilling to fix. We've never even tried running against Jython or
from string import Formatter | |
class RecursiveFormatter(Formatter): | |
def _contains_underformatted_field_names(self, format_tuple): | |
literal_text, field_name, format_spec, conversion = format_tuple | |
if field_name is not None: | |
return any(component[1] is not None for component in self.parse(field_name)) | |
return False |
from abc import ABCMeta, abstractmethod | |
import threading | |
class ClockInterface(object): | |
__metaclass__ = ABCMeta | |
@abstractmethod | |
def time(self): | |
pass |