diff options
Diffstat (limited to 'python-algorithmx.spec')
-rw-r--r-- | python-algorithmx.spec | 507 |
1 files changed, 507 insertions, 0 deletions
diff --git a/python-algorithmx.spec b/python-algorithmx.spec new file mode 100644 index 0000000..75dc1c3 --- /dev/null +++ b/python-algorithmx.spec @@ -0,0 +1,507 @@ +%global _empty_manifest_terminate_build 0 +Name: python-algorithmx +Version: 2.0.3 +Release: 1 +Summary: A library for network visualization and algorithm simulation. +License: MIT +URL: https://github.com/algrx/algorithmx-python +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a8/d1/e293d0ed901dae76e18ea98606a9a6e6967f988857ed908101292ee031c8/algorithmx-2.0.3.tar.gz +BuildArch: noarch + +Requires: python3-ipywidgets +Requires: python3-jupyterlab +Requires: python3-networkx + +%description +# AlgorithmX Python + + +[](https://pypi.org/project/algorithmx) + +<img src="https://raw.githubusercontent.com/algrx/algorithmx/master/img/logo.svg?sanitize=true" align="left" hspace="10" width="80px"> + +**AlgorithmX Python** is a library for network visualization and algorithm simulation, built on <a +href="https://github.com/algrx/algorithmx">AlgorithmX</a>. It can be used through a HTTP/WebSocket +server, or as a widget in Jupyter Notebooks and JupyterLab. +<br><br> + +<img src="https://raw.githubusercontent.com/algrx/algorithmx/master/img/example.svg?sanitize=true" align="center" width="600px"> + +## Resources + +- <a href="https://algrx.github.io/">Website</a> +- <a href="https://algrx.github.io/docs/python/">Documentation</a> + +## Installation + +Python 3.7.0 or higher is required. Using pip: + +``` +python -m pip install algorithmx +``` + +### Jupyter Widget + +In classic Jupyter notebooks, the widget will typically be enabled by default. To enable it +manually, run + +``` +jupyter nbextension enable --sys-prefix --py algorithmx +``` + +with the <a href="https://jupyter-notebook.readthedocs.io/en/stable/extending/frontend_extensions.html#installing-and-enabling-extensions">appropriate flag</a>. To enable in JupyterLab, run + +``` +python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build +python -m jupyter lab build +``` + +## Example Usage + +If you wish to use the library through a HTTP/WebSocket server, follow the template below: + +```python +import algorithmx + +server = algorithmx.http_server(port=5050) +canvas = server.canvas() + +def start(): + canvas.nodes([1, 2]).add() + canvas.edge((1, 2)).add() + +canvas.onmessage('start', start) +server.start() +``` + +The graphics can be found at `http://localhost:5050/`. + +If you are using Jupyter, try adding the following code to a cell: + +```python +from algorithmx import jupyter_canvas + +canvas = jupyter_canvas() + +canvas.nodes([1, 2]).add() +canvas.edge((1, 2)).add() + +canvas +``` + +## Development + +### Manual install + +Make sure you have Python 3.7 of higher, then run + +``` +# build js +cd js +npm run build +cd .. + +# install dependencies +python -m pip install -r dev-requirements.txt +python -m pip install --no-deps --editable ".[jupyter,networkx]" +``` + +### HTTP Server + +Docker: `Docker-compose up http-server` +Manually: `python examples/basic_http_server.py` + +Then open `localhost:5050` in a browser. + +### Jupyter notebook + +Docker: `docker-compose up notebook` +Manually: +``` +python -m jupyter nbextenion list +python -m jupyter notebook +``` + +Then try opening `examples/basic_notebook.ipynb`. + +### Jupyter lab + +Docker: `docker-compose up jupyter-lab` +Manually: +``` +python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build +python -m jupyter lab build +python -m jupyter labextension list +python -m jupyter lab +``` + +Then try opening `examples/basic_notebook.ipynb`. + +### Build and test package + +Clean any previous builds with `rm -rf build dist`. + +Docker: `docker-compose up --build build` +Manually: +``` +python -m mypy . +python -m pytest tests -vv +python setup.py build sdist bdist_wheel +``` + +The bundle can be found in `dist/`. + +### Distribute + +- Set up pre-commit hooks: `pre-commit install` +- Publish to PyPI: `./scripts/deploy.sh` + + + + +%package -n python3-algorithmx +Summary: A library for network visualization and algorithm simulation. +Provides: python-algorithmx +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-algorithmx +# AlgorithmX Python + + +[](https://pypi.org/project/algorithmx) + +<img src="https://raw.githubusercontent.com/algrx/algorithmx/master/img/logo.svg?sanitize=true" align="left" hspace="10" width="80px"> + +**AlgorithmX Python** is a library for network visualization and algorithm simulation, built on <a +href="https://github.com/algrx/algorithmx">AlgorithmX</a>. It can be used through a HTTP/WebSocket +server, or as a widget in Jupyter Notebooks and JupyterLab. +<br><br> + +<img src="https://raw.githubusercontent.com/algrx/algorithmx/master/img/example.svg?sanitize=true" align="center" width="600px"> + +## Resources + +- <a href="https://algrx.github.io/">Website</a> +- <a href="https://algrx.github.io/docs/python/">Documentation</a> + +## Installation + +Python 3.7.0 or higher is required. Using pip: + +``` +python -m pip install algorithmx +``` + +### Jupyter Widget + +In classic Jupyter notebooks, the widget will typically be enabled by default. To enable it +manually, run + +``` +jupyter nbextension enable --sys-prefix --py algorithmx +``` + +with the <a href="https://jupyter-notebook.readthedocs.io/en/stable/extending/frontend_extensions.html#installing-and-enabling-extensions">appropriate flag</a>. To enable in JupyterLab, run + +``` +python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build +python -m jupyter lab build +``` + +## Example Usage + +If you wish to use the library through a HTTP/WebSocket server, follow the template below: + +```python +import algorithmx + +server = algorithmx.http_server(port=5050) +canvas = server.canvas() + +def start(): + canvas.nodes([1, 2]).add() + canvas.edge((1, 2)).add() + +canvas.onmessage('start', start) +server.start() +``` + +The graphics can be found at `http://localhost:5050/`. + +If you are using Jupyter, try adding the following code to a cell: + +```python +from algorithmx import jupyter_canvas + +canvas = jupyter_canvas() + +canvas.nodes([1, 2]).add() +canvas.edge((1, 2)).add() + +canvas +``` + +## Development + +### Manual install + +Make sure you have Python 3.7 of higher, then run + +``` +# build js +cd js +npm run build +cd .. + +# install dependencies +python -m pip install -r dev-requirements.txt +python -m pip install --no-deps --editable ".[jupyter,networkx]" +``` + +### HTTP Server + +Docker: `Docker-compose up http-server` +Manually: `python examples/basic_http_server.py` + +Then open `localhost:5050` in a browser. + +### Jupyter notebook + +Docker: `docker-compose up notebook` +Manually: +``` +python -m jupyter nbextenion list +python -m jupyter notebook +``` + +Then try opening `examples/basic_notebook.ipynb`. + +### Jupyter lab + +Docker: `docker-compose up jupyter-lab` +Manually: +``` +python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build +python -m jupyter lab build +python -m jupyter labextension list +python -m jupyter lab +``` + +Then try opening `examples/basic_notebook.ipynb`. + +### Build and test package + +Clean any previous builds with `rm -rf build dist`. + +Docker: `docker-compose up --build build` +Manually: +``` +python -m mypy . +python -m pytest tests -vv +python setup.py build sdist bdist_wheel +``` + +The bundle can be found in `dist/`. + +### Distribute + +- Set up pre-commit hooks: `pre-commit install` +- Publish to PyPI: `./scripts/deploy.sh` + + + + +%package help +Summary: Development documents and examples for algorithmx +Provides: python3-algorithmx-doc +%description help +# AlgorithmX Python + + +[](https://pypi.org/project/algorithmx) + +<img src="https://raw.githubusercontent.com/algrx/algorithmx/master/img/logo.svg?sanitize=true" align="left" hspace="10" width="80px"> + +**AlgorithmX Python** is a library for network visualization and algorithm simulation, built on <a +href="https://github.com/algrx/algorithmx">AlgorithmX</a>. It can be used through a HTTP/WebSocket +server, or as a widget in Jupyter Notebooks and JupyterLab. +<br><br> + +<img src="https://raw.githubusercontent.com/algrx/algorithmx/master/img/example.svg?sanitize=true" align="center" width="600px"> + +## Resources + +- <a href="https://algrx.github.io/">Website</a> +- <a href="https://algrx.github.io/docs/python/">Documentation</a> + +## Installation + +Python 3.7.0 or higher is required. Using pip: + +``` +python -m pip install algorithmx +``` + +### Jupyter Widget + +In classic Jupyter notebooks, the widget will typically be enabled by default. To enable it +manually, run + +``` +jupyter nbextension enable --sys-prefix --py algorithmx +``` + +with the <a href="https://jupyter-notebook.readthedocs.io/en/stable/extending/frontend_extensions.html#installing-and-enabling-extensions">appropriate flag</a>. To enable in JupyterLab, run + +``` +python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build +python -m jupyter lab build +``` + +## Example Usage + +If you wish to use the library through a HTTP/WebSocket server, follow the template below: + +```python +import algorithmx + +server = algorithmx.http_server(port=5050) +canvas = server.canvas() + +def start(): + canvas.nodes([1, 2]).add() + canvas.edge((1, 2)).add() + +canvas.onmessage('start', start) +server.start() +``` + +The graphics can be found at `http://localhost:5050/`. + +If you are using Jupyter, try adding the following code to a cell: + +```python +from algorithmx import jupyter_canvas + +canvas = jupyter_canvas() + +canvas.nodes([1, 2]).add() +canvas.edge((1, 2)).add() + +canvas +``` + +## Development + +### Manual install + +Make sure you have Python 3.7 of higher, then run + +``` +# build js +cd js +npm run build +cd .. + +# install dependencies +python -m pip install -r dev-requirements.txt +python -m pip install --no-deps --editable ".[jupyter,networkx]" +``` + +### HTTP Server + +Docker: `Docker-compose up http-server` +Manually: `python examples/basic_http_server.py` + +Then open `localhost:5050` in a browser. + +### Jupyter notebook + +Docker: `docker-compose up notebook` +Manually: +``` +python -m jupyter nbextenion list +python -m jupyter notebook +``` + +Then try opening `examples/basic_notebook.ipynb`. + +### Jupyter lab + +Docker: `docker-compose up jupyter-lab` +Manually: +``` +python -m jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build +python -m jupyter lab build +python -m jupyter labextension list +python -m jupyter lab +``` + +Then try opening `examples/basic_notebook.ipynb`. + +### Build and test package + +Clean any previous builds with `rm -rf build dist`. + +Docker: `docker-compose up --build build` +Manually: +``` +python -m mypy . +python -m pytest tests -vv +python setup.py build sdist bdist_wheel +``` + +The bundle can be found in `dist/`. + +### Distribute + +- Set up pre-commit hooks: `pre-commit install` +- Publish to PyPI: `./scripts/deploy.sh` + + + + +%prep +%autosetup -n algorithmx-2.0.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-algorithmx -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.3-1 +- Package Spec generated |