Changeset - dd35ed25c255
[Not reviewed]
0 2 0
Ben Sturmfels (bsturmfels) - 3 years ago 2022-02-04 08:27:58
ben@sturm.com.au
doc: Document installation into a virtualenv.
2 files changed with 19 insertions and 2 deletions:
0 comments (0 inline, 0 general)
README.rst
Show inline comments
...
 
@@ -19,3 +19,3 @@ Installation
 

	
 
Of course, if you're familiar with Python development tools, you're welcome to install the module in a virtualenv, somewhere else, etc.
 
For development, a Python virtual environment may be more appropriate. See the development documentation for details.
 

	
doc/Development.rst
Show inline comments
...
 
@@ -13,2 +13,13 @@ The next sections describe how to run them standalone in your own development en
 

	
 
Installing
 
~~~~~~~~~~
 

	
 
Create a virtual environment, for example::
 

	
 
  python3 -m venv ~/.virtualenvs/conservancy-beancount
 

	
 
Install the ``conservancy_beancount`` as an editable package including the test dependencies::
 

	
 
  ~/.virtualenvs/conservancy-beancount/bin/python -m pip install --editable ~/conservancy/conservancy_beancount[test]
 

	
 
Running unit tests
...
 
@@ -20,2 +31,5 @@ Run::
 

	
 
Alternatively, you can run ``tox`` which will run the tests in a clean virtual
 
environment with all the relevant dependencies.
 

	
 
Type checking
...
 
@@ -25,2 +39,5 @@ Most of the code is typed, except for very dynamic loader methods. To run the ty
 

	
 
  # Beancount includes type declarations but not the `py.typed` flag file mypy
 
  # is looking for to know that. Create it ourselves.
 
  python -c 'import beancount, pathlib; pathlib.Path(beancount.__file__).with_name("py.typed").touch()'
 
  mypy conservancy_beancount
...
 
@@ -36,3 +53,3 @@ Books that use this plugin are expected to say::
 

	
 
When Beancount sees this directive after loading all the data, it passes everything it loaded through the ``run`` function in ``conservancy_beancount/plugin/__init__.py`` to be manipulated. Our ``run`` function, it turn, passes the data through hooks defined in other files under ``conservancy_beancount/plugin`` to normalize data and report errors. ``HookRegistry`` in ``__init__.py`` is the bridge between these two. It supports dynamically choosing which hooks are loaded at runtime, although we currently aren't using that.
 
When Beancount sees this directive after loading all the data, it passes everything it loaded through the ``run`` function in ``conservancy_beancount/plugin/__init__.py`` to be manipulated. Our ``run`` function, in turn, passes the data through hooks defined in other files under ``conservancy_beancount/plugin`` to normalize data and report errors. ``HookRegistry`` in ``__init__.py`` is the bridge between these two. It supports dynamically choosing which hooks are loaded at runtime, although we currently aren't using that.
 

	
0 comments (0 inline, 0 general)