docker run --rm -v "$(pwd)":/ci quay.io/pypa/manylinux2014_x86_64 /ci/build.sh pypi_publish.sh
or
python setup.py sdist bdist_wheel
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=<password>
twine upload target/wheels/*
When upgrading version should be changes in:
- setup.py
- Cargo.toml
- pyproject.toml
from event_sourcer import reduce_dict
class SumReducer:
def init(self):
return 0
def update(self, acc, value):
return acc + value
def finalize(self, acc):
return acc
class AvgReducer:
def init(self):
return (0, 0) # (total, count)
def update(self, acc, value):
total, count = acc
return (total + value, count + 1)
def finalize(self, acc):
total, count = acc
return total / count if count else None
# Any object supporting __getitem__ will work; here we use dicts.
def generate_objects():
yield {"a": 1, "b": 4}
yield {"a": 1, "c": 4}
reducers = {
"a": SumReducer(),
"b": AvgReducer(),
"c": AvgReducer(),
"d": SumReducer(),
}
result = reduce_dict(generate_objects(), reducers)
print(result)