diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a2731fac..42cf7220 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,47 @@ # Contributing to Streamz ## Streamz Conda Environment -For the convenience of the community streamz offers an environment file for contributors to create conda environments. A few basic quick start commands for creating a using a streamz conda environment are found below. +For CI, streamz uses environment files to create conda environments. +Contributors can reuse those files to create development environments. A few +basic quick start commands for creating a using a streamz conda environment +are found below. + +Environment files exist for all supported version under: +```shell +./ci/environment-py${VERSION}.yml +``` ### Creating Conda Development Environment -Creating the streamz conda environment can be achieved by simply running ```conda env create -f ./conda/environments/streamz_dev.yml``` +Creating a streamz conda environment can be achieved by running +```shell +export VERSION="314" +conda env create -f "./ci/environment-py$VERSION.yml" -n "streamz$VERSION" +conda activate "streamz${VERSION}" +pip install flake8 +pip install --editable=. --no-deps +``` ### Using Conda Environment -The streamz conda environment can be activated by running ```conda activate streamz_dev``` +The streamz conda environment can be activated in the future by running +```shell +conda activate "streamz${VERSION}" +``` -### Run Software Tests +### Creating a Non-Conda Environment +If you do not want to use conda, there is a ```requirements-test.txt``` file +in the proejct root that will install packages into the current python +environment: ```shell pip install --editable=. --requirement=requirements-test.txt -pytest -vvv +pip install flake8 ``` +We do not use it for CI, so please submit a PR to update it if you notice +that it has drifted away from the conda environments. (I.e. you cannot run +the tests.) + +### Run Software Tests +Once you activate your environment of choice, running pytest and flake8 will work: +```shell +pytest -vvv +flake8 streamz +``` \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index d307fc8f..ef64aef2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -163,6 +163,3 @@ author, 'Streamz', 'Support for pipelines managing continuous streams of data.', 'Miscellaneous'), ] - - - diff --git a/examples/map_failure_modes.py b/examples/map_failure_modes.py index 4fd11d10..ff4e1aac 100644 --- a/examples/map_failure_modes.py +++ b/examples/map_failure_modes.py @@ -28,7 +28,9 @@ async def main(run_flags): s_sync.sink(print, sync_source.name) async_stopping_source = make_counter("async stopping") - s_async_stop = async_stopping_source.rate_limit("500ms").map_async(flaky_async, async_stopping_source, stop_on_exception=True) + s_async_stop = (async_stopping_source + .rate_limit("500ms") + .map_async(flaky_async, async_stopping_source, stop_on_exception=True)) s_async_stop.sink(print, async_stopping_source.name) if run_flags[0]: diff --git a/examples/river_kmeans.py b/examples/river_kmeans.py index 4acbaf16..b3ae432a 100644 --- a/examples/river_kmeans.py +++ b/examples/river_kmeans.py @@ -2,21 +2,22 @@ import random import time +import holoviews as hv import pandas as pd - +import panel as pn +from hvplot import streamz # noqa: F401 # this monkeypatches streamz.dataframe +from panel.pane.holoviews import HoloViews +from river import cluster from streamz import Stream -import hvplot.streamz from streamz.river import RiverTrain -from river import cluster -import holoviews as hv -from panel.pane.holoviews import HoloViews -import panel as pn + hv.extension('bokeh') model = cluster.KMeans(n_clusters=3, sigma=0.1, mu=0.5) centres = [[random.random(), random.random()] for _ in range(3)] count = [0] + def gen(move_chance=0.05): centre = int(random.random() * 3) # 3x faster than random.randint(0, 2) if random.random() < move_chance: @@ -101,7 +102,6 @@ def start(event): def stop(event): print(count, "events") - global t0 t_spent = time.time() - t0 print("frequency", count[0] / t_spent, "Hz") print("Current centres", centres) @@ -128,5 +128,6 @@ def stop(event): print("Output centres", [list(c.values()) for c in model.centers.values()]) s.stop() + if __name__ == "__main__": main(viz=True) diff --git a/examples/scrape.py b/examples/scrape.py index f687835c..cc381987 100644 --- a/examples/scrape.py +++ b/examples/scrape.py @@ -14,7 +14,7 @@ def links_of_page(content_page): domain = '%s://%s' % (uri.scheme, uri.netloc) try: soup = BeautifulSoup(content, features="html.parser") - except: + except Exception: return [] else: links = [link.get('href') for link in soup.find_all('a')] diff --git a/setup.py b/setup.py index 78099d67..98702a86 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ license='BSD', keywords='streams', packages=packages + tests, - python_requires='>=3.9', + python_requires='>=3.10', long_description=(open('README.rst').read() if exists('README.rst') else ''), install_requires=list(open('requirements.txt').read().strip().split('\n')),