TLDR:
os.path.join(sys.prefix, '/Lib/site-packages') on windows
os.path.join(sys.prefix, '/Lib/site-packages') or os.path.join(sys.exec_prefix, '/Lib/site-packages') on unix
When run
setup.py install foo
import pytest | |
#============ PART 1: convert str to int ==============# | |
def map_char_to_int(char): | |
'''Maps char to int using a dict | |
Args: | |
char (str): a string representation of a digit eg. "1" | |
Raises: |
import pytest | |
'''output nth (starting from 1) sequence of fibonacci series: 0,1,1,2,3,5,8. n = 7, output = 8''' | |
def fib(n): | |
seq = [0, 1] + [0] * (n - 2) | |
for i in range(2, n): | |
# dynamic programming | |
seq[i] = seq[i-1] + seq[i-2] | |
return seq[n-1] |
TLDR:
os.path.join(sys.prefix, '/Lib/site-packages') on windows
os.path.join(sys.prefix, '/Lib/site-packages') or os.path.join(sys.exec_prefix, '/Lib/site-packages') on unix
When run
setup.py install foo
import pytest | |
def escape_html(string): | |
char_map = { | |
"<" : "<", | |
">" : ">", | |
"&" : "&" | |
} | |
out = [] | |
for char in string: |
try: | |
from setuptools import setup | |
except ImportError: | |
from distutils.core import setup | |
import re | |
def get_long_description(): | |
''' use this if using readme for long description in pypi page''' | |
with open("README.md", "r") as fh: | |
readme = fh.read() |
RTFM? Really? We always expect other to do that, to read the readmes we painstakingly craft to be as detailed, concise and readable as possible. As a student, Ive even had that as a lecture topic before. However, reality is people dont RTFM as much as we ideally expect them to. People are lazy. Whats the solution to that?
I realised this from working with others. Give them a repo. Theres a readme with detailed instructions. They try to run whats in the repo. They run into all sorts of problems: forgot to run with elevated rights, did not install so and so dependencies, etc. I give them the solution, then remind them that its in the README. This repeats. Very often. Maybe I'm not doing something right. The README alone prooves to not be the most effective and user friendly form of communicating information. Why do I have to repeatedly give manual prompts? Maybe this can be automated. OH YES! PROMPTS CAN BE AUTOMATED. Infact, when designing prompts to address help me
s, we realise that pro
php /path/to/composer.phar require hhvm/hhvm-autoload
https://docs.hhvm.com/hack/getting-started/starting-a-real-project