{"id":19153761,"url":"https://github.com/christimperley/fluffycow","last_synced_at":"2025-06-15T16:38:22.207Z","repository":{"id":57431558,"uuid":"177862061","full_name":"ChrisTimperley/fluffycow","owner":"ChrisTimperley","description":"A small and powerful DSL for generating complex random objects in Python 🐄","archived":false,"fork":false,"pushed_at":"2019-04-06T02:06:13.000Z","size":29,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T21:23:05.232Z","etag":null,"topics":["compositional","dsl","fuzzing","python","testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChrisTimperley.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-26T20:15:54.000Z","updated_at":"2019-04-06T02:05:34.000Z","dependencies_parsed_at":"2022-09-02T11:01:06.001Z","dependency_job_id":null,"html_url":"https://github.com/ChrisTimperley/fluffycow","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ChrisTimperley/fluffycow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisTimperley%2Ffluffycow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisTimperley%2Ffluffycow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisTimperley%2Ffluffycow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisTimperley%2Ffluffycow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChrisTimperley","download_url":"https://codeload.github.com/ChrisTimperley/fluffycow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChrisTimperley%2Ffluffycow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260009754,"owners_count":22945528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compositional","dsl","fuzzing","python","testing"],"created_at":"2024-11-09T08:24:11.252Z","updated_at":"2025-06-15T16:38:22.186Z","avatar_url":"https://github.com/ChrisTimperley.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. -*-restructuredtext-*-\n\nfluffycow\n=========\n\n.. image:: https://travis-ci.org/ChrisTimperley/fluffycow.svg?branch=master\n    :target: https://travis-ci.org/ChrisTimperley/fluffycow\n\n.. image:: https://badge.fury.io/py/fluffycow.svg\n    :target: https://badge.fury.io/py/fluffycow\n\n.. image:: https://img.shields.io/pypi/pyversions/fluffycow.svg\n    :target: https://pypi.org/project/fluffycow\n\n\nA simple and elegant library for generating complex random objects in Python.\n\n\n.. image:: https://static.boredpanda.com/blog/wp-content/uploads/2014/03/cute-fluffy-animals-33.jpg\n\n(image credit: `Matt Lautner \u003chttp://www.lautnerfarms.com/sires/texas-tornado/\u003e`_.)\n\n\nInstallation\n------------\n\nTo install the latest release from `PyPI \u003chttps://pypi.python.org/pypi/fluffycow/\u003e`_:\n\n.. code::\n\n   $ pip install fluffycow\n\nTo install the latest development release:\n\n.. code::\n\n   $ git clone https://github.com/ChrisTimperley/fluffycow\n   $ cd fluffycow\n   $ python setup.py install\n\n\nExamples\n--------\n\nTo generate 10 lists containing 5 random numbers:\n\n.. code:: python\n\n   import fluffycow as g\n\n   gen = g.list(g.random(), 5)\n   for i in range(10):\n       l = next(gen)\n       print(l)\n\n   \"\"\"\n   [0.8620918485892981, 0.4794836848262348, 0.262162063050416, 0.01909426938513137, 0.36506899628784006]\n   [0.9397902843125912, 0.9883123343094299, 0.5728170848781718, 0.2430986751635641, 0.6504376531611539]\n   [0.6530962809522628, 0.629805285301596, 0.7484217313556808, 0.4781887755635098, 0.7702516815623411]\n   [0.6049464336804768, 0.6857354552123759, 0.4401119070721792, 0.16269631684472152, 0.4501522526776762]\n   [0.6754685790929789, 0.14883325162091654, 0.7543575544723128, 0.7400186451945051, 0.7872586706933858]\n   [0.6093352430215464, 0.601878065077082, 0.9864251783225236, 0.5652106608585465, 0.2000072917817054]\n   [0.5288773016226057, 0.3473820645776373, 0.5181819860433858, 0.9795605815396756, 0.0941069188895195]\n   [0.577403816680611, 0.6006088487133505, 0.7401053882982396, 0.9243339819764703, 0.8737058738019327]\n   [0.15168246955860343, 0.9826794936881696, 0.8700116634339362, 0.23066589924280112, 0.6455718073363804]\n   [0.4953407037944514, 0.4235910957127196, 0.9817109582233142, 0.19140229868504488, 0.4238482591507997]\n   \"\"\"\n\n\nTo generate 5 random cows 🐄:\n\n.. code:: python\n\n   import fluffycow as g\n   import attr\n\n   @attr.s\n   class Cow:\n      age = attr.ib(type=int)\n      fluffiness = attr.ib(type=float)\n\n   # provide generators for each keyword argument,\n   gen = g.factory(Cow,\n                   age=g.randint(0, 50),\n                   fluffiness=g.gauss(5.0, 1.5))\n\n   # or for each positional argument,\n   gen = g.factory(Cow, g.randint(0, 50), g.gauss(5.0, 1.5))\n\n   # or mix positional and keyword arguments\n   gen = g.factory(Cow,\n                   g.randint(0, 50),\n                   fluffiness=g.gauss(5.0, 1.5))\n\n   # generate some fluffy cows\n   for i in range(5):\n      cow = next(gen)\n      print(cow)\n\n   \"\"\"\n   Cow(age=16, fluffiness=6.737730437364233)\n   Cow(age=30, fluffiness=3.6106200949734806)\n   Cow(age=4, fluffiness=5.856278892241928)\n   Cow(age=40, fluffiness=4.274460173984223)\n   Cow(age=8, fluffiness=4.26886806010291)\n   \"\"\"\n\n\nTo generate a farm containing a random mixture of 10 animals:\n\n.. code:: python\n\n   @attr.s\n   class Cow:\n      age = attr.ib(type=int)\n      fluffiness = attr.ib(type=float)\n\n   @attr.s\n   class Chicken:\n       sass = attr.ib(type=int)\n\n   @attr.s\n   class Sheep:\n      fluffiness = attr.ib(type=float)\n\n   def farm():\n       cows = g.factory(Cow,\n                age=g.randint(0, 30),\n                fluffiness=g.gauss(5.0, 1.5))\n       chickens = g.object(Chicken, g.randint(0, 10))\n       sheep = g.object(Sheep, g.gauss(4.5, 1.0))\n\n       animals = g.mux(cows, chickens, sheep)\n       for i in range(10):\n           animal = next(animals)\n           print(animal)\n\n   \"\"\"\n   Cow(age=15, fluffiness=4.13522619329628)\n   Cow(age=6, fluffiness=6.132266751335851)\n   Sheep(fluffiness=4.996947740687185)\n   Cow(age=25, fluffiness=4.268442712380023)\n   Sheep(fluffiness=4.92952572321737)\n   Chicken(sass=5)\n   Cow(age=28, fluffiness=5.155204522890905)\n   Sheep(fluffiness=3.9241924681246094)\n   Sheep(fluffiness=3.676097181435127)\n   Sheep(fluffiness=2.713429568549102)\n   \"\"\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristimperley%2Ffluffycow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristimperley%2Ffluffycow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristimperley%2Ffluffycow/lists"}