Live data from Hacker News

Faker is a Python package that generates fake data for you

joke2k.net

21–30 of 37 posts

Re: Faker is a Python package that generates fake data for you

#21

I made a tool like this for my company in Ruby (it wasn't nearly as mature as this). The largest challenge I struggled with (and never really solved) is that ultimately, there's no way to generate data as useful as real data. The value of real data comes from the fact that it's messy. Real data is different sizes than you expect[1], collides with your sentinel values[2], and comes in with unexpected encodings[3]. And…

You might be interested in something like https://github.com/buger/gor

Re: Faker is a Python package that generates fake data for you

#22
I wrote a much simpler Python version a few years ago:

https://pypi.python.org/pypi/Phony/0.5.0

I don't recommend my version: it isn't maintained and isn't complete. However, writing a faker-type library is a great way to learn a language: you learn about how to organize code, how it handles different types, and how to package it up for use.

Re: Faker is a Python package that generates fake data for you

#23
Awesome! I needed something just like this a couple of years ago. A couple of comments:

- I wanted fake CC numbers and SSNs/other national IDs at the time (don't remember why). I see that Faker is missing those, so they might be useful additions to the library.

- Method names should be snake_case rather than camelCase (http://www.python.org/dev/peps/pep-0008/#method-names-and-in...).

Re: Faker is a Python package that generates fake data for you

#24
post #23

Awesome! I needed something just like this a couple of years ago. A couple of comments: - I wanted fake CC numbers and SSNs/other national IDs at the time (don't remember why). I see that Faker is missing those, so they might be useful additions to the library. - Method names should be snake_case rather than camelCase ( http://www.python.org/dev/peps/pep-0008/#method-names-and-in... ).

Actually, it looks like this doc is out of date. The README on Github shows that method naming has been corrected, and CC numbers have been added: https://github.com/joke2k/faker

Re: Faker is a Python package that generates fake data for you

#25

I made a tool like this for my company in Ruby (it wasn't nearly as mature as this). The largest challenge I struggled with (and never really solved) is that ultimately, there's no way to generate data as useful as real data. The value of real data comes from the fact that it's messy. Real data is different sizes than you expect[1], collides with your sentinel values[2], and comes in with unexpected encodings[3]. And…

I'd suggest looking into fuzzers. Short version - tools designed to input messy, non-conforming data to ensure the inputs don't cause problems, that things are sanitized correctly, etc. At this point they are a mature technology, with improvements constantly being researched. They are generally thought of as security tools[1], but are very useful for basic development too. [1] The common use of fuzzers in a security…

Crude fuzzing can be done on the command line using dd.

The command "dd if=/dev/urandom bs=1000 count=1" will spit out 1 KB of psuedorandom data you can pipe, POST or otherwise send to your application. (GNU's implementation lets you use "1K" as well.)

Re: Faker is a Python package that generates fake data for you

#26
I've got a semi-similar python library that I've been adding to for a few years called testdata: https://github.com/Jaymon/testdata

testdata has a lot of unicode and file system stuff I've found really useful, it looks like between this and testdata I'll be in generated data heaven :)

Re: Faker is a Python package that generates fake data for you

#27
I'm not a huge fan of the 'factory' singleton pattern used here.

I can see how explicit execution of the startup code is a good thing, but can't help thinking how much better the experience would be if it just lazy-loaded the same code.

Am I missing something obvious that would prevent this? Bad magic?

Re: Faker is a Python package that generates fake data for you

#30

I made a tool like this for my company in Ruby (it wasn't nearly as mature as this). The largest challenge I struggled with (and never really solved) is that ultimately, there's no way to generate data as useful as real data. The value of real data comes from the fact that it's messy. Real data is different sizes than you expect[1], collides with your sentinel values[2], and comes in with unexpected encodings[3]. And…

Take a look at the Faker Rubygem:

http://rubygems.org/gems/faker

https://github.com/stympy/faker

Post reply on HN