{"id":13856702,"url":"https://github.com/elmotec/circlify","last_synced_at":"2026-02-20T00:32:41.182Z","repository":{"id":32571387,"uuid":"136864295","full_name":"elmotec/circlify","owner":"elmotec","description":"Circle packing similar to squarify for treemap","archived":false,"fork":false,"pushed_at":"2025-09-16T01:22:38.000Z","size":779,"stargazers_count":106,"open_issues_count":1,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-05T08:14:11.119Z","etag":null,"topics":["circle","graph","packing","visualization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elmotec.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-06-11T02:24:59.000Z","updated_at":"2025-12-29T23:23:28.000Z","dependencies_parsed_at":"2022-07-10T18:31:09.584Z","dependency_job_id":null,"html_url":"https://github.com/elmotec/circlify","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/elmotec/circlify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmotec%2Fcirclify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmotec%2Fcirclify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmotec%2Fcirclify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmotec%2Fcirclify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elmotec","download_url":"https://codeload.github.com/elmotec/circlify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmotec%2Fcirclify/sbom","scorecard":{"id":373642,"data":{"date":"2025-08-11","repo":{"name":"github.com/elmotec/circlify","commit":"4db4e005108ec56c9d378b5cd4493c32fcf715ca"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/coverage.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/python-package.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/coverage.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/coverage.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/coverage.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/coverage.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/coverage.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/coverage.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/python-package.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/elmotec/circlify/python-package.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/coverage.yml:23","Warn: pipCommand not pinned by hash: .github/workflows/coverage.yml:24","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:19","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:20","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:29","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:30","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   6 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T13:35:34.699Z","repository_id":32571387,"created_at":"2025-08-18T13:35:34.699Z","updated_at":"2025-08-18T13:35:34.699Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29637412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T22:32:43.237Z","status":"ssl_error","status_checked_at":"2026-02-19T22:32:38.330Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["circle","graph","packing","visualization"],"created_at":"2024-08-05T03:01:09.650Z","updated_at":"2026-02-20T00:32:41.158Z","avatar_url":"https://github.com/elmotec.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![PyPi version](https://img.shields.io/pypi/v/circlify.svg)](https://pypi.org/pypi/circlify/)\n[![Python compatibility](https://img.shields.io/pypi/pyversions/circlify.svg)](https://pypi.org/pypi/circlify/)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/elmotec/circlify/python-package.yml)](https://github.com/elmotec/circlify/actions/workflows/python-package.yml)\n[![codecov](https://codecov.io/gh/elmotec/circlify/branch/main/graph/badge.svg?token=PSE4TFPGTV)](https://codecov.io/gh/elmotec/circlify)\n\n# circlify\n\nPure Python implementation of a circle packing layout algorithm, inspired by [d3js](https://observablehq.com/@d3/zoomable-circle-packing) and [squarify](https://github.com/laserson/squarify).\n\nCircles are first arranged with a euristic inspired by the A1.0 of [\\[Huang-2006\\]](#Huang-2006), then enclosed in a circle created around them using [\\[MSW-1996\\]](#MSW-1996) algorithm used in [\\[Bostock-2017\\]](#Bostock-2017). I hope to implement A1.5 at some point in the future but the results are good enough for my use case.\n\n## Installation\n\nUsing pip:\n\n```python\n    pip install circlify\n```\n\nor using the source:\n\n```python\n    git clone git://github.com/elmotec/circlify.git\n    cd circlify\n    pip install .\n```\n\nThe last step may require `sudo` if you don\\\\'t have root access.\n\n## Usage\n\nThe main function `circlify` is supported by a small data class `circlify.Circle` and takes 3 parameters:\n\n-   A list of positive values sorted from largest to smallest.\n\n-   (optional) A target enclosure where the packed circles should fit.\n    It defaults to the unit circle (0, 0, 1).\n\n-   (optional) A boolean indicating if the target enclosure should be\n    appended to the output.\n\nThe function returns a list of `circlify.Circle` whose _area_ is proportional to the corresponding input value.\n\n### Example\n\n```python\n\u003e\u003e\u003e from pprint import pprint as pp\n\u003e\u003e\u003e import circlify as circ\n\u003e\u003e\u003e circles = circ.circlify([19, 17, 13, 11, 7, 5, 3, 2, 1], show_enclosure=True)\n\u003e\u003e\u003e pp(circles)\n[Circle(x=0.0, y=0.0, r=1.0, level=0, ex=None),\n Circle(x=-0.633232604611031, y=-0.47732413442115296, r=0.09460444572843042, level=1, ex={'datum': 1}),\n Circle(x=-0.7720311587589236, y=0.19946176418549022, r=0.13379089020993573, level=1, ex={'datum': 2}),\n Circle(x=-0.43168871955473165, y=-0.6391381648617572, r=0.16385970662353394, level=1, ex={'datum': 3}),\n Circle(x=0.595447603036083, y=0.5168251295666467, r=0.21154197162246005, level=1, ex={'datum': 5}),\n Circle(x=-0.5480911056188739, y=0.5115139053491098, r=0.2502998363185337, level=1, ex={'datum': 7}),\n Circle(x=0.043747233552068686, y=-0.6848366902134195, r=0.31376744998074435, level=1, ex={'datum': 11}),\n Circle(x=0.04298737651230445, y=0.5310431146935967, r=0.34110117996070605, level=1, ex={'datum': 13}),\n Circle(x=-0.3375943908160698, y=-0.09326467617622711, r=0.39006412239133215, level=1, ex={'datum': 17}),\n Circle(x=0.46484095011516874, y=-0.09326467617622711, r=0.4123712185399064, level=1, ex={'datum': 19})]\n```\n\nA simple matplotlib representation. See `circlify.bubbles` helper function (requires [matplotlib](https://matplotlib.org)):\n\n![](https://github.com/elmotec/circlify/blob/main/static/Figure_3.png)\n\n## Hierarchical circle packing\n\nStarting with version 0.10, circlify also handle hierarchical input so that:\n\n```python\n\u003e\u003e\u003e from pprint import pprint as pp\n\u003e\u003e\u003e import circlify as circ\n\u003e\u003e\u003e data = [\n        0.05, {'id': 'a2', 'datum': 0.05},\n        {'id': 'a0', 'datum': 0.8, 'children': [0.3, 0.2, 0.2, 0.1], },\n        {'id': 'a1', 'datum': 0.1, 'children': [\n            {'id': 'a1_1', 'datum': 0.05}, {'datum': 0.04}, 0.01],\n        },\n    ]\n\u003e\u003e\u003e circles = circ.circlify(data, show_enclosure=True)\n\u003e\u003e\u003e pp(circles)\n[Circle(x=0.0, y=0.0, r=1.0, level=0, ex=None),\n Circle(x=-0.5658030759977484, y=0.4109778665114514, r=0.18469903125906464, level=1, ex={'datum': 0.05}),\n Circle(x=-0.5658030759977484, y=-0.4109778665114514, r=0.18469903125906464, level=1, ex={'id': 'a2', 'datum': 0.05}),\n Circle(x=-0.7387961250362587, y=0.0, r=0.2612038749637415, level=1, ex={'id': 'a1', 'datum': 0.1, 'children': [{'id': 'a1_1', 'datum': 0.05}, {'datum': 0.04}, 0.01]}),\n Circle(x=0.2612038749637414, y=0.0, r=0.7387961250362586, level=1, ex={'id': 'a0', 'datum': 0.8, 'children': [0.3, 0.2, 0.2, 0.1]}),\n Circle(x=-0.7567888163564135, y=0.1408782365133844, r=0.0616618704777984, level=2, ex={'datum': 0.01}),\n Circle(x=-0.8766762590444033, y=0.0, r=0.1233237409555968, level=2, ex={'datum': 0.04}),\n Circle(x=-0.6154723840806618, y=0.0, r=0.13788013400814464, level=2, ex={'id': 'a1_1', 'datum': 0.05}),\n Circle(x=0.6664952237042414, y=0.33692908734605553, r=0.21174557028487648, level=2, ex={'datum': 0.1}),\n Circle(x=-0.1128831469183017, y=-0.23039288135707192, r=0.29945345726929773, level=2, ex={'datum': 0.2}),\n Circle(x=0.1563193680487183, y=0.304601976765483, r=0.29945345726929773, level=2, ex={'datum': 0.2}),\n Circle(x=0.5533243963620487, y=-0.23039288135707192, r=0.3667540860110527, level=2, ex={'datum': 0.3})]\n```\n\nA simple matplotlib representation. See `circlify.bubbles` helper function (requires [matplotlib](https://matplotlib.org)):\n\n![](https://github.com/elmotec/circlify/blob/main/static/Figure_4.png)\n\n### Relative size of circles in hierachy\n\nThe area of the circles are proportional to the values passed in input only if the circles are at the same hierarchical level. For instance: circles _a1_1_ and _a2_ both have a value of 0.05, yet _a1_1_ is smaller than _a2_ because _a1_1_ is fitted within its parent circle _a1_ one level below the level of _a2_. In other words, the level 1 circles _a1_ and _a2_ are both proportional to their respective values but _a1_1_ is proportional to the values on level 2 witin _a1_.\n\n### Invalid input\n\nA warning is issued if a key is not understood. The check is disabled if the program is running with [-O or -OO option](https://docs.python.org/3/using/cmdline.html#cmdoption-O). One can also disable the warning with the [regular logging filters](https://docs.python.org/3/library/logging.html#filter-objects).\n\nFor instance:\n\n```python\n\u003e\u003e\u003e import logging\n\u003e\u003e\u003e import sys\n\u003e\u003e\u003e import circlify as circ\n\u003e\u003e\u003e data = [ 0.05, {'id': 'a2', 'datum': 0.05, \"bogus\": {}}]\n\u003e\u003e\u003e logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))\n\u003e\u003e\u003e _ = circ.circlify(data)\nunexpected 'bogus' in input is ignored  # not issued if __debug__ is false\n```\n\n## References\n\n### Bostock-2017\n\nMike Bostock, D3.js, \u003chttps://beta.observablehq.com/@mbostock/miniball\u003e\n\n### Huang-2006\n\nWenQi HUANG, Yu LI, ChuMin LI, RuChu XU, New Heuristics for Packing Unequal Circles into a Circular Container, \u003chttps://home.mis.u-picardie.fr/~cli/Publis/circle.pdf\u003e\n\n### MSW-1996\n\nJ. Matoušek, M. Sharir, and E. Welzl. A Subexponential Bound For Linear Programming. Algorithmica, 16(4/5):498--516, October/November 1996, \u003chttp://www.inf.ethz.ch/personal/emo/PublFiles/SubexLinProg_ALG16_96.pdf\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmotec%2Fcirclify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felmotec%2Fcirclify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmotec%2Fcirclify/lists"}