Skip to content

Instantly share code, notes, and snippets.

@pjankiewicz
Created February 22, 2018 12:35
Show Gist options
  • Save pjankiewicz/5d1f4a142dc23f65badcf4cbe67af0d2 to your computer and use it in GitHub Desktop.
Save pjankiewicz/5d1f4a142dc23f65badcf4cbe67af0d2 to your computer and use it in GitHub Desktop.
import gzip
import base64
import os
import sys
sys.path.append('/kaggle/working')
# this is base64 encoded source code
file_data = {...}
os.system('mkdir mercari')
for fn, encoded in file_data.items():
print(fn)
with open('mercari/' + fn, 'wb') as out:
out.write(gzip.decompress(base64.b64decode(encoded)))
with open('setup.py','wt') as out:
out.write("""
from setuptools import setup
setup(
name='mercari',
packages=["mercari"],
)
""")
def run(command):
os.system('export PYTHONPATH=${PYTHONPATH}:/kaggle/working && ' + command)
run('python setup.py develop --install-dir /kaggle/working')
run('python mercari/main.py')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment