Skip to content

Commit

Permalink
Released to PyPI. Version bumped to 1.1.0.
Browse files Browse the repository at this point in the history
Released to PyPI.
Version number bumped to v1.1.0.
Version number now available as a static function.
  • Loading branch information
AlexHenderson committed Mar 5, 2022
1 parent 0e71992 commit 6c860b1
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 13 deletions.
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ authors:
affiliation: University of Manchester, UK
email: [email protected]
website: https://alexhenderson.info
version: v1.0.0
date-released: "2022-02-09"
version: v1.1.0
date-released: "2022-03-05"
license: MIT
license-url: https://spdx.org/licenses/MIT#licenseText
repository: "https://github.com/AlexHenderson/hasher/"
repository: "https://github.com/AlexHenderson/hasher"
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Python package to generate a stable hash value for either a single file, or a folder containing many files and
sub-folders.

Requires Python 3.7 or higher.

Features:
## Features ##
- The default hash type is `sha256`, although the user can specify any valid hash type provided by `hashlib`.
- A single hash is generated from a folder, regardless of how many files and sub-folders it contains.
- For a single file, the filename can be included into the hash if required (default is not to include).
Expand Down Expand Up @@ -108,11 +106,19 @@ output
hash name: md5
hash digest: f2865fa...<snip>...6679c3

## Requirements ##

python >= 3.7
pytest

### Installation ###

pip install hasher-AlexHenderson==1.1.0


## Usage rights ##
Copyright (c) 2022 Alex Henderson ([email protected])
Licensed under the MIT License. See https://opensource.org/licenses/MIT
SPDX-License-Identifier: MIT
Version 1.0.0
See https://github.com/AlexHenderson/hasher/ for the most recent version

Version 1.1.0
See https://github.com/AlexHenderson/hasher for the most recent version
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest~=7.0.1
setuptools~=60.9.3
31 changes: 31 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from setuptools import setup, find_packages


with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

setup(
name="hasher-AlexHenderson",
version="1.1.0",
author="Alex Henderson",
author_email="[email protected]",
description="Python package to generate a stable hash value for either a single file, or a folder containing many "
"files and sub-folders.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/AlexHenderson/hasher",
project_urls={
"Bug Tracker": "https://github.com/AlexHenderson/hasher/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
],
package_dir={"": "src"},
packages=find_packages(where="src"),
python_requires=">=3.7",
)
22 changes: 18 additions & 4 deletions src/hasher/hasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2022 Alex Henderson ([email protected])
# Licensed under the MIT License. See https://opensource.org/licenses/MIT
# SPDX-License-Identifier: MIT
# Version 1.0.0
# Version 1.1.0
# See https://github.com/AlexHenderson/hasher for the most recent version

import hashlib
Expand Down Expand Up @@ -61,14 +61,28 @@ class Hasher:
Copyright (c) 2022 Alex Henderson ([email protected])
Licensed under the MIT License. See https://opensource.org/licenses/MIT
SPDX-License-Identifier: MIT
Version 1.0.0
Version 1.1.0
See https://github.com/AlexHenderson/hasher for the most recent version
"""

# Define the version of this code
_version = "1.1.0"

# Define the default type of hash as 'sha256'
_default_hash_type = 'sha256'

@classmethod
def version(cls) -> str:
"""
Returns the version number of this code.
:return: The version number.
:rtype: str
"""

return Hasher._version

@classmethod
def default_hash_type(cls) -> str:
"""
Expand All @@ -77,7 +91,7 @@ def default_hash_type(cls) -> str:
:return: The default hash type.
:rtype: str
"""

return Hasher._default_hash_type

@classmethod
Expand Down Expand Up @@ -189,7 +203,7 @@ def generate(self,
logging.info(f"Hasher >>>>>>")

# Log the version of this source code
logging.info(f"Version: 1.0.0")
logging.info(f"Version: {Hasher._version}")

try:
# Normalise input
Expand Down

0 comments on commit 6c860b1

Please sign in to comment.