IT-новости про Python, которые стоит знать

Собрали в одном месте самые важные ссылки
читайте нас в Twitter

     22.02.2016       Выпуск 114 (22.02.2016 - 28.02.2016)       Интересные проекты, инструменты, библиотеки

pygments-mathematica - подсветка кода Mathematica/Wolfram Language на основе Pygments

(* An example highlighting the features of
   this Pygments plugin for Mathematica *)
lissajous::usage = "An example Lissajous curve.\n" <>
                   "Definition: f(t) = (sin(3t + π/2), sin(t))"
lissajous = {Sin[2^^11 # + 0.005`10 * 1*^2 * Pi], Sin[#]} &;

With[{max = 2 Pi, min = 0},
    ParametricPlot[lissajous[t], {t, min, max}] /. x_Line :> {Dashed, x}
]

     22.02.2016       Выпуск 114 (22.02.2016 - 28.02.2016)       Интересные проекты, инструменты, библиотеки

pypugly - генератор HTML на основе JADE.

# Comments with '#'

# All code start with a dash (consistency).

# Define a variable like this:
-var name = 'PyPUGly'

# Define a function like this:
-def title(name):
  h1.title '{name}''

html(lang="en")
  head
    # All strings must be quoted. Only single-quotes are accepted (consistency).
    title 'This is {name}'
  body
    # Call a function like this:
    +title('PyPUGly')

    #container
      p 'Strings must be quoted.'

     22.02.2016       Выпуск 114 (22.02.2016 - 28.02.2016)       Интересные проекты, инструменты, библиотеки

lexiconjure - twitter бот, который придумывает слова и определения

Работает бот с помощью RNN + генетического алгоритма

     21.02.2016       Выпуск 113 (15.02.2016 - 21.02.2016)       Интересные проекты, инструменты, библиотеки

pysdl2-sdl2ui - создаем UI с помощью pysdl2

class MyApp(sdl2ui.App):
    width = 256
    height = 224
    zoom = 3
    # NOTE: the fps you desire: less fps = less CPU usage
    fps = 30
    name = "My Application"
    # NOTE: order the handlers in what you want to display first
    default_handlers = [MainHandler, ListSelectorHandler, MenuHandler]
    default_resources = [('background', 'background.png')]


logging.basicConfig(level=logging.DEBUG)
app = Meldnafen(handlers=[sdl2ui.handler.DebuggerHandler])
app.loop()
del app

     21.02.2016       Выпуск 113 (15.02.2016 - 21.02.2016)       Интересные проекты, инструменты, библиотеки

p.url - пакет для парсинга ссылок

from purl import Purl

url = Purl('https://github.com/search?q=cat)

str(url.add_query('q', 'dog')) # => 'https://github.com/search?q=dog'
url = Purl('https://github.com/search)

str(url.add_query({
  'q': 'cat',
  'l': 'JavaScript',
  'type': 'Issues'
}))

url = Purl('https://github.com/search)

str(url.add_query('q', 'cat')
  .add_query('l', 'JavaScript')
  .add_query('type', 'Issues')) # => 'https://github.com/search?l=JavaScript&q=cat&type=Issues'

     21.02.2016       Выпуск 113 (15.02.2016 - 21.02.2016)       Релизы

django-paypal - 0.3

Поддержка платежной системы PayPal в Django. Изменения описаны по ссылке https://allmychanges.com/p/python/django-paypal/#0.3. Скачать можно по ссылке: https://pypi.python.org/pypi/django-paypal/

     19.02.2016       Выпуск 113 (15.02.2016 - 21.02.2016)       Интересные проекты, инструменты, библиотеки

trender - движок отрисовки шаблонов на чистом Python

from trender import TRender

template = '@greet world!'
compiled = TRender(template)
output = compiled.render({'greet': 'Hello'})

print(output) # => Hello world! 

     19.02.2016       Выпуск 113 (15.02.2016 - 21.02.2016)       Интересные проекты, инструменты, библиотеки

DateTimeRange - реализация временных промежутков для Python

from datetimerange import DateTimeRange
time_range = DateTimeRange()
print time_range.is_set()
time_range.set_time_range("2015-03-22T10:00:00+0900", "2015-03-22T10:10:00+0900")
print time_range.is_set()

     19.02.2016       Выпуск 113 (15.02.2016 - 21.02.2016)       Интересные проекты, инструменты, библиотеки

genty - запускаем тест с разными входными значениями

from genty import genty, genty_repeat, genty_dataset
from unittest import TestCase

# Here's the class under test
class MyClass(object):
    def add_one(self, x):
        return x + 1

# Here's the test code
@genty
class MyClassTests(TestCase):
    @genty_dataset(
        (0, 1),
        (100000, 100001),
    )
    def test_add_one(self, value, expected_result):
        actual_result = MyClass().add_one(value)
        self.assertEqual(expected_result, actual_result)