Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 python-abp | 1 python-abp |
2 ========== | 2 ========== |
3 | 3 |
4 This repository contains a library for working with Adblock Plus filter lists, | 4 This repository contains a library for working with Adblock Plus filter lists, |
5 a script for rendering diffs between filter lists, and the script that is used | 5 a script for rendering diffs between filter lists, and the script that is used |
6 for building Adblock Plus filter lists from the form in which they are authored | 6 for building Adblock Plus filter lists from the form in which they are authored |
7 into the format suitable for consumption by the adblocking software (aka | 7 into the format suitable for consumption by the adblocking software (aka |
8 rendering). | 8 rendering). |
9 | 9 |
10 .. contents:: | 10 .. contents:: |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 from coverage tests by adding a comment, e.g. ``# pragma: no py2 cover``. | 203 from coverage tests by adding a comment, e.g. ``# pragma: no py2 cover``. |
204 | 204 |
205 All public functions, classes and methods should have docstrings compliant with | 205 All public functions, classes and methods should have docstrings compliant with |
206 `NumPy/SciPy documentation guide <https://github.com/numpy/numpy/blob/master/doc /HOWTO_DOCUMENT.rst.txt>`_. | 206 `NumPy/SciPy documentation guide <https://github.com/numpy/numpy/blob/master/doc /HOWTO_DOCUMENT.rst.txt>`_. |
207 One exception is the constructors of classes that the user is not expected to | 207 One exception is the constructors of classes that the user is not expected to |
208 instantiate (such as exceptions). | 208 instantiate (such as exceptions). |
209 | 209 |
210 | 210 |
211 Using the library with R | 211 Using the library with R |
212 ------------------------ | 212 ------------------------ |
213 | 213 Installation |
214 ``python-abp`` can be installed directly onto your system, or in a virtual | 214 ~~~~~~~~~~~~ |
215 environment. To install it directly onto your system with pip:: | 215 ``python-abp`` can be installed from PyPI or from the source code, either |
216 | 216 directly onto a system or in a virtual environment. |
217 $ pip install --upgrade python-abp | 217 |
218 | 218 To install from PyPI:: |
219 Or install onto your system from source:: | 219 |
Vasily Kuznetsov
2019/03/06 17:18:19
Perhaps we could make this a bit more comprehensiv
rhowell
2019/03/07 03:59:07
Seems like it's starting to get complicated trying
| |
220 | 220 $ pip install -U python-abp |
221 $ cd python-abp | 221 |
222 $ pip install --upgrade . | 222 To install from a local source, clone the repo and then:: |
Vasily Kuznetsov
2019/03/06 17:18:19
A simpler version would be:
$ pip install -U
rhowell
2019/03/07 03:59:07
Done.
| |
223 | 223 |
224 To install ``python-abp`` in a virtual environment with pip:: | 224 $ pip install -U /path/to/python-abp |
225 | 225 |
226 $ virtualenv venv | 226 To use the virtual environment, it must first be created. Python 2 and 3 use |
227 $ venv/bin/pip install --upgrade python-abp | 227 different scripts to create a virtualenv. |
228 | 228 |
229 Or install from source in a virtualenv:: | 229 In Python 2:: |
230 | 230 |
231 $ cd python-abp | 231 $ virtualenv env |
232 $ virtualenv venv | 232 |
233 $ venv/bin/pip install --upgrade . | 233 In Python 3:: |
234 | 234 |
235 Then import it with ``reticulate`` in R: | 235 $ python3 -m venv env |
236 | |
237 Then, use the virtualenv's version of pip to install python-abp, either from | |
238 PyPI or from source (as shown above):: | |
239 | |
240 $ env/bin/pip install -U python-abp | |
241 | |
242 For more information about virtualenv, please see the `User Guide`_ and the | |
243 docs_. | |
244 | |
245 Usage | |
246 ~~~~~ | |
247 In R, ``python-abp`` can be imported with ``reticulate``: | |
236 | 248 |
237 .. code-block:: R | 249 .. code-block:: R |
238 | 250 |
239 > library(reticulate) | 251 > library(reticulate) |
240 > use_virtualenv("~/path/to/python-abp/venv", required=TRUE) # If using vir tualenv | 252 > use_virtualenv("~/path/to/env", required=TRUE) # If using virtualenv |
241 > abp <- import("abp.filters.rpy") | 253 > abp <- import("abp.filters.rpy") |
242 | 254 |
243 Now you can use the functions with ``abp$functionname``, e.g. | 255 Now you can use the functions with ``abp$functionname``, e.g. |
244 ``abp$line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")``. | 256 ``abp$line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")`` |
257 | |
258 For more information about the reticulate package, see their guide_. | |
259 | |
260 .. _User Guide: https://virtualenv.pypa.io/en/latest/userguide/#usage | |
261 .. _docs: https://docs.python.org/3/library/venv.html | |
262 .. _guide: https://rstudio.github.io/reticulate/ | |
LEFT | RIGHT |