Skip to content

Instantly share code, notes, and snippets.

View shaypal5's full-sized avatar
🐢
Working away...

Shay Palachy-Affek shaypal5

🐢
Working away...
View GitHub Profile
@shaypal5
shaypal5 / clique_percolation.py
Last active January 24, 2017 19:44
Clique percolation in Python with no external dependencies.
"""Finds communities in the given graph using clique percolation."""
def _add_edge_to_adjancy_list(adjancy_list, node1, node2):
if node1 in adjancy_list:
adjancy_list[node1].add(node2)
else:
adjancy_list[node1] = set([node2])
@shaypal5
shaypal5 / chocobo_setup.py
Created July 9, 2018 17:20
An example setup.py file for the example chocobo package
"""Setup for the chocobo package."""
import setuptools
with open('README.md') as f:
README = f.read()
setuptools.setup(
author="Shay Palachy",
@shaypal5
shaypal5 / quiet_print_oneliner.py
Created October 18, 2018 11:17
Silence-able print one-liner for Python
def foo(a, quiet=False):
_print = (lambda x: x) if quiet else print
b = a * 5
_print("Warming up warp engines. This will not print if quiet is set to True.")
return b + 3.14
@shaypal5
shaypal5 / Python packaging workshop requirements
Created February 13, 2019 05:03
Python packaging workshop requirements
pipenv
versioneer
pytest
coverage
pytest-cov
collective.checkdocs
pygments
wheel
twine
@shaypal5
shaypal5 / pytest.ini
Created July 14, 2019 11:40
Example pytest.ini for testing a Python package
[pytest]
testpaths =
tests
skift
norecursedirs=dist build .tox scripts
addopts =
--doctest-modules
--cov=skift
-r a
-v
@shaypal5
shaypal5 / .travis.yml
Created July 15, 2019 05:54
A very simple Travis build matrix
language: python
matrix:
include:
- python: 2.7
PARALLELIZE=false
- python: 3.5
PARALLELIZE=false
- python: 3.5
PARALLELIZE=true
@shaypal5
shaypal5 / .travis.yml
Last active July 15, 2019 05:54
A 4-job Travis build matrix
language: python
python:
- 2.7
- 3.5
env:
- PARALLELIZE=true
- PARALLELIZE=false
@shaypal5
shaypal5 / .travis.yml
Last active July 15, 2019 06:16
Simple Python package testing on Travis CI
language: python
python:
- 2.7
- 3.5
- 3.6
before_install:
- python --version
- pip install -U pip
- pip install -U pytest
- pip install codecov
@shaypal5
shaypal5 / .travis.yml
Last active July 16, 2019 11:34
Bad example for a .travis.yml for Python on maxOS
matrix:
include:
- name: "Generic Python 3.5 on macOS"
os: osx
language: shell # 'language: python' is an error on Travis CI macOS
python: 3.5
@shaypal5
shaypal5 / .travis.yml
Created July 16, 2019 14:40
Testing Python 3.6.5 on macOS 10.13
matrix:
include:
- name: "Python 3.6.5 on macOS 10.13"
os: osx
osx_image: xcode9.4 # Python 3.6.5 running on macOS 10.13
language: shell # 'language: python' is an error on Travis CI macOS
before_install:
- python3 --version
- pip3 install -U pip
- pip3 install -U pytest