Skip to content

Commit

Permalink
Update documents to prepare the next version
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimes committed Jan 9, 2024
1 parent 0916881 commit 24a31fa
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 13 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Beware that `hash64` returns **two** values, because it uses the 128-bit version
3812874078
```

`hash64`, `hash128`, and `hash_bytes` have the third argument for architecture optimization. Use True for x64 and False for x86 (default: True):
`hash64`, `hash128`, and `hash_bytes` have the third argument for architecture optimization (keyword arg: `x64arch`). Use True for x64 and False for x86 (default: True):

```shell
>>> mmh3.hash64("foo", 42, True)
Expand All @@ -72,7 +72,7 @@ Beware that `hash64` returns **two** values, because it uses the 128-bit version

In addition to the standard `digest()` method, each hasher has `sintdigest()`, which returns a signed integer, and `uintdigest()`, which returns an unsigned integer. 128 bit hashers also have `stupledigest()` and `utupledigest()` which return two 64 bit integers.

Note that as of version 4.0.1, the implementation is still experimental and its performance can be unsatisfactory (especially `mmh3_x86_128()`). Also, `hexdigest()` is not supported. Use `digest().hex()` instead.
Note that as of version 4.1.0, the implementation is still experimental and its performance can be unsatisfactory (especially `mmh3_x86_128()`). Also, `hexdigest()` is not supported. Use `digest().hex()` instead.

```shell
>>> import mmh3
Expand All @@ -96,6 +96,12 @@ b'\x82_n\xdd \xac\xb6j\xef\x99\xb1e\xc4\n\xc9\xfd'
```

