Metadata-Version: 2.5
Name: hwid
Version: 0.3.0
Summary: Extract the `hwid` on Windows, Linux, Mac. Cross-platform using Python, native OS detection.
Project-URL: changelog, https://github.com/hasansezertasan/hwid/blob/main/CHANGELOG.md
Project-URL: documentation, https://hasansezertasan.github.io/hwid
Project-URL: homepage, https://github.com/hasansezertasan/hwid
Project-URL: issues, https://github.com/hasansezertasan/hwid/issues
Project-URL: releasenotes, https://github.com/hasansezertasan/hwid/releases
Project-URL: source, https://github.com/hasansezertasan/hwid.git
Author-email: Hasan Sezer Taşan <hasansezertasan@gmail.com>
Maintainer-email: Hasan Sezer Taşan <hasansezertasan@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: automation,basedpyright,ci-cd,cli,command-line,coverage,fingerprint,fingerprinting,github-actions,hardware,hatch,hwid,id,identification,identifier,license,licensing,linting,machine,metadata,modern-python,mypy,package,prek,pypi,pytest,python,release-automation,ruff,sphinx,testing,tox,type-hints,typed,unique,uv
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# hwid

[![CI](https://github.com/hasansezertasan/hwid/actions/workflows/ci.yml/badge.svg)](https://github.com/hasansezertasan/hwid/actions/workflows/ci.yml)
[![Coverage](https://img.shields.io/codecov/c/github/hasansezertasan/hwid)](https://codecov.io/gh/hasansezertasan/hwid)
[![PyPI - Version](https://img.shields.io/pypi/v/hwid.svg)](https://pypi.org/project/hwid)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hwid.svg)](https://pypi.org/project/hwid)
[![License](https://img.shields.io/github/license/hasansezertasan/hwid.svg)](https://github.com/hasansezertasan/hwid/blob/main/LICENSE)
[![Latest Commit](https://img.shields.io/github/last-commit/hasansezertasan/hwid)](https://github.com/hasansezertasan/hwid)

[![Downloads](https://pepy.tech/badge/hwid)](https://pepy.tech/project/hwid)
[![Downloads/Month](https://pepy.tech/badge/hwid/month)](https://pepy.tech/project/hwid)
[![Downloads/Week](https://pepy.tech/badge/hwid/week)](https://pepy.tech/project/hwid)

Extract the `hwid` on Windows, Linux, Mac. Cross-platform using Python, native OS detection.

---

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
- [Motivation](#motivation)
- [Features](#features)
- [Warning](#warning)
- [Author](#author)
- [Disclaimer](#disclaimer)
- [License](#license)

## Installation

``` sh
pip install hwid
```

Install with [Homebrew](https://brew.sh) (macOS/Linux):

```sh
brew install hasansezertasan/tap/hwid
```

Install with [Scoop](https://scoop.sh) (Windows):

```sh
scoop bucket add hasansezertasan https://github.com/hasansezertasan/scoop-bucket
scoop install hasansezertasan/hwid
```

### Verify the installation

The package root is importable after installation:

```pycon
>>> from hwid import __doc__
>>> isinstance(__doc__, str)
True

```

<!--
TODO @hasansezertasan: Add project-specific, runnable examples here.

pytest runs the pycon examples in this file (--doctest-glob=README.md).
doctest cannot see Markdown and ends an example's expected output at the first
blank line, so leave a blank line before every closing fence -- as the example
above does. Without it the closing delimiter is read as part of the expected
output and the example fails ("Expected: 2 / Got: 2"). Examples with no output
line at all need the blank line too.
-->
## Usage

### As a Module

```python
import hwid

print(hwid.get_hwid())
```

### As a CLI Tool

The bare command prints the machine's hardware ID:

```sh
uvx hwid
```

Or, once installed, invoke the console script:

```sh
hwid            # prints the hardware ID
hwid version    # prints the package version
hwid info       # prints version, Python, and platform information
```

## Motivation

TL;DR I don't want to copy and paste it again...

I have created a bunch of desktop applications for Windows. I needed a way to license my applications for my users to use it without distributing to other people. I decided to use the hwid of the computer to license my applications. I needed a way to get the hwid of the computer, so I created this module. It has only one purpose: getting the hwid of the computer. It is cross-platform and does not require any external dependencies.

## Features

Library:

- Cross-platform (Windows, Linux, macOS) with native OS detection
- No external runtime dependencies
- Usable as a module or a CLI

Engineering:

- **Type Safety**: Full type hints checked by mypy, basedpyright, ty, pyrefly, and zuban
- **Code Quality**: Comprehensive linting and formatting with ruff, plus architecture-contract enforcement with import-linter
- **Testing**: pytest with coverage reporting and parallel execution
- **Documentation**: Sphinx documentation with the Shibuya theme, GitHub Pages deployment, and live per-PR documentation previews
- **CI/CD**: Automated testing, building, and publishing across multiple platforms
- **Security**: CodeQL, OpenSSF Scorecard, dependency review, secret scanning (gitleaks), dependency auditing (pip-audit), GitHub Actions static analysis (zizmor — a blocking prek/CI gate plus a Security-tab dashboard, over hardened least-privilege workflows), and a CycloneDX SBOM attached to every release
- **Managed `.gitignore`**: kept in sync with the upstream [github/gitignore](https://github.com/github/gitignore) templates by [cobo](https://github.com/hasansezertasan/cobo), with a weekly drift check
- **Modern Python**: uv for dependency management, hatch for building

## Warning

I do not recommend using this module for licensing purposes all alone. You can use it as a part of your licensing system.

If you are using server-client architecture, you can send the encrypted hwid to the server and check if it is valid. But keep in mind, It's easy to intercept the http requests with [mitmproxy] or other tools.

If you are using a local licensing system, you can encrypt the hwid and store it in a file. Then you can check if the encrypted hwid is valid. You can use [pyarmor] to obfuscate your code. It will make it harder to reverse engineer your code. Here is a [NeuralNine Tutorial][neuralnine-tutorial] using [Oxyry][oxyry]

<!-- xc-heading -->
## Development

Clone the repository and cd into the project directory:

```sh
git clone https://github.com/hasansezertasan/hwid
cd hwid
```

The commands below can also be executed using the [xc task runner](https://xcfile.dev/), which combines the usage instructions with the actual commands. Simply run `xc`, it will popup an interactive menu with all available tasks.

### `checks`

Run all checks to ensure code quality:

```sh
uvx "validate-pyproject[all]" pyproject.toml
uvx typos
uvx vulture src
uvx ruff check
uvx taplo lint pyproject.toml
uvx ruff format
uvx taplo format pyproject.toml
uvx mypy src
```

### `docs:serve`

Serve the documentation locally:

```sh
uv run --locked tox run -e docs-server
```

### `docs:build`

Build the documentation locally:

```sh
uv run --locked tox run -e docs-build
```

## Releasing

Versioning and releases are automated with [release-please](https://github.com/googleapis/release-please), driven by [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) PR titles squash-merged into `main`. release-please maintains a release PR that bumps the version and `CHANGELOG.md`; merging it tags the release and publishes to PyPI. See the [Contributing Guidelines](./.github/CONTRIBUTING.md#releasing) for the commit conventions, and the [Repository setup](./docs/maintaining/setup.rst) guide for one-time configuration and optional post-launch integrations such as a social preview, downstream packaging, and Repology.

## Author

- [hasansezertasan](https://www.github.com/hasansezertasan)

## Disclaimer

This module is not intended to be used for malicious purposes. The author is not responsible for any damage caused by this module. Use at your own risk.

## License

`hwid` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

<!-- Links -->
[mitmproxy]: https://mitmproxy.org/
[pyarmor]:https://github.com/dashingsoft/pyarmor
[neuralnine-tutorial]: https://www.youtube.com/watch?v=k4bLhDolLf0
[oxyry]: https://pyob.oxyry.com/
