barnhunt


Namebarnhunt JSON
Version 1.2.1rc3 PyPI version JSON
download
home_page
SummaryHelpers for drawing Barn Hunt course maps using Inkscape
upload_time2023-08-04 21:17:23
maintainer
docs_urlNone
author
requires_python>=3.7
licenseGPL-3.0-only
keywords barn hunt inkscape course maps
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Barn Hunt Map Helper

[![Test status badge](https://img.shields.io/github/actions/workflow/status/barnhunt/barnhunt/ci.yml?label=tests)](https://github.com/barnhunt/barnhunt/actions/workflows/ci.yml)
[![Latest version badge](https://img.shields.io/pypi/v/barnhunt.svg)](https://pypi.org/project/barnhunt/)
[![Supported Python versions badge](https://img.shields.io/pypi/pyversions/barnhunt.svg)](https://pypi.org/project/barnhunt/)
[![Supported Inkscape versions badge](https://img.shields.io/badge/Inkscape-0.9x%E2%80%931.2.2-blue.svg?logo=inkscape)](https://inkscape.org/)
[![Development status badge](https://img.shields.io/pypi/status/barnhunt.svg)](https://pypi.org/project/barnhunt/)
[![Trackgit-views](https://us-central1-trackgit-analytics.cloudfunctions.net/token/ping/lhapwefdbvler7yp5dsl)](https://trackgit.com)

This is a helper script Jeff uses for drafting [Barn Hunt][] course
maps.

It does a bunch of stuff, but the important bit is that it exports PDF
versions of maps from [Inkscape][] SVG files.

I draw all the maps for a given ring (for a day or weekend) in a
single Inkscape drawing.  Various maps (for different trials/classes,
build map, rat-maps, base maps, etc.) are generated by hiding and
unhiding appropriate layers in the drawing and exporting to PDF.

This program automates that process.

## Requirements

This program requires Python, version 3.7 or higher to run.

It "should" work with all versions of Inkscape, 0.9x through 1.2.1.

I use this program on Linux, however the package now includes a GitHub
CI workflow that performs rudimentary testing on Windows and macOS, so
there’s a moderate chance it might "just work" on those platforms.
(Due to a dependency on the [pikepdf][] package, it should work on
x86_64-based Macs, but may not work on Macs that use Apple silicon. If
pikepdf compatibility is an issue for you, let me know — it’s probably
fixable.)

## Installation

### Windows

We now publish a compiled version of the program for Windows (which may
even work.) Using this version has the advantage that Python is not required
to be installed. (And even if Python is installed, this version may work-around
some bugs having to do with the various different ways that Python can be
installed on on Windows computer.)

1. Browse to our [releases](https://github.com/barnhunt/barnhunt/releases/)
   page. Select a release, and look down in the *Assets* section of the
   release page. (You may have to click the triangle to expand the
   *Assets* section.)

2. Download the MSI installer (the filename should end with `.msi` —
   e.g. `Barnhunt-1.2.0.49-x86_64-pc-windows-msvc.msi`). The file
   is not signed, so you may have to click through some nasty warnings
   about "unrecognized, potentially dangerous" files.

3. Once downloaded, open (double-click) the file you just
   downloaded. Hopefully and installer dialog should open.  Accept the
   default choices.

4. Now open a terminal command-line window. Type `barnhunt
   --version`. If all is good, barnhunt should report its version. Run
   `barnhunt --help` for the help screen.


### Linux (or Windows with Python installed)

As this package is published to
[PyPI](https://pypi.org/project/barnhunt/) it may be installed into a
[_virtualenv_][venv] using [`pip`][pip]. It is suggested that you use
[`pipx`][pipx] to combine those two steps.

A basic outline of how to proceed:

1. Install [python][] if it is not already installed.  (Version 3.7 or
   greater is required.)

2. Install [pipx][].  This might look like:

   ```sh
   python3 -m pip install --user pipx
   python3 -m pipx ensurepath
   ```

3. Install `barnhunt`.

   ```sh
   pipx install barnhunt
   ```

## How to Use

Sadly, this program is currently quite under-documented.

The functions of the basic sub-commands and command-line options are
tersely documented via the `--help` option.  Try:

```sh
barnhunt --help
```

and

```sh
barnhunt pdfs --help
```

for starters.

If you get stuck, kick me!

## Author

This package was written by Jeff Dairiki, BHAJ-221A, <dairiki@dairiki.org>.

----

[Inkscape]: https://inkscape.org/ (The Inkscape home page)
[Barn Hunt]: https://www.barnhunt.com/ (Barn Hunt — a fabulous sport for dogs)
[python]: https://www.python.org/ (The Python home page)
[venv]: https://docs.python.org/3/library/venv.html
(Python venv module documentation)
[pipx]: https://pypa.github.io/pipx/ (The pipx home page)
[pip]: https://pip.pypa.io/en/stable/ (Documentation for pip)
[pikepdf]: https://pikepdf.readthedocs.io/en/latest/installation.html
(The Installation section of the pikepdf documentation)

## Changes

### Release 1.2.1rc3 (2023-08-04)

#### Bugs Fixed

- Fix crash when clone refers to a hidden layer.

#### Internal API changes

- `Inkscape.svg.ancestor_layers(elem)` now includes `elem` in the
  returned results if `elem` is an Inkscape layer element.
  Previously, the search for ancestor layers strated with `elem`'s
  parent.

### Release 1.2.1rc2 (2023-06-06)

#### New Features

- Provide access to RDF metadata in the SVG source in string
  templates.  E.g. the document description may be interpolated via
  `{{ rdf['dc:description'] }}`.

#### Bugs Fixed

- Fix parsing of version strings reported by pre-release versions of
  Inkscape.

### Release 1.2.1rc1 (2023-05-22)

(There was no final release of 1.2.0. It is a long story. I mistakenly
committed a couple of files to LFS. To clear out LFS storage for a
GitHub repo, one has to [delete the whole repo](😬). As a result, the
workflow `$GITHUB_RUN_NUMBER` has reset. Thus a micro-version bump
is required to keep those PyOxidizer windows build version numbers —
`<major>.<minor>.<micro>.<run-number>` — monotonic.)

[delete the whole repo]: https://docs.github.com/en/repositories/working-with-files/managing-large-files/removing-files-from-git-large-file-storage#git-lfs-objects-in-your-repository

#### CLI Changes

- The `--inkscape-command`, `--processes` and `--shell-mode-inkscape`
  options have been moved from the `barnhunt pdfs` subcommand to the
  man `barnhunt` command group.

- And new `debug-info` subcommand has been added to display various
  information about the installed version of the `barnhunt` command
  and its execution environment.

- The `--dump-loaded-modules` option has been removed.  The
  functionality is still available by setting the
  `$BARNHUNT_DUMP_LOADED_MODULES` environment variable to a non-empty
  value.

#### Bugs Fixed

- Fixed exception in `barnhunt.cli.default_2up_output_file` during
  shell-completion for `barnhunt 2up`.

### Release 1.2.0rc6 (2023-04-27)

- Build an Windows executable and installer using [PyOxidizer].  The
  .msi installer should be downloadable from the
  [Releases](https://github.com/barnhunt/barnhunt/releases) page.

- Added a `--dump-loaded-modules` option which causes `barnhunt` to
  write a list of all loaded modules the current working directory.
  (This is a development tool, not generally useful to most users.)

- Hardwire the distribution version into `barnhunt.__version__` rather
  than deducing it via `importlib.metadata`.  This allows us to monkey
  with the version we report from the PyOxidizer-built Windows
  executable so that it indicates the MSI build version as well as
  the distribution version.

- Convert package from setuptools to PDM.

[PyOxidizer]: https://pyoxidizer.readthedocs.io/en/stable/pyoxidizer.html

### Release 1.2.0rc5 (2023-03-05)

#### Bugs Fixed

- When there was a visible “clone” (`<svg:use>` element) that
  referenced a source on a hidden layer were being pruned from the SVG
  before conversion to PDF.  (When exporting an SVG, hidden layers are
  omitted from the SVG — this speeds Inkscape up considerably when
  there is a large amount of hidden content.) Now we detect hidden
  layers that contain source material for clones, and retain them in
  the SVG file.

- Add a cruft pattern to ignore “`Gtk-WARNING"`” messages that have
  started appearing since I installed Inkscape from [Inkscape’s ppa][ppa].

- Fix tests to workaround segfault from pikepdf 7.0.0, 7.1.0, and 7.1.1.
  (See [pikepdf/pikepdf#452].)

[ppa]: https://inkscape.org/release/inkscape-1.2.2/gnulinux/ubuntu/ppa/dl/
[pikepdf/pikepdf#452]: https://github.com/pikepdf/pikepdf/issues/452).

### Release 1.2.0rc4 (2023-01-09)

Support python 3.11.

#### Bugs

- Shell-mode runner: fix readline/pexpect disagreement with respect to
  horizontal scrolling of long lines.  In some cases, when Inkscape is
  compiled to use GNU readline, long input lines will be scrolled
  horizontally (even when stdin is not a tty). This messes with
  pexpect's head. We've now added some basic tests for this, and set
  some environment variables to try to convince readline not to do the
  scrolling.

#### Testing

- Test under python 3.11
- Fix tests for Windows environments where $APPDATA is not set
- Fix tests for error message changes in packaging>=22

### Release 1.2.0rc3 (2022-10-19)

#### Extension/Symbols Installer

- Make code for deducing Inkscape profile directory more robust.
  (There's now a beter chance this will actually work on Windows.)
- Support setting Inkscape profile directory via `$INKSCAPE_PROFILE_DIR`.

### Release 1.2.0rc2 (2022-10-17)

### Extension and Symbol Set Installation

- This release add a `barnhunt install` (and `uninstall`) sub-command
  to simplify installation of the
  [inkex-bh](https://github.com/barnhunt/inkex-bh) Inkscape extensions
  and [bh-symbols](https://github.com/barnhunt/bh-symbols) symbol
  sets.

#### Testing

- Update to `mypy==0.982` for testing. Fix spurious mypy errors.

### Release 1.2.0rc1 (2022-08-31)

First public release to PyPI. Moved project to
[GitHub](https://github.com/barnhunt/barnhunt).

- Dropped support for python 3.6
- Changed license to GPL version 3
- We now do rudimentary testing under Windows and macOS.

#### Dependencies

- Use [pikepdf](https://pypi.org/project/pikepdf/) instead of
  [pdfrw](https://pypi.org/project/pdfrw/) to manipulate PDFs.  (Pdfrw
  seems not to be very actively maintained.) The only possible
  downside of this is that `pikepdf` is not pure-python. It claims to
  be easily installable on Windows and _x86_64_ Macs, but is not
  (easily) installable on Macs with Apple silicon.

- Generated PDFs are now [linearized][qpdf-linearize] and
  [compressed][qpdf-object-streams].

- Add test dependency on
  [pdfminer.six](https://pypi.org/project/pdfminer.six/) (but drop
  dependency on [PyPDF2](https://pypi.org/project/PyPDF2/)).


#### Compatibility

- Refactor `barnhunt.inkscape.runner` to support running
  Inkscape >= 1.0 (as well as continuing to support Inkscape 0.9x).

- Add `--inkscape-command` parameter to the `barnhunt pdfs` command
  to specify the name/path of the Inkscape binary to run to export PDFs.
  This also supports setting the Inkscape executable via the `$INKSCAPE_COMMAND`
  environment variable.  Default executable is not `inkscape.exe` on Windows
  (and `inkscape` everywhere else).

- Use `pexpect.popen_spawn.PopenSpawn` instead of `pexpect.spawn` to
  run Inkscape in shell-mode. Due to `pexpect.spawn`'s use of ptys, it
  [will not work][pexpect-windows] on Windows.

- **MacOS**: our code for running Inkscape in shell-mode appears to be broken.
  For now, on _macOS_ we default to not using shell-mode.

#### Packaging

- Added a stub `barnhunt.__main__` module to allow running via `python
  -m barnhunt`.

#### Testing

- Add type annotations.

#### Bit Rot

- Fix up tests to address deprecations in PyPDF2.

[qpdf-linearize]: https://qpdf.readthedocs.io/en/latest/cli.html?highlight=linearize#option-linearize
[qpdf-object-streams]: https://qpdf.readthedocs.io/en/latest/cli.html?highlight=object-streams#option-object-streams
[pexpect-windows]: https://pexpect.readthedocs.io/en/stable/overview.html#windows

### Release 1.1.0a1 (2022-03-08)

#### "Base Map" support

Add ability to mark layers for exclusion from particular output files.

This adds the ability to list multiple comma-separated output base
filenames for a given overlay.
E.g. A layer with label `"[o|build_notes,base] Build Notes"`
will define an overlay which will generate maps in two separate
output files.

Tagging a layer with `[!`_output-basename_`]` will exclude that
layer from any maps which are directed to the specified output
filename.

Tagging a layer with `[=`_output-basename_`]` will include that layer
from any maps which are directed to the specified output filename, while
excluding all other sibling layers not explicitly tagged to be included
in that output file.


### Release 1.0.1 (2021-11-10)

#### Diagnostics

`Barnhunt pdfs` now issues a warning when generating PDFs from an SVG
file which does not have an explicit random-seed set.

#### Bugs Fixed

Open SVG files in binary mode in order to let the XML parser figure
out the encoding from the XML declaration.

### Release 1.0 (2021-11-10)

Support python 3.10.

#### Random Seed

The way the random seed (used for generating random rat numbers) for
each SVG layer is computed has been changed in a
**backward-incompatible** way.  This was done so that rat numbers can
be kept from changing when an SVG source file is copied or edited in
such a way that the device and/or inode of the file changes.

Now, the file-level random seed (an integer) is read from the
`bh:random-seed` attribute of the root `svg` element of the SVG
file. If no `bh:random-seed` attribute is set, the file-level seed is
computed by hashing the device and inode numbers of the SVG file.

The layer-level seed is formed by hashing the file-level random seed
with the XML *id* of the layer.

(Formerly, the layer-level seed was form by hashing a triple of the
file-level seed (which was always zero), the hash of the SVG files
device and inode, and the id of the layer.)

A new `barnhunt random-seed` sub-command has been implemented to help
with setting the random seed for SVG source files.

#### Bit-rot

Address `DeprecationWarning: 'contextfunction' is renamed to
'pass_context'` from Jinja2. Require `Jinja2>3`.

#### OCDisms

Run `pyupgrade --py36-plus` on source.


### Release 0.5 (2021-05-04)

Make `-o` option to `2up` sub-command optional.

Remove support for python < 3.6.

### Release 0.4 (2019-02-25)

#### New Sub-Command: 2up

New `2up` sub-command to format PDFs for 2-up printing.  Pages are
pre-shuffled so that the 2-up pages do not need to be shuffled after
cutting.


### Release 0.3 (2019-02-20)

#### `barnhunt pdfs`

- Multi-page output support.

  There is a new syntax to specify the output file basename for an overlay.
  Multiple overlays which specify the same output file will all be saved to
  the same file.

- It is now possible to render course maps from multiple SVG files in a
  single invocation.  (Just list all the files to be rendered on the
  command line.)

#### Tests

- `test_layerinfo.test_layerflags_str`: Fix test to deal with
  arbitrary ordering of `enum.Flag` flags.

### Release 0.2 (2018-11-07)

#### Templating

- Do not expand text within hidden layers.  This avoids generating
  error messages (e.g. "'overlay' is undefined") due to template
  expansion of unused text.

- Add optional `skip` argument to the `random_rats` function.
  This allows the generation of more than one set of stable random rat
  numbers per layer.  E.g. `random_rats(skip=5)` will generate a set
  of random number totally uncorrelated to that generated by
  `random_rats()`.  Using `skip` has the advantage over using
  `seed=None` that the results are stable and do not vary from
  render to render.

### Release 0.1 (2018-11-07)

- Python 3.7 is now supported.

- The template for the output filename has been generalized to work
  sensibly in the case where overlays are nested more than two deep.

#### Templating

- Added new attributes to layers:

  `layer.is_overlay`
      Boolean.  True if layer is an overlay.

  `layer.lineage`
      Sequence starting with layer and including each parent layer in
      turn.

  `layer.overlay`
      Returns the nearest overlay layer.  If the layer is an overlay,
      `layer.overlay` returns `layer`, otherwise it returns the
      nearest parent layer which is an overlay.  If the layer is not
      contained within an overlay, returns `None`.

- Added new values to context when expanding text in SVG:

  `overlays`
      A list of all overlay layers in the lineage of the text
      element, in order from outermost to innermost.

  `course`
      The outermost overlay layer.  (Equivalent to `overlays[0]`.)
      This value already existed in the context used for filename expansion.

  `overlay`
      If the element is at least two overlays deep, this is the
      innermost overlay.  Otherwise it is unset.  This value already
      existed in the context used for filename expansion.

- Added new values to context when expanding output filenames:

  `overlays`
      A list of all overlay layers in the lineage of the overlay
      being expanded.

#### Bugs

- Templating: the `safepath` filter would fail with a `TypeError`
  if applied to anything but a string.  Now it coerces its argument to
  text.

- Templating: (New style) layer flags in parent layers were not being
  removed from the layer labels.  (E.g. `"{{ layer.parent.label }}"`
  was expanding to `"[o] Some Overlay"`, when it should expand to
  `"Some Overlay"`.)

- Pexpect==4.4.0 appears to have a subtle brokenness when
  `searchwindowsize` is set to something other than `None`.  The
  problem seems to be in [pexpect.expect.py][], and is triggered when
  multiple chunks of output are read before a match is found.

[pexpect.expect.py]: <https://github.com/pexpect/pexpect/blob/606f368b4a0dc442e2523d439d722a389b6e54c6/pexpect/expect.py#L22>

#### Bit-Rot

- Use `log.warning`, rather than the deprecated `log.warn`.

### Release 0.1a12 (2017-02-09)

- Remove tags from layer.label when expanding templated text in SVG file.

### Release 0.1a11 (2017-02-01)

- Add `--version` command line option

#### Pager for `coords`

- A fancy pager (poor man's `less`) has been added for viewing the
  output of the `barnhunt coords` sub-command.  If any of `sys.stdin`
  or `sys.stdout` is not a tty, then the pager will be disabled.

- Since there is now a fancy pager, the default for `--number-of-rows`
  has been increased to 1000.

### Release 0.1a10 (2017-01-30)

#### Things still to be fixed

Things still to be fixed: I'm pretty sure things are direly broken if
a drawing contains no overlays, and somewhat broken if a drawing
contains more than two layers of overlays.  The problems have to do
with how the output PDF filenames are determined...

#### New layer flag scheme

New scheme for marking overlay and hidden layers.  One can now set
bit-flags on layers by including the flags in square brackets at the
beginning of the layer label.  I.e. a label like `"[o] Master Trial
1"` marks the layer as an overlay layer, while `"[h] Prototypes"`
marks a hidden layer.

If no layers have any flags, `barnhunt pdfs` will fall back to the
old name-based heuristics for determining hidden and overlay layers.


### Release 0.1a9 (2017-01-03)

* When exporting PDFs, run `inkscape` with `--export-area-page`.

#### Packaging

* Fix MANIFEST.in. Tests were not being included in sdist.

* Add `url` to package metadata.

### Release 0.1a8 (2018-01-03)

* Ignore *ring* layers when identifying *course* layers.  (Now a layer
  labeled “C8 Ring” will not be treated as a course layer.)

* `pdfs`: default `--output-directory` to `.` (avoiding exception when no
  explicit output directory is specified.)

### Release 0.1a7 (2017-11-18)

* Change `barnhunt coords` so that it omits duplicate coordinates in its output.
  Also increase the default for `--number-of-rows` to 50 and
  add the `--group-size` parameter to separate output into groups.

### Release 0.1a6 (2017-11-15)

* Templating: `LabelAdapter` now stringifies to the layer label, and
  `FileAdapter` now stringifies to the file name.
* More refactoring, more tests
* Run several inkscapes in parallel.  This results in a major speedup.

### Release 0.1a5 (2017-11-13)

* Expand text in SVG file.
* Add tests.
* Major code refactor.

### Release 0.1a4 (2017-11-10)

#### PDFS

* Log unexpected output from inkscape.

* Add `--no-shell-mode-inkscape` option to control whether shell-mode inkscape
  optimization is used.

### Release 0.1a3.post1 (2017-11-10)

#### PDFS

* Reverse order that layers are considered.  (Layers are listed from
  bottom to top in the SVG file.)

### Release 0.1a3 (2017-11-10)

#### PDFS

Replace spaces and other shell-unfriendly characters with underscores
in output file names.

### Release 0.1a2 (2017-11-09)

Add sub-commands for generating random numbers.

### Release 0.1a1 (2017-11-07)

Initial release.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "barnhunt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "barn hunt inkscape course maps",
    "author": "",
    "author_email": "Jeff Dairiki <dairiki@dairiki.org>",
    "download_url": "https://files.pythonhosted.org/packages/07/a8/67f2f09beb55e946ed5b5c377479968e454a61634c296c5ec3ddc7af80fa/barnhunt-1.2.1rc3.tar.gz",
    "platform": null,
    "description": "# Barn Hunt Map Helper\n\n[![Test status badge](https://img.shields.io/github/actions/workflow/status/barnhunt/barnhunt/ci.yml?label=tests)](https://github.com/barnhunt/barnhunt/actions/workflows/ci.yml)\n[![Latest version badge](https://img.shields.io/pypi/v/barnhunt.svg)](https://pypi.org/project/barnhunt/)\n[![Supported Python versions badge](https://img.shields.io/pypi/pyversions/barnhunt.svg)](https://pypi.org/project/barnhunt/)\n[![Supported Inkscape versions badge](https://img.shields.io/badge/Inkscape-0.9x%E2%80%931.2.2-blue.svg?logo=inkscape)](https://inkscape.org/)\n[![Development status badge](https://img.shields.io/pypi/status/barnhunt.svg)](https://pypi.org/project/barnhunt/)\n[![Trackgit-views](https://us-central1-trackgit-analytics.cloudfunctions.net/token/ping/lhapwefdbvler7yp5dsl)](https://trackgit.com)\n\nThis is a helper script Jeff uses for drafting [Barn Hunt][] course\nmaps.\n\nIt does a bunch of stuff, but the important bit is that it exports PDF\nversions of maps from [Inkscape][] SVG files.\n\nI draw all the maps for a given ring (for a day or weekend) in a\nsingle Inkscape drawing.  Various maps (for different trials/classes,\nbuild map, rat-maps, base maps, etc.) are generated by hiding and\nunhiding appropriate layers in the drawing and exporting to PDF.\n\nThis program automates that process.\n\n## Requirements\n\nThis program requires Python, version 3.7 or higher to run.\n\nIt \"should\" work with all versions of Inkscape, 0.9x through 1.2.1.\n\nI use this program on Linux, however the package now includes a GitHub\nCI workflow that performs rudimentary testing on Windows and macOS, so\nthere\u2019s a moderate chance it might \"just work\" on those platforms.\n(Due to a dependency on the [pikepdf][] package, it should work on\nx86_64-based Macs, but may not work on Macs that use Apple silicon. If\npikepdf compatibility is an issue for you, let me know \u2014 it\u2019s probably\nfixable.)\n\n## Installation\n\n### Windows\n\nWe now publish a compiled version of the program for Windows (which may\neven work.) Using this version has the advantage that Python is not required\nto be installed. (And even if Python is installed, this version may work-around\nsome bugs having to do with the various different ways that Python can be\ninstalled on on Windows computer.)\n\n1. Browse to our [releases](https://github.com/barnhunt/barnhunt/releases/)\n   page. Select a release, and look down in the *Assets* section of the\n   release page. (You may have to click the triangle to expand the\n   *Assets* section.)\n\n2. Download the MSI installer (the filename should end with `.msi` \u2014\n   e.g. `Barnhunt-1.2.0.49-x86_64-pc-windows-msvc.msi`). The file\n   is not signed, so you may have to click through some nasty warnings\n   about \"unrecognized, potentially dangerous\" files.\n\n3. Once downloaded, open (double-click) the file you just\n   downloaded. Hopefully and installer dialog should open.  Accept the\n   default choices.\n\n4. Now open a terminal command-line window. Type `barnhunt\n   --version`. If all is good, barnhunt should report its version. Run\n   `barnhunt --help` for the help screen.\n\n\n### Linux (or Windows with Python installed)\n\nAs this package is published to\n[PyPI](https://pypi.org/project/barnhunt/) it may be installed into a\n[_virtualenv_][venv] using [`pip`][pip]. It is suggested that you use\n[`pipx`][pipx] to combine those two steps.\n\nA basic outline of how to proceed:\n\n1. Install [python][] if it is not already installed.  (Version 3.7 or\n   greater is required.)\n\n2. Install [pipx][].  This might look like:\n\n   ```sh\n   python3 -m pip install --user pipx\n   python3 -m pipx ensurepath\n   ```\n\n3. Install `barnhunt`.\n\n   ```sh\n   pipx install barnhunt\n   ```\n\n## How to Use\n\nSadly, this program is currently quite under-documented.\n\nThe functions of the basic sub-commands and command-line options are\ntersely documented via the `--help` option.  Try:\n\n```sh\nbarnhunt --help\n```\n\nand\n\n```sh\nbarnhunt pdfs --help\n```\n\nfor starters.\n\nIf you get stuck, kick me!\n\n## Author\n\nThis package was written by Jeff Dairiki, BHAJ-221A, <dairiki@dairiki.org>.\n\n----\n\n[Inkscape]: https://inkscape.org/ (The Inkscape home page)\n[Barn Hunt]: https://www.barnhunt.com/ (Barn Hunt \u2014 a fabulous sport for dogs)\n[python]: https://www.python.org/ (The Python home page)\n[venv]: https://docs.python.org/3/library/venv.html\n(Python venv module documentation)\n[pipx]: https://pypa.github.io/pipx/ (The pipx home page)\n[pip]: https://pip.pypa.io/en/stable/ (Documentation for pip)\n[pikepdf]: https://pikepdf.readthedocs.io/en/latest/installation.html\n(The Installation section of the pikepdf documentation)\n\n## Changes\n\n### Release 1.2.1rc3 (2023-08-04)\n\n#### Bugs Fixed\n\n- Fix crash when clone refers to a hidden layer.\n\n#### Internal API changes\n\n- `Inkscape.svg.ancestor_layers(elem)` now includes `elem` in the\n  returned results if `elem` is an Inkscape layer element.\n  Previously, the search for ancestor layers strated with `elem`'s\n  parent.\n\n### Release 1.2.1rc2 (2023-06-06)\n\n#### New Features\n\n- Provide access to RDF metadata in the SVG source in string\n  templates.  E.g. the document description may be interpolated via\n  `{{ rdf['dc:description'] }}`.\n\n#### Bugs Fixed\n\n- Fix parsing of version strings reported by pre-release versions of\n  Inkscape.\n\n### Release 1.2.1rc1 (2023-05-22)\n\n(There was no final release of 1.2.0. It is a long story. I mistakenly\ncommitted a couple of files to LFS. To clear out LFS storage for a\nGitHub repo, one has to [delete the whole repo](\ud83d\ude2c). As a result, the\nworkflow `$GITHUB_RUN_NUMBER` has reset. Thus a micro-version bump\nis required to keep those PyOxidizer windows build version numbers \u2014\n`<major>.<minor>.<micro>.<run-number>` \u2014 monotonic.)\n\n[delete the whole repo]: https://docs.github.com/en/repositories/working-with-files/managing-large-files/removing-files-from-git-large-file-storage#git-lfs-objects-in-your-repository\n\n#### CLI Changes\n\n- The `--inkscape-command`, `--processes` and `--shell-mode-inkscape`\n  options have been moved from the `barnhunt pdfs` subcommand to the\n  man `barnhunt` command group.\n\n- And new `debug-info` subcommand has been added to display various\n  information about the installed version of the `barnhunt` command\n  and its execution environment.\n\n- The `--dump-loaded-modules` option has been removed.  The\n  functionality is still available by setting the\n  `$BARNHUNT_DUMP_LOADED_MODULES` environment variable to a non-empty\n  value.\n\n#### Bugs Fixed\n\n- Fixed exception in `barnhunt.cli.default_2up_output_file` during\n  shell-completion for `barnhunt 2up`.\n\n### Release 1.2.0rc6 (2023-04-27)\n\n- Build an Windows executable and installer using [PyOxidizer].  The\n  .msi installer should be downloadable from the\n  [Releases](https://github.com/barnhunt/barnhunt/releases) page.\n\n- Added a `--dump-loaded-modules` option which causes `barnhunt` to\n  write a list of all loaded modules the current working directory.\n  (This is a development tool, not generally useful to most users.)\n\n- Hardwire the distribution version into `barnhunt.__version__` rather\n  than deducing it via `importlib.metadata`.  This allows us to monkey\n  with the version we report from the PyOxidizer-built Windows\n  executable so that it indicates the MSI build version as well as\n  the distribution version.\n\n- Convert package from setuptools to PDM.\n\n[PyOxidizer]: https://pyoxidizer.readthedocs.io/en/stable/pyoxidizer.html\n\n### Release 1.2.0rc5 (2023-03-05)\n\n#### Bugs Fixed\n\n- When there was a visible \u201cclone\u201d (`<svg:use>` element) that\n  referenced a source on a hidden layer were being pruned from the SVG\n  before conversion to PDF.  (When exporting an SVG, hidden layers are\n  omitted from the SVG \u2014 this speeds Inkscape up considerably when\n  there is a large amount of hidden content.) Now we detect hidden\n  layers that contain source material for clones, and retain them in\n  the SVG file.\n\n- Add a cruft pattern to ignore \u201c`Gtk-WARNING\"`\u201d messages that have\n  started appearing since I installed Inkscape from [Inkscape\u2019s ppa][ppa].\n\n- Fix tests to workaround segfault from pikepdf 7.0.0, 7.1.0, and 7.1.1.\n  (See [pikepdf/pikepdf#452].)\n\n[ppa]: https://inkscape.org/release/inkscape-1.2.2/gnulinux/ubuntu/ppa/dl/\n[pikepdf/pikepdf#452]: https://github.com/pikepdf/pikepdf/issues/452).\n\n### Release 1.2.0rc4 (2023-01-09)\n\nSupport python 3.11.\n\n#### Bugs\n\n- Shell-mode runner: fix readline/pexpect disagreement with respect to\n  horizontal scrolling of long lines.  In some cases, when Inkscape is\n  compiled to use GNU readline, long input lines will be scrolled\n  horizontally (even when stdin is not a tty). This messes with\n  pexpect's head. We've now added some basic tests for this, and set\n  some environment variables to try to convince readline not to do the\n  scrolling.\n\n#### Testing\n\n- Test under python 3.11\n- Fix tests for Windows environments where $APPDATA is not set\n- Fix tests for error message changes in packaging>=22\n\n### Release 1.2.0rc3 (2022-10-19)\n\n#### Extension/Symbols Installer\n\n- Make code for deducing Inkscape profile directory more robust.\n  (There's now a beter chance this will actually work on Windows.)\n- Support setting Inkscape profile directory via `$INKSCAPE_PROFILE_DIR`.\n\n### Release 1.2.0rc2 (2022-10-17)\n\n### Extension and Symbol Set Installation\n\n- This release add a `barnhunt install` (and `uninstall`) sub-command\n  to simplify installation of the\n  [inkex-bh](https://github.com/barnhunt/inkex-bh) Inkscape extensions\n  and [bh-symbols](https://github.com/barnhunt/bh-symbols) symbol\n  sets.\n\n#### Testing\n\n- Update to `mypy==0.982` for testing. Fix spurious mypy errors.\n\n### Release 1.2.0rc1 (2022-08-31)\n\nFirst public release to PyPI. Moved project to\n[GitHub](https://github.com/barnhunt/barnhunt).\n\n- Dropped support for python 3.6\n- Changed license to GPL version 3\n- We now do rudimentary testing under Windows and macOS.\n\n#### Dependencies\n\n- Use [pikepdf](https://pypi.org/project/pikepdf/) instead of\n  [pdfrw](https://pypi.org/project/pdfrw/) to manipulate PDFs.  (Pdfrw\n  seems not to be very actively maintained.) The only possible\n  downside of this is that `pikepdf` is not pure-python. It claims to\n  be easily installable on Windows and _x86_64_ Macs, but is not\n  (easily) installable on Macs with Apple silicon.\n\n- Generated PDFs are now [linearized][qpdf-linearize] and\n  [compressed][qpdf-object-streams].\n\n- Add test dependency on\n  [pdfminer.six](https://pypi.org/project/pdfminer.six/) (but drop\n  dependency on [PyPDF2](https://pypi.org/project/PyPDF2/)).\n\n\n#### Compatibility\n\n- Refactor `barnhunt.inkscape.runner` to support running\n  Inkscape >= 1.0 (as well as continuing to support Inkscape 0.9x).\n\n- Add `--inkscape-command` parameter to the `barnhunt pdfs` command\n  to specify the name/path of the Inkscape binary to run to export PDFs.\n  This also supports setting the Inkscape executable via the `$INKSCAPE_COMMAND`\n  environment variable.  Default executable is not `inkscape.exe` on Windows\n  (and `inkscape` everywhere else).\n\n- Use `pexpect.popen_spawn.PopenSpawn` instead of `pexpect.spawn` to\n  run Inkscape in shell-mode. Due to `pexpect.spawn`'s use of ptys, it\n  [will not work][pexpect-windows] on Windows.\n\n- **MacOS**: our code for running Inkscape in shell-mode appears to be broken.\n  For now, on _macOS_ we default to not using shell-mode.\n\n#### Packaging\n\n- Added a stub `barnhunt.__main__` module to allow running via `python\n  -m barnhunt`.\n\n#### Testing\n\n- Add type annotations.\n\n#### Bit Rot\n\n- Fix up tests to address deprecations in PyPDF2.\n\n[qpdf-linearize]: https://qpdf.readthedocs.io/en/latest/cli.html?highlight=linearize#option-linearize\n[qpdf-object-streams]: https://qpdf.readthedocs.io/en/latest/cli.html?highlight=object-streams#option-object-streams\n[pexpect-windows]: https://pexpect.readthedocs.io/en/stable/overview.html#windows\n\n### Release 1.1.0a1 (2022-03-08)\n\n#### \"Base Map\" support\n\nAdd ability to mark layers for exclusion from particular output files.\n\nThis adds the ability to list multiple comma-separated output base\nfilenames for a given overlay.\nE.g. A layer with label `\"[o|build_notes,base] Build Notes\"`\nwill define an overlay which will generate maps in two separate\noutput files.\n\nTagging a layer with `[!`_output-basename_`]` will exclude that\nlayer from any maps which are directed to the specified output\nfilename.\n\nTagging a layer with `[=`_output-basename_`]` will include that layer\nfrom any maps which are directed to the specified output filename, while\nexcluding all other sibling layers not explicitly tagged to be included\nin that output file.\n\n\n### Release 1.0.1 (2021-11-10)\n\n#### Diagnostics\n\n`Barnhunt pdfs` now issues a warning when generating PDFs from an SVG\nfile which does not have an explicit random-seed set.\n\n#### Bugs Fixed\n\nOpen SVG files in binary mode in order to let the XML parser figure\nout the encoding from the XML declaration.\n\n### Release 1.0 (2021-11-10)\n\nSupport python 3.10.\n\n#### Random Seed\n\nThe way the random seed (used for generating random rat numbers) for\neach SVG layer is computed has been changed in a\n**backward-incompatible** way.  This was done so that rat numbers can\nbe kept from changing when an SVG source file is copied or edited in\nsuch a way that the device and/or inode of the file changes.\n\nNow, the file-level random seed (an integer) is read from the\n`bh:random-seed` attribute of the root `svg` element of the SVG\nfile. If no `bh:random-seed` attribute is set, the file-level seed is\ncomputed by hashing the device and inode numbers of the SVG file.\n\nThe layer-level seed is formed by hashing the file-level random seed\nwith the XML *id* of the layer.\n\n(Formerly, the layer-level seed was form by hashing a triple of the\nfile-level seed (which was always zero), the hash of the SVG files\ndevice and inode, and the id of the layer.)\n\nA new `barnhunt random-seed` sub-command has been implemented to help\nwith setting the random seed for SVG source files.\n\n#### Bit-rot\n\nAddress `DeprecationWarning: 'contextfunction' is renamed to\n'pass_context'` from Jinja2. Require `Jinja2>3`.\n\n#### OCDisms\n\nRun `pyupgrade --py36-plus` on source.\n\n\n### Release 0.5 (2021-05-04)\n\nMake `-o` option to `2up` sub-command optional.\n\nRemove support for python < 3.6.\n\n### Release 0.4 (2019-02-25)\n\n#### New Sub-Command: 2up\n\nNew `2up` sub-command to format PDFs for 2-up printing.  Pages are\npre-shuffled so that the 2-up pages do not need to be shuffled after\ncutting.\n\n\n### Release 0.3 (2019-02-20)\n\n#### `barnhunt pdfs`\n\n- Multi-page output support.\n\n  There is a new syntax to specify the output file basename for an overlay.\n  Multiple overlays which specify the same output file will all be saved to\n  the same file.\n\n- It is now possible to render course maps from multiple SVG files in a\n  single invocation.  (Just list all the files to be rendered on the\n  command line.)\n\n#### Tests\n\n- `test_layerinfo.test_layerflags_str`: Fix test to deal with\n  arbitrary ordering of `enum.Flag` flags.\n\n### Release 0.2 (2018-11-07)\n\n#### Templating\n\n- Do not expand text within hidden layers.  This avoids generating\n  error messages (e.g. \"'overlay' is undefined\") due to template\n  expansion of unused text.\n\n- Add optional `skip` argument to the `random_rats` function.\n  This allows the generation of more than one set of stable random rat\n  numbers per layer.  E.g. `random_rats(skip=5)` will generate a set\n  of random number totally uncorrelated to that generated by\n  `random_rats()`.  Using `skip` has the advantage over using\n  `seed=None` that the results are stable and do not vary from\n  render to render.\n\n### Release 0.1 (2018-11-07)\n\n- Python 3.7 is now supported.\n\n- The template for the output filename has been generalized to work\n  sensibly in the case where overlays are nested more than two deep.\n\n#### Templating\n\n- Added new attributes to layers:\n\n  `layer.is_overlay`\n      Boolean.  True if layer is an overlay.\n\n  `layer.lineage`\n      Sequence starting with layer and including each parent layer in\n      turn.\n\n  `layer.overlay`\n      Returns the nearest overlay layer.  If the layer is an overlay,\n      `layer.overlay` returns `layer`, otherwise it returns the\n      nearest parent layer which is an overlay.  If the layer is not\n      contained within an overlay, returns `None`.\n\n- Added new values to context when expanding text in SVG:\n\n  `overlays`\n      A list of all overlay layers in the lineage of the text\n      element, in order from outermost to innermost.\n\n  `course`\n      The outermost overlay layer.  (Equivalent to `overlays[0]`.)\n      This value already existed in the context used for filename expansion.\n\n  `overlay`\n      If the element is at least two overlays deep, this is the\n      innermost overlay.  Otherwise it is unset.  This value already\n      existed in the context used for filename expansion.\n\n- Added new values to context when expanding output filenames:\n\n  `overlays`\n      A list of all overlay layers in the lineage of the overlay\n      being expanded.\n\n#### Bugs\n\n- Templating: the `safepath` filter would fail with a `TypeError`\n  if applied to anything but a string.  Now it coerces its argument to\n  text.\n\n- Templating: (New style) layer flags in parent layers were not being\n  removed from the layer labels.  (E.g. `\"{{ layer.parent.label }}\"`\n  was expanding to `\"[o] Some Overlay\"`, when it should expand to\n  `\"Some Overlay\"`.)\n\n- Pexpect==4.4.0 appears to have a subtle brokenness when\n  `searchwindowsize` is set to something other than `None`.  The\n  problem seems to be in [pexpect.expect.py][], and is triggered when\n  multiple chunks of output are read before a match is found.\n\n[pexpect.expect.py]: <https://github.com/pexpect/pexpect/blob/606f368b4a0dc442e2523d439d722a389b6e54c6/pexpect/expect.py#L22>\n\n#### Bit-Rot\n\n- Use `log.warning`, rather than the deprecated `log.warn`.\n\n### Release 0.1a12 (2017-02-09)\n\n- Remove tags from layer.label when expanding templated text in SVG file.\n\n### Release 0.1a11 (2017-02-01)\n\n- Add `--version` command line option\n\n#### Pager for `coords`\n\n- A fancy pager (poor man's `less`) has been added for viewing the\n  output of the `barnhunt coords` sub-command.  If any of `sys.stdin`\n  or `sys.stdout` is not a tty, then the pager will be disabled.\n\n- Since there is now a fancy pager, the default for `--number-of-rows`\n  has been increased to 1000.\n\n### Release 0.1a10 (2017-01-30)\n\n#### Things still to be fixed\n\nThings still to be fixed: I'm pretty sure things are direly broken if\na drawing contains no overlays, and somewhat broken if a drawing\ncontains more than two layers of overlays.  The problems have to do\nwith how the output PDF filenames are determined...\n\n#### New layer flag scheme\n\nNew scheme for marking overlay and hidden layers.  One can now set\nbit-flags on layers by including the flags in square brackets at the\nbeginning of the layer label.  I.e. a label like `\"[o] Master Trial\n1\"` marks the layer as an overlay layer, while `\"[h] Prototypes\"`\nmarks a hidden layer.\n\nIf no layers have any flags, `barnhunt pdfs` will fall back to the\nold name-based heuristics for determining hidden and overlay layers.\n\n\n### Release 0.1a9 (2017-01-03)\n\n* When exporting PDFs, run `inkscape` with `--export-area-page`.\n\n#### Packaging\n\n* Fix MANIFEST.in. Tests were not being included in sdist.\n\n* Add `url` to package metadata.\n\n### Release 0.1a8 (2018-01-03)\n\n* Ignore *ring* layers when identifying *course* layers.  (Now a layer\n  labeled \u201cC8 Ring\u201d will not be treated as a course layer.)\n\n* `pdfs`: default `--output-directory` to `.` (avoiding exception when no\n  explicit output directory is specified.)\n\n### Release 0.1a7 (2017-11-18)\n\n* Change `barnhunt coords` so that it omits duplicate coordinates in its output.\n  Also increase the default for `--number-of-rows` to 50 and\n  add the `--group-size` parameter to separate output into groups.\n\n### Release 0.1a6 (2017-11-15)\n\n* Templating: `LabelAdapter` now stringifies to the layer label, and\n  `FileAdapter` now stringifies to the file name.\n* More refactoring, more tests\n* Run several inkscapes in parallel.  This results in a major speedup.\n\n### Release 0.1a5 (2017-11-13)\n\n* Expand text in SVG file.\n* Add tests.\n* Major code refactor.\n\n### Release 0.1a4 (2017-11-10)\n\n#### PDFS\n\n* Log unexpected output from inkscape.\n\n* Add `--no-shell-mode-inkscape` option to control whether shell-mode inkscape\n  optimization is used.\n\n### Release 0.1a3.post1 (2017-11-10)\n\n#### PDFS\n\n* Reverse order that layers are considered.  (Layers are listed from\n  bottom to top in the SVG file.)\n\n### Release 0.1a3 (2017-11-10)\n\n#### PDFS\n\nReplace spaces and other shell-unfriendly characters with underscores\nin output file names.\n\n### Release 0.1a2 (2017-11-09)\n\nAdd sub-commands for generating random numbers.\n\n### Release 0.1a1 (2017-11-07)\n\nInitial release.\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "Helpers for drawing Barn Hunt course maps using Inkscape",
    "version": "1.2.1rc3",
    "project_urls": {
        "Homepage": "https://github.com/barnhunt/barnhunt"
    },
    "split_keywords": [
        "barn",
        "hunt",
        "inkscape",
        "course",
        "maps"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "97df1fb7086631198d8df6b5d97935c85670d28a482329c434cd22b3e6c0da5c",
                "md5": "5a88be57cc0414dd9907cf0b3a011546",
                "sha256": "e6605646ca9bf3b4e7cfe1d9503ec2a8b1d832ed7a026ec12898125d42551ade"
            },
            "downloads": -1,
            "filename": "barnhunt-1.2.1rc3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a88be57cc0414dd9907cf0b3a011546",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 57333,
            "upload_time": "2023-08-04T21:17:21",
            "upload_time_iso_8601": "2023-08-04T21:17:21.583617Z",
            "url": "https://files.pythonhosted.org/packages/97/df/1fb7086631198d8df6b5d97935c85670d28a482329c434cd22b3e6c0da5c/barnhunt-1.2.1rc3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07a867f2f09beb55e946ed5b5c377479968e454a61634c296c5ec3ddc7af80fa",
                "md5": "6fbc821de144745edc1929d795e7190e",
                "sha256": "e1477aa069462981272539d8f9387347547f578f74051711969c2420ca99f84f"
            },
            "downloads": -1,
            "filename": "barnhunt-1.2.1rc3.tar.gz",
            "has_sig": false,
            "md5_digest": "6fbc821de144745edc1929d795e7190e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 101779,
            "upload_time": "2023-08-04T21:17:23",
            "upload_time_iso_8601": "2023-08-04T21:17:23.395867Z",
            "url": "https://files.pythonhosted.org/packages/07/a8/67f2f09beb55e946ed5b5c377479968e454a61634c296c5ec3ddc7af80fa/barnhunt-1.2.1rc3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-04 21:17:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "barnhunt",
    "github_project": "barnhunt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "barnhunt"
}
        
Elapsed time: 0.12977s