Skip to content

Instantly share code, notes, and snippets.

🙃
wat

Ionel Cristian Mărieș ionelmc

🙃
wat
Block or report user

Report or block ionelmc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View matrix.ini
[matrix]
python_versions =
2.6
2.7
3.3
3.4
pypy
# syntax:
# alias: dep1 dep2 dep3 !skip_var[glob] &include_var[glob]
@ionelmc
ionelmc / .bashrc
Created Jun 10, 2014
SCL python alias (SCL it's a RHEL/CentOS thing).
View .bashrc
sclpython() {
if [ "$#" = 0 ]; then
scl enable python27 python
else
echo $(
echo python
for i in "$@"; do
printf "%q\n" "$i"
done
) | scl enable python27 -
View gist:69d11a015445aadcec9a
20:57 <ionelmc> for #1: brittle parsing, could start failing if someone starts adding stuff without knowing what's in setup.py
20:58 <ionelmc> for #2: pretty robust, assuming you're always using a separate version.py file
20:58 <qwcode> Ivo might have an opinion on a winner
20:59 <Ivo> what what
20:59 <Ivo> oh god, yeah
20:59 <Ivo> there should be one way to do thihngs
20:59 <Ivo> not 7
20:59 <qwcode> regarding the version section in the PUG offering too many solutions, but no winner
20:59 <ionelmc> for #3: regex could fail later, eg: someone changes from single to double quotes or thinks it's a great idea to create the string with % or .format()
20:59 <Ivo> or 6
View packaging-pitfalls.rst

Forgetting to specify package data.

why:Your package distribution doesn't include static files.
fix:Create a MANIFEST.in.

Listing few file types in MANIFEST.in, then adding some webfonts - only to find out the release you published on PyPI doesn't include them.

why:You duplicated information you already have in the filesystem. [1]_
fix:Just recursive-include or graft the whole dir.
View git-index.html
<html>
<body>
<a href="git+https://github.com/dstufft/packaging.git#egg=packaging-1.0">Thing</a>
</body>
</html>
@ionelmc
ionelmc / output.txt
Last active Aug 29, 2015
cmd.exe futzing
View output.txt
C:\Users\ionel_000>chcp 65001
Active code page: 65001
C:\Users\ionel_000>py -3
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.getlocale(locale.LC_ALL)
View capture_output.py
class CaptureOutput(object):
def __init__(self, *what):
self.__names = set(what)
self.__objects = {}
for name in self.__names:
assert isinstance(name, str)
assert name in ('stderr', 'stdout', '__stderr__', '__stdout__')
def __enter__(self):
for name in self.__names:
View tox.ini
[tox]
envlist = py34
skipsdist = true
[testenv]
deps =
pytest
commands =
{posargs:py.test -vv}
[pytest]
View jsbin.yixage.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://www.polymer-project.org/platform.js"></script>
<link rel="import" href="http://www.polymer-project.org/components/polymer/polymer.html">
</head>
<body>
View flawed1.rst

T.__init__ doesn't get called, as it's the second last in the mro (because it doesn't inherit Base):

>>> class Base(object):
...         def __init__(self, a):
...                 print 'super chain terminated'
...
>>> class D(Base):
...         def __init__(self, a):
...                 print 'do stuff with', a
...                 super(D, self).__init__(a)
You can’t perform that action at this time.