hash-fixture


Namehash-fixture JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/moreati/hash-fixture/
SummaryProduce lines of reproducible test fixture by repeated hashing
upload_time2025-08-31 23:06:44
maintainerNone
docs_urlNone
authorAlex Willmer
requires_python!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,!=3.5,>=2.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            hash-fixture
============

Produce lines of reproducible test fixture by repeated hashing.

For a given set of options the output is deterministic, it will always have
the same checksum. So a large file can be reliably generated on demand, rather
than downloaded or stored in version control. Conversely the expected checksum
can be checked into version control, e.g. as part of a test suite.

Usage
-----

.. code:: pycon

   >>> import hash_fixture
   >>> lines = list(hash_fixture.lines(line_count=3))
   >>> for line in lines: print(line)
   b'000000001 hash-fixture/v0 sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=\n'
   b'000000002 hash-fixture/v0 sha256-/ut7HrShdeoT1CKjUIP5z/V/AhSHvjknBr3HRo3H/j4=\n'
   b'000000003 hash-fixture/v0 sha256-lL05gwF2SvDbQyK7C/2+JTFB4A3QMWYxn0fuLd9P5w0=\n'
   >>>
   >>> import hashlib
   >>> hashlib.sha256(b''.join(lines)).hexdigest()
   '3ef0546c961d1c40b848248cea7c552faa8ce1fdc49cda8c77a090f64e5a047f'

.. code:: console

   $ python3 -m hash_fixture --algorithm sha256 --line-count 3
   000000001 hash-fixture/v0 sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
   000000002 hash-fixture/v0 sha256-/ut7HrShdeoT1CKjUIP5z/V/AhSHvjknBr3HRo3H/j4=
   000000003 hash-fixture/v0 sha256-lL05gwF2SvDbQyK7C/2+JTFB4A3QMWYxn0fuLd9P5w0=
   $ python3 -m hash_fixture --algorithm sha256 --line-count 3 | sha256sum
   3ef0546c961d1c40b848248cea7c552faa8ce1fdc49cda8c77a090f64e5a047f

Install
-------

Use

.. code:: shell

   python3 -m pip install hash-fixture

or

.. code:: shell

   uv pip install hash-fixture

or copy `hash_fixture.py` somewhere convenient, it is a self contained script.

License
-------

..
   SPDX-FileCopyrightText: 2025 Alex Willmer <alex@moreati.org.uk>
   SPDX-License-Identifier: MIT

MIT

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/moreati/hash-fixture/",
    "name": "hash-fixture",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,!=3.5,>=2.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Alex Willmer",
    "author_email": "alex@moreati.org.uk",
    "download_url": "https://files.pythonhosted.org/packages/f6/7d/b3ba6e1ac031998a74901d5d56e639e2f18640414f55e82f58e423577ddb/hash_fixture-0.0.1.tar.gz",
    "platform": null,
    "description": "hash-fixture\n============\n\nProduce lines of reproducible test fixture by repeated hashing.\n\nFor a given set of options the output is deterministic, it will always have\nthe same checksum. So a large file can be reliably generated on demand, rather\nthan downloaded or stored in version control. Conversely the expected checksum\ncan be checked into version control, e.g. as part of a test suite.\n\nUsage\n-----\n\n.. code:: pycon\n\n   >>> import hash_fixture\n   >>> lines = list(hash_fixture.lines(line_count=3))\n   >>> for line in lines: print(line)\n   b'000000001 hash-fixture/v0 sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=\\n'\n   b'000000002 hash-fixture/v0 sha256-/ut7HrShdeoT1CKjUIP5z/V/AhSHvjknBr3HRo3H/j4=\\n'\n   b'000000003 hash-fixture/v0 sha256-lL05gwF2SvDbQyK7C/2+JTFB4A3QMWYxn0fuLd9P5w0=\\n'\n   >>>\n   >>> import hashlib\n   >>> hashlib.sha256(b''.join(lines)).hexdigest()\n   '3ef0546c961d1c40b848248cea7c552faa8ce1fdc49cda8c77a090f64e5a047f'\n\n.. code:: console\n\n   $ python3 -m hash_fixture --algorithm sha256 --line-count 3\n   000000001 hash-fixture/v0 sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=\n   000000002 hash-fixture/v0 sha256-/ut7HrShdeoT1CKjUIP5z/V/AhSHvjknBr3HRo3H/j4=\n   000000003 hash-fixture/v0 sha256-lL05gwF2SvDbQyK7C/2+JTFB4A3QMWYxn0fuLd9P5w0=\n   $ python3 -m hash_fixture --algorithm sha256 --line-count 3 | sha256sum\n   3ef0546c961d1c40b848248cea7c552faa8ce1fdc49cda8c77a090f64e5a047f\n\nInstall\n-------\n\nUse\n\n.. code:: shell\n\n   python3 -m pip install hash-fixture\n\nor\n\n.. code:: shell\n\n   uv pip install hash-fixture\n\nor copy `hash_fixture.py` somewhere convenient, it is a self contained script.\n\nLicense\n-------\n\n..\n   SPDX-FileCopyrightText: 2025 Alex Willmer <alex@moreati.org.uk>\n   SPDX-License-Identifier: MIT\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Produce lines of reproducible test fixture by repeated hashing",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/moreati/hash-fixture/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "03691e2c0be91573d7ed61e19b3094974ecb60779e3325ce083e17a37508575f",
                "md5": "9d0e922221e909b0b58ba2f74130fe22",
                "sha256": "d5123a59bfcf74c4254ff1877ba16e1064500fc0799abe04ac4939f0496462ee"
            },
            "downloads": -1,
            "filename": "hash_fixture-0.0.1-py2.p3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d0e922221e909b0b58ba2f74130fe22",
            "packagetype": "bdist_wheel",
            "python_version": "py2.p3",
            "requires_python": "!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,!=3.5,>=2.7",
            "size": 4679,
            "upload_time": "2025-08-31T23:06:42",
            "upload_time_iso_8601": "2025-08-31T23:06:42.183076Z",
            "url": "https://files.pythonhosted.org/packages/03/69/1e2c0be91573d7ed61e19b3094974ecb60779e3325ce083e17a37508575f/hash_fixture-0.0.1-py2.p3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f67db3ba6e1ac031998a74901d5d56e639e2f18640414f55e82f58e423577ddb",
                "md5": "f3f98975b3f87fbd2e7e51374b3fff02",
                "sha256": "3512d069522c008953d3db08fb19be0dee55906aa8c72910b866e24c63cda2cb"
            },
            "downloads": -1,
            "filename": "hash_fixture-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f3f98975b3f87fbd2e7e51374b3fff02",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,!=3.5,>=2.7",
            "size": 8366,
            "upload_time": "2025-08-31T23:06:44",
            "upload_time_iso_8601": "2025-08-31T23:06:44.641332Z",
            "url": "https://files.pythonhosted.org/packages/f6/7d/b3ba6e1ac031998a74901d5d56e639e2f18640414f55e82f58e423577ddb/hash_fixture-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-31 23:06:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "moreati",
    "github_project": "hash-fixture",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "hash-fixture"
}
        
Elapsed time: 0.44071s