{"id":15569394,"url":"https://github.com/abey79/vsketch","last_synced_at":"2025-05-14T18:02:45.587Z","repository":{"id":36989565,"uuid":"284121865","full_name":"abey79/vsketch","owner":"abey79","description":"Generative plotter art environment for Python","archived":false,"fork":false,"pushed_at":"2024-11-04T00:43:56.000Z","size":17549,"stargazers_count":532,"open_issues_count":37,"forks_count":53,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-14T18:02:39.392Z","etag":null,"topics":["generative-art","hacktoberfest","hacktoberfest2020","pen-plotter","python3"],"latest_commit_sha":null,"homepage":"https://vsketch.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abey79.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.rst","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["abey79"],"ko_fi":"abey79"}},"created_at":"2020-07-31T20:17:08.000Z","updated_at":"2025-05-10T09:18:29.000Z","dependencies_parsed_at":"2024-01-15T13:34:54.194Z","dependency_job_id":"f537c951-af57-467a-a76f-410cab1b1610","html_url":"https://github.com/abey79/vsketch","commit_stats":{"total_commits":176,"total_committers":23,"mean_commits":"7.6521739130434785","dds":0.4147727272727273,"last_synced_commit":"5870f1c48bceff9356b23e03ec017bc08f5f757f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abey79%2Fvsketch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abey79%2Fvsketch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abey79%2Fvsketch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abey79%2Fvsketch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abey79","download_url":"https://codeload.github.com/abey79/vsketch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198452,"owners_count":22030964,"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":["generative-art","hacktoberfest","hacktoberfest2020","pen-plotter","python3"],"created_at":"2024-10-02T17:27:49.311Z","updated_at":"2025-05-14T18:02:40.570Z","avatar_url":"https://github.com/abey79.png","language":"Python","funding_links":["https://github.com/sponsors/abey79","https://ko-fi.com/abey79"],"categories":[],"sub_categories":[],"readme":"# *vsketch*\n\n![python](https://img.shields.io/github/languages/top/abey79/vsketch)\n![Test](https://img.shields.io/github/actions/workflow/status/abey79/vsketch/python-lint-tests.yml?logo=github)\n[![Documentation Status](https://img.shields.io/readthedocs/vsketch?label=Read%20the%20Docs\u0026logo=read-the-docs)](https://vsketch.readthedocs.io/en/latest/?badge=latest)\n\n\n## What is _vsketch_?\n\n_vsketch_ is a Python generative art toolkit for plotters with the following focuses:\n\n* **Accessibility**: _vsketch_ is easy to learn and feels familiar thanks to its API strongly inspired from [Processing](https://processing.org).\n* **Minimized friction**: _vsketch_ automates every part of the creation process\n      (project initialisation, friction-less iteration, export to plotter-ready files) through a CLI tool called `vsk`\n      and a tight integration with [_vpype_](https://github.com/abey79/vpype/).\n* **Plotter-centric**: _vsketch_ is made for plotter users, by plotter users. It's feature set is focused on the\n      peculiarities of this medium and doesn't aim to solve other problems.\n* **Interoperability**: _vsketch_ plays nice with popular packages such as [Numpy](https://numpy.org) and\n      [Shapely](https://shapely.readthedocs.io/en/latest/), which are true enabler for plotter generative art.\n\n_vsketch_ is the sum of two things:\n\n* A CLI tool named `vsk` to automate every part of a sketch project lifecycle::\n    * Sketch creation based on a customizable template.\n    * Interactive rendering of your sketch with live-reload and custom parameters.\n    * Batch export to SVG with random seed and configuration management as well as multiprocessing support.\n* An easy-to-learn API similar to [Processing](https://processing.org) to implement your sketches.\n\n*This project is at an early the stage and needs [contributions](https://vsketch.readthedocs.io/en/latest/contributing.html).\nYou can help by providing feedback and improving the documentation.*\n\n\n## Installing *vsketch*\n\nThe recommended way to install *vsketch* is as a stand-alone installation using pipx:\n\n```bash\n$ pipx install vsketch\n```\n\nTo run the examples, they must be [downloaded](https://github.com/abey79/vsketch/archive/refs/heads/master.zip) separately. After decompressing the archive, they can be run using the following command:\n\n```bash\n$ vsk run path/to/vsketch-master/examples/schotter\n```\n\nCheck the [installation instructions](https://vsketch.readthedocs.io/en/latest/install.html) for more details.\n\n\n## Getting started\n\nThis section is meant as a quick introduction of the workflow supported by _vsketch_. Check the\n[documentation](https://vsketch.readthedocs.io/en/latest/) for a more complete overview.\n\nOpen a terminal and create a new project:\n\n```bash\n$ vsk init my_project\n```\n\nThis will create a new project structure that includes everything you need to get started:\n\n```bash\n$ ls my_project\nconfig\noutput\nsketch_my_project.py\n```\n\nThe `sketch_my_project.py` file contains a skeleton for your sketch. The `config` and `output` sub-directories are used\nby `vsk` to store configurations and output SVGs.\n\nOpen `sketch_my_project.py` in your favourite editor and modify it as follows:\n\n```python\nimport vsketch\n\nclass SchotterSketch(vsketch.SketchClass):\n    def draw(self, vsk: vsketch.SketchClass) -\u003e None:\n        vsk.size(\"a4\", landscape=False)\n        vsk.scale(\"cm\")\n\n        for j in range(22):\n            with vsk.pushMatrix():\n                for i in range(12):\n                    with vsk.pushMatrix():\n                        vsk.rotate(0.03 * vsk.random(-j, j))\n                        vsk.translate(\n                            0.01 * vsk.randomGaussian() * j,\n                            0.01 * vsk.randomGaussian() * j,\n                        )\n                        vsk.rect(0, 0, 1, 1)\n                    vsk.translate(1, 0)\n            vsk.translate(0, 1)\n\n    def finalize(self, vsk: vsketch.Vsketch) -\u003e None:\n        vsk.vpype(\"linemerge linesimplify reloop linesort\")\n\nif __name__ == \"__main__\":\n    SchotterSketch.display()\n\n```\n\nYour sketch is now ready to be run with the following command:\n\n```bash\n$ vsk run my_project\n```\n\nYou should see this:\n\n\u003cimg width=\"600\" alt=\"image\" src=\"https://user-images.githubusercontent.com/49431240/107370067-cd08ef00-6ae2-11eb-834a-72baf8c112e3.png\"\u003e\n\nCongratulation, you just reproduced [Georg Nees' famous artwork](http://www.medienkunstnetz.de/works/schotter/)!\n\nWouldn't be nice if you could interactively interact with the script's parameters? Let's make this happen.\n\nAdd the following declaration at the top of the class:\n\n```python\nclass SchotterSketch(vsketch.SketchClass):\n    columns = vsketch.Param(12)\n    rows = vsketch.Param(22)\n    fuzziness = vsketch.Param(1.0)\n    \n    # ...\n```\n\nChange the `draw()` method as follows:\n\n```python\n    def draw(self, vsk: vsketch.Vsketch) -\u003e None:\n        vsk.size(\"a4\", landscape=False)\n        vsk.scale(\"cm\")\n\n        for j in range(self.rows):\n            with vsk.pushMatrix():\n                for i in range(self.columns):\n                    with vsk.pushMatrix():\n                        vsk.rotate(self.fuzziness * 0.03 * vsk.random(-j, j))\n                        vsk.translate(\n                            self.fuzziness * 0.01 * vsk.randomGaussian() * j,\n                            self.fuzziness * 0.01 * vsk.randomGaussian() * j,\n                        )\n                        vsk.rect(0, 0, 1, 1)\n                    vsk.translate(1, 0)\n            vsk.translate(0, 1)\n```\n\nHit `ctrl-S`/`cmd-S` to save and, lo and behold, corresponding buttons just appeared in the viewer without even needing to restart it! Here is how it looks with some more fuzziness:\n\n\u003cimg width=\"600\" alt=\"image\" src=\"https://user-images.githubusercontent.com/49431240/107372262-84066a00-6ae5-11eb-8d0f-fb6d4291cb51.png\"\u003e\n\nLet's play a bit with the parameters until we find a combination we like, then hit the _Save_ button and enter a \"Best config\" as name.\n\n\u003cimg width=\"200\" alt=\"image\" src=\"https://user-images.githubusercontent.com/49431240/107372905-39d1b880-6ae6-11eb-8a73-5f8d01cac0a9.png\"\u003e\n\nWe just saved a configuration that we can load at any time.\n\nFinally, being extremely picky, it would be nice to be able to generate ONE HUNDRED versions of this sketch with various random seeds, in hope to find the most perfect version for plotting and framing. `vsk` will do this for you, using all CPU cores available:\n\n```bash\n$ vsk save --config \"Best config\" --seed 0..99 my_project\n```\n\nYou'll find all the SVG file in the project's `output` subdirectory:\n\n\u003cimg width=\"600\" alt=\"image\" src=\"https://user-images.githubusercontent.com/49431240/107375111-abab0180-6ae8-11eb-8034-d84c9d400ab2.png\"\u003e\n\nNext steps:\n* Use `vsk` integrated help to learn about the all the possibilities (`vsk --help`).\n* Learn the vsketch API on the documentation's [overview](https://vsketch.readthedocs.io/en/latest/overview.html) and [reference](https://vsketch.readthedocs.io/en/latest/reference.html) pages.\n\n\n## Acknowledgments\n\nPart of this project's documentation is inspired by or copied from the  [Processing project](https://processing.org).\n\n\n## License\n\nThis project is licensed under the MIT license. The documentation is licensed under the\n[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license. See the\n[documentation](https://vsketch.readthedocs.io/en/latest/license.html) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabey79%2Fvsketch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabey79%2Fvsketch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabey79%2Fvsketch/lists"}