pytest_cases
A different way of writing test case data. Instead of writing a big parameterize decorator before your test, you put your test case data in separate functions, and then decorate your test with @cases_data.

Interesting. I'm not sure if it's better than the big parameterize decorator. It might be more readable, but it separates the test data from the testing code.
pytest  plugin  pytest-cases 
22 days ago
Comparing Pulsar and Kafka: unified queuing and streaming
Pulsar does streaming (pubsub, like Kafka) and queueing (distributing work to multiple consumers, like RabbitMQ).
kafka  pulsar  queue  stream  message  pubsub 
22 days ago
Easy way to close class to new attributes (perhaps with attr.evolve syntactic sugar) · Issue #231 · python-attrs/attrs
How to close a class to new attribute creation.


@attr.s(slots=True)
class AlertContainer():
identifier = attr.ib()
title = attr.ib()


One advantage of using slots=True with attrs is that any creation of attributes outside of __init__ will raise an AttributeError.

Now, something like this will throw an error, as it should.

obj.some_dumb_typo = value
python  attrs  attribute  outside  init  slots  AttributeError  __init__ 
24 days ago
Git add lines to index by grep/regex - Stack Overflow
# check that the regex search correctly matches the changes you want.
git diff -U0 | grepdiff 'regex search' --output-matching=hunk

# then apply the changes to the index
git diff -U0 | grepdiff 'regex search' --output-matching=hunk | git apply --cached --unidiff-zero
git  regex  line  add  patch 
24 days ago
python - How to debug Celery/Django tasks running locally in Eclipse - Stack Overflow
CELERY_ALWAYS_EAGER = True

- or -



You can do it using Celery's rdb:

from celery.contrib import rdb
rdb.set_trace()

Then, in a different terminal type telnet localhost 6900, and you will get the debug prompt.
celery  debug  local  pdb  set  breakpoint  step 
27 days ago
What's the fastest way to edit hundreds of Git commit messages? - Stack Overflow
git filter-branch --msg-filter 'sed "s/Refs: #xxxxx/Refs: #22917/g"' master..my_branch

And after you do git filter-branch, you can do this to get rid of the leftover head reference

git update-ref -d refs/original/refs/heads/whatever
git  rebase  reword  script  commit  message  edit 
28 days ago
Factory Boy Fun · Adam Johnson's Blog
Examples of how to use factory boy to create models for Django tests.
django  testing  model  factory  factory_boy  example 
4 weeks ago
macos - OS X Color Picker: Removing a Colour Swatch - Ask Different
Method 1: Drag the swatch to the trash can in the dock.

Method 2: If you can click on the swatch and it gets a blue outline highlight, then you can press the Delete key on the keyboard to delete the swatch.
mac  macos  apple  color  swatch  picker  annoyances 
4 weeks ago
Remove Keynote Color Swatches | Official Apple Support Communities
Method 1: Drag the swatch to the trash can in the dock.

Method 2: If you can click on the swatch and it gets a blue outline highlight, then you can press the Delete key on the keyboard to delete the swatch.
mac  macos  apple  color  swatch  picker  annoyances 
4 weeks ago
Easier API testing | Tavern
Tavern is a pytest plugin, command-line tool and Python library for automated testing of APIs, with a simple, concise and flexible YAML-based syntax. It’s very simple to get started, and highly customisable for complex tests. Tavern supports testing RESTful APIs as well as MQTT based APIs.
python  rest  api  testing  library 
5 weeks ago
PROPOSAL: Parametrize with fixtures — pytest documentation
Proposal to improve py.test to allow you to use fixtures to parameterize a test. Not yet implemented. In the meantime, see https://github.com/TvoroG/pytest-lazy-fixture
pytest  proposal  improvement  parameterize  fixture  pytest-lazy-fixture 
5 weeks ago
How can I convert spaces to tabs in Vim or Linux? - Stack Overflow
:set tabstop=2 " To match the sample file
:set noexpandtab " Use tabs, not spaces
:retab " Retabulate the whole file
vi  convert  tab  space 
5 weeks ago
Workflow for layered requirements (e.g. prod<-test<-dev requirements)? · Issue #398 · jazzband/pip-tools
Good thread with ideas about how to manage layered requirements with piptools (base, dev, test).
pip  piptools  workflow  dev  base  test  requirements 
6 weeks ago
The option to disable global hash-checking mode? · Issue #4344 · pypa/pip
Can't mix hashed PyPI requirements with unhashed installed as editable from a git checkout.
pip  hash  install  editable  github  url 
6 weeks ago
MonkeyType — MonkeyType 18.5.1 documentation
MonkeyType collects runtime types of function arguments and return values, and can automatically generate stub files or even add draft type annotations directly to your Python code based on the types collected at runtime.
python  type  hint  automatic  mypy 
6 weeks ago
file io - Python truncate lines as they are read - Stack Overflow
Read and act on lines in a file, then empty the file.

