{"id":37065074,"url":"https://github.com/kwzrd/pypopulation","last_synced_at":"2026-01-14T07:36:49.989Z","repository":{"id":49275569,"uuid":"289568461","full_name":"kwzrd/pypopulation","owner":"kwzrd","description":"Population lookup via ISO 3166 country codes","archived":false,"fork":false,"pushed_at":"2021-06-22T16:40:11.000Z","size":110,"stargazers_count":2,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-20T04:09:58.205Z","etag":null,"topics":["country","country-codes","iso-3166","iso3166","population","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pypopulation/","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/kwzrd.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":"2020-08-22T21:17:59.000Z","updated_at":"2022-03-13T15:01:26.000Z","dependencies_parsed_at":"2022-08-20T15:00:24.914Z","dependency_job_id":null,"html_url":"https://github.com/kwzrd/pypopulation","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kwzrd/pypopulation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwzrd%2Fpypopulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwzrd%2Fpypopulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwzrd%2Fpypopulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwzrd%2Fpypopulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwzrd","download_url":"https://codeload.github.com/kwzrd/pypopulation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwzrd%2Fpypopulation/sbom","scorecard":{"id":574941,"data":{"date":"2025-08-11","repo":{"name":"github.com/kwzrd/pypopulation","commit":"3768c6b1097e84744e983c4658041ccac090f3d8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/15 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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/checks.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.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/checks.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/kwzrd/pypopulation/checks.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/checks.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/kwzrd/pypopulation/checks.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/checks.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/kwzrd/pypopulation/checks.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/checks.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/kwzrd/pypopulation/checks.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/kwzrd/pypopulation/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/kwzrd/pypopulation/publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/kwzrd/pypopulation/publish.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/checks.yml:27","Warn: pipCommand not pinned by hash: .github/workflows/checks.yml:52","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:22","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   3 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":"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":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 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-20T17:25:04.693Z","repository_id":49275569,"created_at":"2025-08-20T17:25:04.694Z","updated_at":"2025-08-20T17:25:04.694Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["country","country-codes","iso-3166","iso3166","population","python"],"created_at":"2026-01-14T07:36:49.240Z","updated_at":"2026-01-14T07:36:49.978Z","avatar_url":"https://github.com/kwzrd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CalVer schema](https://img.shields.io/badge/CalVer-YYYY.MINOR-blue?style=flat-square)\n![Python versions](https://img.shields.io/badge/Python-v3.6.1%2B-blue?style=flat-square)\n![Flake8 \u0026 friends](https://img.shields.io/github/workflow/status/kwzrd/pypopulation/Lint%20\u0026%20Tests?label=Tests,%20Flake8%20%26%20friends\u0026style=flat-square)\n![Last commit](https://img.shields.io/github/last-commit/kwzrd/pypopulation/main?label=Last%20commit\u0026style=flat-square)\n\n# pypopulation\n\nLightweight population lookup using [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166) alpha-1/2 country codes for **Python 3.6.1** and higher.\n\n```python\n\u003e\u003e\u003e import pypopulation\n\u003e\u003e\u003e \n\u003e\u003e\u003e pypopulation.get_population(\"DE\")  # Germany\n83132799\n```\n\nThe aim is to provide a minimalist package with no dependencies that does one thing only, as best as possible. Population figures are read from a JSON file into Python dictionaries at import time. The API then only exposes the dictionaries.\n\n**The given figures are estimates at best.** Read below for more details on the data source.\n\n## Interface\n\nThe API is formed by 3 functions:\n* `get_population_a2`: population for a 2-letter country code\n* `get_population_a3`: population for a 3-letter country code\n* `get_population`: population for either a 2-letter or a 3-letter country code\n\nAll functions return `None` if no country is found for the given country code. **Lookup is case insensitive**, i.e. `\"DE\"` and `\"de\"` give same results.\n\nLookups using country names are difficult \u0026 not currently supported, but the source JSON file does contain them. This is to make the source file more comprehensible. If all you have to work with is a country name, consider using [`pycountry`](https://pypi.org/project/pycountry/) to resolve your names to ISO 3166 codes first.\n\nIf you would like to build your own wrapper around the source JSON, you can do:\n```python\ncountries: t.List[t.Dict] = pypopulation._load_file()\n```\n\n## Installation\n\nWith `pip` from [PyPI](https://pypi.org/):\n\n```\npip install pypopulation\n```\n\n## Development\n\nI'm using [`Poetry`](https://python-poetry.org/) to maintain development dependencies. These dependencies are only used to assure code quality. They are not necessary to use the package, and are not installed in a production environment.\n\nReplicate the development environment:\n```\npoetry install\n```\n\nRun lint, tests and produce a `.coverage` file:\n```\npoetry run flake8\npoetry run coverage run -m unittest\n```\n\nThese commands run in CI (GH Actions) on pull requests against `main`. Tests are ran on all supported Python versions. Refer to the [`Checks`](.github/workflows/checks.yml) workflow for more information. New releases trigger the [`Publish`](.github/workflows/publish.yml) workflow, which builds a distribution and pushes it to PyPI.\n\n## Data source\n\nThe population figures were sourced from [The World Bank](https://data.worldbank.org/indicator/SP.POP.TOTL) (`2020-07-01`). This dataset provides the country name, alpha-3 code, and population figures found in the resource JSON file. The data was enriched with alpha-2 country codes for each row. Rows not corresponding to political countries were removed, e.g. \"Middle East \u0026 North Africa (excluding high income)\". Some country names were adjusted for readability, e.g. expanded abbreviations. **No adjustments were made to the population figures**. Please refer to the linked page for a more detailed description of the dataset.\n\nThis projects aims to expose the linked data to Python code. It does not guarantee correctness of the provided figures.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwzrd%2Fpypopulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwzrd%2Fpypopulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwzrd%2Fpypopulation/lists"}