## Changelog
### 4.1.0 (2024-01-09)
* Add support for Python 3.12.
* Change the project structure to fix issues when using Bazel (<https://github.com/hajimes/mmh3/issues/50>).
* Fix incorrect type hints (<https://github.com/hajimes/mmh3/issues/51>).
* Fix invalid results on s390x when the arg `x64arch` of `hash64` or `hash_bytes` is set to `False` (<https://github.com/hajimes/mmh3/issues/52>).

### 4.0.1 (2023-07-14)
* Fix incorrect type hints.
* Refactor the project structure (<https://github.com/hajimes/mmh3/issues/48>).
Expand All @@ -111,14 +117,7 @@ b'\x82_n\xdd \xac\xb6j\xef\x99\xb1e\xc4\n\xc9\xfd'
* A hash function now returns the same value under big-endian platforms as that under little-endian ones (<https://github.com/hajimes/mmh3/issues/47>).
* Remove the `__version__` constant from the module (<https://github.com/hajimes/mmh3/issues/42>). Use `importlib.metadata` instead.

### 3.1.0 (2023-03-24)
* Add support for Python 3.10 and 3.11. Thanks [wouter bolsterlee](https://github.com/wbolster) and [Dušan Nikolić](https://github.com/n-dusan)!
* Drop support for Python 3.6; remove legacy code for Python 2.x at the source code level.
* Add support for 32-bit architectures such as `i686` and `armv7l`. From now on, `hash` and `hash_from_buffer` on these architectures will generate the same hash values as those on other environments. Thanks [Danil Shein](https://github.com/dshein-alt)!
* In relation to the above, `manylinux2014_i686` wheels are now available.
* Support for hashing huge data (>16GB). Thanks [arieleizenberg](https://github.com/arieleizenberg)!

See [CHANGELOG.md](./CHANGELOG.md) for the complete changelog.
See [CHANGELOG.md](./docs/CHANGELOG.md) for the complete changelog.

## License
[MIT](./LICENSE), unless otherwise noted within a file.
Expand Down Expand Up @@ -153,6 +152,9 @@ Be careful so that these seeds do not exceed 32-bit. Unexpected results may happ
-156908512
```

## Contributing Guidelines
See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).

## Authors
MurmurHash3 was originally developed by Austin Appleby and distributed under public domain [https://github.com/aappleby/smhasher](https://github.com/aappleby/smhasher).

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md → docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## 4.1.0 (2024-01-09)
* Add support for Python 3.12.
* Change the project structure to fix issues when using Bazel (<https://github.com/hajimes/mmh3/issues/50>).
* Fix incorrect type hints (<https://github.com/hajimes/mmh3/issues/51>).
* Fix invalid results on s390x when the arg `x64arch` of `hash64` or `hash_bytes` is set to `False` (<https://github.com/hajimes/mmh3/issues/52>).

## 4.0.1 (2023-07-14)
* Fix incorrect type hints.
* Refactor the project structure (<https://github.com/hajimes/mmh3/issues/48>).
Expand Down
File renamed without changes.
53 changes: 53 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# mmh3 Contributing Guidelines

Thank you for your interest in contributing to the `mmh3` project!

Read [README.md](../README.md) to get an overview of the `mmh3` project,
and follow our [Code of Conduct](./CODE_OF_CONDUCT.md)
(ACM Code of Ethics and Professional Conduct).

## Issues

You can contribute to our project by
simply submitting a bug report or a feature suggestion
through the [issue tracker](https://github.com/hajimes/mmh3/issues).

Before submitting a new issue, it's a good idea to check [Known Issues section on README](https://github.com/hajimes/mmh3#known-issues).

## Maintaining and developing the project

### Project structure

As of 4.1.0, the layout of the project is as follows:

- `src/mmh3`
- `mmh3module.c`: the main file that serves as the interface between Python and the MurmurHash3 c implementations.
- `murmurhash.c`: implementations of the MurmurHash3 family. Auto-generated from Austin Appleby's original code. DO NOT edit this file manually. See [README in the util directory](../util/README.md) for details.
- `murmurhash.h`: headers and macros for MurmurHash3. Auto-generated from `util/refresh.py`. DO NOT edit this file manually.
- `hashlib.h`: taken from [CPython's code base](https://github.com/python/cpython/blob/9ce0f48e918860ffa32751a85b0fe7967723e2e3/Modules/hashlib.h).
- `util`
- `refresh.py`: file that generates `src/mmh3/murmurhash.c` and `src/mmh3/murmurhash.h` from the original MurmurHash3 C++ code. Edit this file to modify the contents of these files.

### Testing

Before submitting your changes, make sure to run the project's tests to ensure
that everything is working as expected.
At least you should run `pytest` and `mypy --strict tests`
from the project root directory.

#### (Optional) Testing on s390x

When you have modified the code in a way which may cause endian issues, you may want
to locally test on s390x, the only big-endian platform officially supported by
Python.

[*Emulating a big-endian s390x with QEMU*](https://til.simonwillison.net/docker/emulate-s390x-with-qemu)
by Simon Willison is a good introduction to Docker/QEMU settings for emulating
s390x.

### Pull request

Once you've pushed your changes to your fork, you can
[create a pull request (PR)](https://github.com/hajimes/mmh3/pulls) on the main
project repository. Please provide a clear and detailed description of your
changes in the PR, and reference any related issues.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mmh3"
version = "4.1.0-alpha.7"
version = "4.1.0-rc.1"
description = "Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions."
readme = "README.md"
license = {file = "LICENSE"}
Expand Down Expand Up @@ -35,7 +35,7 @@ test = [
[project.urls]
Homepage = "https://pypi.org/project/mmh3/"
Repository = "https://github.com/hajimes/mmh3"
Changelog = "https://github.com/hajimes/mmh3/blob/master/CHANGELOG.md"
Changelog = "https://github.com/hajimes/mmh3/blob/master/docs/CHANGELOG.md"
"Bug Tracker" = "https://github.com/hajimes/mmh3/issues"

[tool.isort]
Expand Down
5 changes: 4 additions & 1 deletion util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ This directory contains C files that were generated from the

## Updating _mmh3

Use the `refresh.py` script ***within this directory*** to generate PEP 7-compliant C code from Appleby's original SMHasher project, instead of editing `_mmh3` files manually. Add transformation code to the `refresh.py` script to perform further edits.
Try `git submodule update --init` to fetch Appleby's original SMHasher project as a github submodule.
Then, run the `refresh.py` script to generate PEP 7-compliant C code from the original project, instead of editing `murmurhash3.*` files manually.
Add transformation code to the `refresh.py` script to perform further edits.

After file generation, use `clang-format` (with `.clang-format` in the top directory of the `mmh3` project) to format the generated code.
Try `clang-format -i src/mmh3/murmurhash3.*` from the project's top-level directory.

## Local files

Expand Down

0 comments on commit 24a31fa

Please sign in to comment.