diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-10 07:22:29 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 07:22:29 +0000 |
| commit | 10678aeb69f0c3bed6f954fd91f51b77e869fc10 (patch) | |
| tree | 87120c7b9f7556e1cb774db21201e5d7a9a8fc56 /python-autoroutes.spec | |
| parent | 34e745f6e70708ef0939db5b69af3f9d7020c28a (diff) | |
automatic import of python-autoroutes
Diffstat (limited to 'python-autoroutes.spec')
| -rw-r--r-- | python-autoroutes.spec | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/python-autoroutes.spec b/python-autoroutes.spec new file mode 100644 index 0000000..8b55048 --- /dev/null +++ b/python-autoroutes.spec @@ -0,0 +1,288 @@ +%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 + + + +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 + + + +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 + + + +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 +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.5-1 +- Package Spec generated |
