%global _empty_manifest_terminate_build 0 Name: python-autoroutes Version: 0.3.5 Release: 1 Summary: Routes for speed License: MIT URL: https://github.com/pyrates/autoroutes Source0: https://mirrors.nju.edu.cn/pypi/web/packages/2e/7f/e002f4dd05f77e0db829ff766a790e21eab063c599ea219181974e8b55cd/autoroutes-0.3.5.tar.gz BuildArch: noarch %description # Autoroutes Routes for speed. ## Install pip install autoroutes ## API ```python # Create a Routes instance from autoroutes import Routes routes = Routes() # Register a new route routes.add('path/to/resource/{id}', something='value', anything='else') # Try to match a route routes.match('path/to/resource/1234') > ({'something': 'value', 'anything': 'else'}, {'id': '1234'}) ``` ### Placeholders Placeholders are defined by a curly brace pair: `path/{var}`. By default, this will match any character but the slash ('/'). It's possible to control the placeholder type, either by: - using a named type: `alnum`, `digit`, `alpha`, `path` (matches everything), `any` (matches everything, including empty string), `string` (default): path/to/{var:digit} path/to/{var:string} # Same as path/to/{var} - using a normal regex (slower; also note that regex containing curly braces is not yet supported) path/to/{var:\d\d\d} Placeholders can appear anywhere in the path path/to/file.{ext} path/to/{name}.{ext} ## Building from source pip install cython make compile python setup.py develop ## Tests make test ## Benchmark ![](https://raw.githubusercontent.com/pyrates/autoroutes/master/benchmark.png) See [Benchmark](https://github.com/pyrates/autoroutes/wiki/Benchmark) for more details. ## Acknowledgements This package has been first made as a Cython port of the [R3](https://github.com/c9s/r3/) C router. See also [python-r3](https://framagit.org/ybon/python-r3), which was a first attempt to wrap R3. I was unhappy with the stability, and more curious about Cython, so I tried to make a first POC port, and was happy with it. %package -n python3-autoroutes Summary: Routes for speed Provides: python-autoroutes BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-autoroutes # Autoroutes Routes for speed. ## Install pip install autoroutes ## API ```python # Create a Routes instance from autoroutes import Routes routes = Routes() # Register a new route routes.add('path/to/resource/{id}', something='value', anything='else') # Try to match a route routes.match('path/to/resource/1234') > ({'something': 'value', 'anything': 'else'}, {'id': '1234'}) ``` ### Placeholders Placeholders are defined by a curly brace pair: `path/{var}`. By default, this will match any character but the slash ('/'). It's possible to control the placeholder type, either by: - using a named type: `alnum`, `digit`, `alpha`, `path` (matches everything), `any` (matches everything, including empty string), `string` (default): path/to/{var:digit} path/to/{var:string} # Same as path/to/{var} - using a normal regex (slower; also note that regex containing curly braces is not yet supported) path/to/{var:\d\d\d} Placeholders can appear anywhere in the path path/to/file.{ext} path/to/{name}.{ext} ## Building from source pip install cython make compile python setup.py develop ## Tests make test ## Benchmark ![](https://raw.githubusercontent.com/pyrates/autoroutes/master/benchmark.png) See [Benchmark](https://github.com/pyrates/autoroutes/wiki/Benchmark) for more details. ## Acknowledgements This package has been first made as a Cython port of the [R3](https://github.com/c9s/r3/) C router. See also [python-r3](https://framagit.org/ybon/python-r3), which was a first attempt to wrap R3. I was unhappy with the stability, and more curious about Cython, so I tried to make a first POC port, and was happy with it. %package help Summary: Development documents and examples for autoroutes Provides: python3-autoroutes-doc %description help # Autoroutes Routes for speed. ## Install pip install autoroutes ## API ```python # Create a Routes instance from autoroutes import Routes routes = Routes() # Register a new route routes.add('path/to/resource/{id}', something='value', anything='else') # Try to match a route routes.match('path/to/resource/1234') > ({'something': 'value', 'anything': 'else'}, {'id': '1234'}) ``` ### Placeholders Placeholders are defined by a curly brace pair: `path/{var}`. By default, this will match any character but the slash ('/'). It's possible to control the placeholder type, either by: - using a named type: `alnum`, `digit`, `alpha`, `path` (matches everything), `any` (matches everything, including empty string), `string` (default): path/to/{var:digit} path/to/{var:string} # Same as path/to/{var} - using a normal regex (slower; also note that regex containing curly braces is not yet supported) path/to/{var:\d\d\d} Placeholders can appear anywhere in the path path/to/file.{ext} path/to/{name}.{ext} ## Building from source pip install cython make compile python setup.py develop ## Tests make test ## Benchmark ![](https://raw.githubusercontent.com/pyrates/autoroutes/master/benchmark.png) See [Benchmark](https://github.com/pyrates/autoroutes/wiki/Benchmark) for more details. ## Acknowledgements This package has been first made as a Cython port of the [R3](https://github.com/c9s/r3/) C router. See also [python-r3](https://framagit.org/ybon/python-r3), which was a first attempt to wrap R3. I was unhappy with the stability, and more curious about Cython, so I tried to make a first POC port, and was happy with it. %prep %autosetup -n autoroutes-0.3.5 %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-autoroutes -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Jun 08 2023 Python_Bot - 0.3.5-1 - Package Spec generated