{"id":16759436,"url":"https://github.com/thefab/cpu_cores","last_synced_at":"2025-08-17T21:33:44.480Z","repository":{"id":10330288,"uuid":"12460900","full_name":"thefab/cpu_cores","owner":"thefab","description":"A small python library and utility to get the number of \"physical\" cpu cores (without hyperthreading logical cores) of a linux/osx box","archived":false,"fork":false,"pushed_at":"2022-09-05T11:43:27.000Z","size":200,"stargazers_count":2,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-12T11:45:50.345Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/thefab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.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":"2013-08-29T13:31:39.000Z","updated_at":"2017-04-28T07:46:23.000Z","dependencies_parsed_at":"2022-08-31T12:50:39.833Z","dependency_job_id":null,"html_url":"https://github.com/thefab/cpu_cores","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/thefab/cpu_cores","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefab%2Fcpu_cores","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefab%2Fcpu_cores/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefab%2Fcpu_cores/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefab%2Fcpu_cores/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thefab","download_url":"https://codeload.github.com/thefab/cpu_cores/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefab%2Fcpu_cores/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270912461,"owners_count":24666737,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-13T04:08:07.502Z","updated_at":"2025-08-17T21:33:44.452Z","avatar_url":"https://github.com/thefab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cpu_cores\n\n## Status (master branch)\n\n[![Build Status](https://travis-ci.org/thefab/cpu_cores.png)](https://travis-ci.org/thefab/cpu_cores)\n\n## What is it ?\n\n`cpu_cores` is small python library and utility to get the number of \"physical\" cpu cores (without hyperthreading logical cores) of a linux/osx box.\n\nOn Linux, this is not an easy task because of hyperthreaded logical cores included in `/proc/cpuinfo`. Please, read carefully [this excellent post](http://www.richweb.com/cpu_info) to understand why.\n\n## Special features\n\n- support Linux (well tested) and OSX (needs some extra tests files), easy to extend to support other OS\n- unit tests (\u003e 90% coverage)\n- python2 and python3 support\n- no dependencies\n\n## Warning\n\n`cpu_cores` is at an early stage of development (API can change).\n\nIf you have exotic Linux or OSX boxes with plenty of cpu cores, please provides the output of :\n\n    # For Linux\n    cat /proc/cpuinfo\n\n    or\n\n    # For OSX\n    /usr/sbin/system_profiler -detailLevel full SPHardwareDataType\n\n## Quickstart\n\n### Installation\n\n    pip install cpu_cores\n\n    Requirements: \n    - Python 2.6, 2.7, 3.2 or 3.3\n\n## Two ways to use it\n\n### As a python library\n\n    #!/usr/bin/env python\n\n    # Import\n    from cpu_cores import CPUCoresCounter\n\n    # We build an instance for the current operating system\n    instance = CPUCoresCounter.factory()\n\n    # Get the number of total real cpu cores\n    print instance.get_physical_cores_count()\n\n    # Get the number of total physical processors\n    print instance.get_physical_processors_count()\n\n### As a CLI utility\n\n    prompt$ get_cpu_physical_cores.py\n    Number of real physical processors : 1\n    Number of real physical cores      : 2\n\n\n    prompt$ get_cpu_physical_cores.py --single-value=cores\n    2\n\n\n    prompt$ get_cpu_physical_cores.py --single-value=processors\n    1\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthefab%2Fcpu_cores","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthefab%2Fcpu_cores","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthefab%2Fcpu_cores/lists"}