with open('myfile.txt', 'rw+') as file:
for line in file:
processLine(line)
file.truncate(0)
python  read  lines  file  edit  pop 
6 weeks ago
fileinput — Command-Line Filter Framework — PyMOTW 3
The fileinput module is a framework for creating command-line programs for processing text files as a filter. Can edit files in-place.
python  fileinput  inplace  file  edit 
6 weeks ago
Pendleton Woolen Mill Store | Pendleton
8550 SE McLoughlin Blvd., Portland, Oregon
The Woolen Mill Store is located about 5 miles south of Downtown Portland on McLoughlin Blvd.
pendleton  blankets  wool  woolly  worms  fabric  offcut  selvage  weaving  store 
6 weeks ago
Quotes/backslashes will be treated literally. Use an array.
Bash does not interpret data as code. Consider almost any other languages, such as Python:

print 1+1 # prints 2
a="1+1"
print a # prints 1+1, not 2
Here, 1+1 is Python syntax for adding numbers. However, passing a literal string containing this expression does not cause Python to interpret it, see the + and produce the calculated result.

Similarly, "My File.txt" is Bash syntax for a single word with a space in it. However, passing a literal string containing this expression does not cause Bash to interpret it, see the quotes and produce the tokenized result.

The solution is to use an array instead, whenever possible.
bash  faq  command  array  gotcha  annoyances  shellcheck 
7 weeks ago
BashFAQ/050 - Greg's Wiki
Variables hold data. Functions hold code. Don't put code inside variables! There are many situations in which people try to shove commands, or command arguments, into variables and then run them. Each case needs to be handled separately.

For the simple case in bash, you can use an array to store arguments to pass to a command (similar to constructing a command using args only known at runtime, below):

args=(-s "$subject" --flag "arg with spaces")
mail "${args[@]}"
bash  faq  command  array  gotcha  annoyances 
7 weeks ago
meejah.ca
Blog post about how Twisted’s asyncioreactor can be used to inter-operate with asyncio libraries.
twisted  asyncio  library  deferred  future  async  python 
8 weeks ago
How to sync shared Google calendars with an iPhone | TechRadar
If, on your iOS calendar app, you want to see the google calendars that people have shared with you, you have to visit this special custom (undocumented) url. Once there, you can choose which of your google calendars will sync with you iOS calendar app.

https://www.google.com/calendar/iphoneselect

Weird
google  calendar  sharing  iphone  annoyances 
8 weeks ago
Welcome to Django Q — Django Q 0.9.2 documentation
Django Q is a native Django task queue, scheduler and worker application using Python multiprocessing.
Features

Multiprocessing worker pools
Asynchronous tasks
Scheduled and repeated tasks
Encrypted and compressed packages
Failure and success database or cache
Result hooks, groups and chains
Django Admin integration
PaaS compatible with multiple instances
Multi cluster monitor
Redis, Disque, IronMQ, SQS, MongoDB or ORM
Rollbar and Sentry support
django  task  manager  queue  redis  celery  alternative 
8 weeks ago
Python 3 Support — Click Documentation (6.0)
Python 3 Limitations

At the moment, Click suffers from a few problems with Python 3:

The command line in Unix traditionally is in bytes, not Unicode. While there are encoding hints for all of this, there are generally some situations where this can break. The most common one is SSH connections to machines with different locales.

Misconfigured environments can currently cause a wide range of Unicode problems in Python 3 due to the lack of support for roundtripping surrogate escapes.
python  python3  unicode  gotcha  click  ascii  file  encoding  byte  stream  locale  unix  utf-8 
8 weeks ago
Pipfile.lock out of date, but installation uses --system... re-building lockfile must happen in isolation. · Issue #2273 · pypa/pipenv
I ran in to this error (without using the --system option) when I tried to use pipenv with my own virtualenv instead of its my_dir-w892cw7 virtualenv that it creates for you.
pipenv  Pipfile  error  virtualenv 
10 weeks ago
Add an equivalent of `workon` from virtualenvwrapper · Issue #535 · pypa/pipenv · GitHub
Discussion of pipenv, virtualenvwrapper, and how to transition my workflow from one tool to the other.
pipenv  virtualenvwrapper  workon  python  workflow 
10 weeks ago
Markdown, Please!
Markdown, Please! is a service that instantly converts websites into Markdown.

To get started: enter any URL, hit "Markdown, Please!", and you will be presented with a Markdown version of the URL you provided.
markdown  web  convert  extract 
10 weeks ago
« earlier      
annoyances ansible apache api apple application async asyncio audio automation backup bash blog book branch browser bug build cd celery certificate chart cheatsheet cli client code command commit computer config configuration convert copy css culture data database dead debian debug debugging deployment design development diagram diff digital diy django docs documentation download drive driver editor education email environment error example fabric file firefox flask food format forum forwarding framework france fun function game games ghibli gif git github google gotcha graph guide hardware hg hierarchy homebrew hosting howto html html5 http import inheritance install internet ios java javascript key keyboard kids library line linux list local low_power_server mac make manager map markdown memory merge microsoft mock monitor multiple music network nginx odbc online openssl oracle osx package pandas path patterns pc pdf performance phone pick_pack pip plsql plugin port postgres postscript printer programming puppet putty pytest python python3 query radio recipe redhat reference regex remote requests rest review science screen script scripting search security selenium server service setup shell shopping soap software sound sql ssd ssh ssl stream subversion sudo support svn syntax task template terminal test testing time tips tmux tool tools trace transfer troubleshooting tutorial twisted ubuntu unicode unix upgrade url user utilities utility vagrant vba version vi video vim virtualenv virtualization vmware vpn web windows workflow xp

Copy this bookmark:



description:


tags: