Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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
```
3 changes: 0 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,3 @@
author, 'Streamz', 'Support for pipelines managing continuous streams of data.',
'Miscellaneous'),
]



4 changes: 3 additions & 1 deletion examples/map_failure_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
15 changes: 8 additions & 7 deletions examples/river_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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)
2 changes: 1 addition & 1 deletion examples/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down
Loading