Skip to content

Instantly share code, notes, and snippets.

View kwlzn's full-sized avatar

Kris Wilson kwlzn

View GitHub Profile
@kwlzn
kwlzn / gist:01694a2e8a1f4083045ba0967092a91d
Created July 25, 2018 19:55
external pex bootstrapping example
[omerta ~]$ python2.7
Python 2.7.13 (default, Mar 2 2017, 16:22:01)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named requests
>>>
diff --git a/src/rust/engine/process_execution/src/local.rs b/src/rust/engine/process_execution/src/local.rs
index 05e8e3a..a7ed55d 100644
--- a/src/rust/engine/process_execution/src/local.rs
+++ b/src/rust/engine/process_execution/src/local.rs
@@ -1,8 +1,10 @@
extern crate tempfile;
use boxfuture::{BoxFuture, Boxable};
-use fs::{self, GlobMatching, PathGlobs, PathStatGetter, StrictGlobMatching};
+use fs::{self, GlobMatching, PathGlobs, PathStatGetter, Snapshot, StrictGlobMatching};
diff --git a/src/rust/engine/process_execution/src/local.rs b/src/rust/engine/process_execution/src/local.rs
index 05e8e3a..73ecf5a 100644
--- a/src/rust/engine/process_execution/src/local.rs
+++ b/src/rust/engine/process_execution/src/local.rs
@@ -1,10 +1,12 @@
extern crate tempfile;
use boxfuture::{BoxFuture, Boxable};
-use fs::{self, GlobMatching, PathGlobs, PathStatGetter, StrictGlobMatching};
+use fs::{self, GlobMatching, PathGlobs, PathStatGetter, Snapshot, StrictGlobMatching};
@kwlzn
kwlzn / jupyter_pex.py
Created July 17, 2017 19:27
jupyter + pex entrypoint shim
from contextlib import contextmanager
import errno
import json
import os
import shutil
import sys
import tempfile
from notebook.notebookapp import main as notebook_main
@kwlzn
kwlzn / docstring_grep.py
Created March 23, 2017 04:51
docstring_grep.py
#!/usr/bin/env python2.7
import ast
import itertools
import fnmatch
import os
import sys
class DocstringScanner(object):
@kwlzn
kwlzn / datatype.py
Last active November 30, 2017 10:04
python datatype factory
#!/usr/bin/env python2.7
import itertools
def datatype(type_name, params):
"""A faster/more efficient namedtuple replacement with better subclassing properties.
>>> RustLibrary = datatype('RustLibrary', ['sources', 'dependencies'])
>>> rl = RustLibrary([1,2,3], [4,5,6])
cold `./pants list ::`
pre gc, post-execution object count deltas
------------------------------------------
tuple 10409897 +10400188
set 7851229 +7845649
list 5010959 +4998632
StepRequest 3989446 +3989446
Entry 2572224 +2572224
dict 2305074 +2290623

PEX

image

pex is a library for generating .pex (Python EXecutable) files which are executable Python environments in the spirit of virtualenvs. pex is an expansion upon the ideas outlined in PEP 441 and makes the deployment of Python applications as simple as cp. pex files may even

@kwlzn
kwlzn / pants_exe.py
Created September 15, 2015 22:50
yappi profiling
import atexit, yappi
def init_yappi():
print('[YAPPI START]')
yappi.set_clock_type('wall')
yappi.start()
@atexit.register
def finish_yappi():
print('[YAPPI STOP]')
@kwlzn
kwlzn / .slate
Created May 16, 2015 01:25
slate config
## configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true