Skip to content

Commit

Permalink
Merge pull request #737 from Abjad/release/2.18
Browse files Browse the repository at this point in the history
2.18 Release PR
  • Loading branch information
josiah-wolf-oberholtzer authored Jul 8, 2016
2 parents 50906f8 + 9c246ad commit fdaa07b
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 146 deletions.
5 changes: 3 additions & 2 deletions abjad/docs/source/cookbook/creating_rest_delimited_slurs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ We add slur spanners inside our loop:

leaves = iterate(staff).by_class(scoretools.Leaf)
for group in iterate(leaves).by_run((Note, Chord)):
slur = Slur()
attach(slur, group)
if 1 < len(group):
slur = Slur()
attach(slur, group)

Here's the result:

Expand Down
4 changes: 2 additions & 2 deletions abjad/docs/source/reference_manual/voices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Select the components in a voice like this:
Selecting a voice's leaves
--------------------------

Use ``select_leaves()`` to select the leaves in a voice:
Use ``select(...).by_leaf()`` to select the leaves in a voice:

.. abjad::

voice.select_leaves()
select(voice).by_leaf()


Getting the length of a voice
Expand Down
36 changes: 17 additions & 19 deletions abjad/etc/packaging/packaging_transcript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,27 @@ Abjad 2.18
9. dot -V: graphviz version 2.38.0 (20140413.2041)

Python 3.5.1 (OSX) test results:
1. mainline py.test test results:
2. mainline doctest test results:
3. experimental py.test test results:
4. experimental doctest test results:
7. sanity check test results:
8. experimental HTML build results:
9. mainline HTML build results:
1. mainline py.test test results: 10130 passed, 12 skipped
2. mainline doctest test results: 12111 tests passed in 908 modules
3. experimental py.test test results: 3 passed, 0 skipped
4. experimental doctest test results: 120 tests passed in 43 modules
7. sanity check test results: OK
8. experimental HTML build results: OK
9. mainline HTML build results: OK

Python 3.5.1 (Windows) test results:
1. mainline py.test test results:
2. mainline doctest test results:
3. experimental py.test test results:
4. experimental doctest test results:
7. sanity check test results:
8. experimental HTML build results:
9. mainline HTML build results:
1. mainline py.test test results: 10128 passed, 15 skipped
2. mainline doctest test results: 12111 tests passed in 908 modules
3. experimental py.test test results: 3 passed, 0 skipped
4. experimental doctest test results: 120 tests passed in 43 modules
7. sanity check test results: OK

Python 2.7.9 (OSX) test results:
1. mainline py.test test results:
2. mainline doctest test results:
3. experimental py.test test results:
4. experimental doctest test results:
7. sanity check test results:
1. mainline py.test test results: 10121 passed, 10 skipped
2. mainline doctest test results: 12111 tests passed in 908 modules
3. experimental py.test test results: 3 passed, 0 skipped
4. experimental doctest test results: 120 tests passed in 43 modules
7. sanity check test results: OK


Abjad 2.17
Expand Down
4 changes: 4 additions & 0 deletions abjad/ext/ipython.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ def load_ipython_extension(ipython):
from abjad.tools import topleveltools
play = ipythontools.Play()
show = ipythontools.Show()
graph = ipythontools.Graph()
abjad.play = play
abjad.show = show
abjad.graph = graph
topleveltools.play = play
topleveltools.show = show
topleveltools.graph = graph
names = {
'play': play,
'show': show,
'graph': graph,
}
ipython.push(names)
34 changes: 17 additions & 17 deletions abjad/tools/commandlinetools/ManageBuildTargetScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,23 +434,23 @@ def _setup_argument_parser(self, parser):
help='list build targets',
action='store_true',
)
action_group.add_argument(
'--copy', '-Y',
help='copy build target',
metavar=('SOURCE', 'TARGET'),
nargs=2,
)
action_group.add_argument(
'--rename', '-M',
help='rename build target',
metavar=('SOURCE', 'TARGET'),
nargs=2,
)
action_group.add_argument(
'--delete', '-D',
help='delete build target',
metavar='NAME',
)
# action_group.add_argument(
# '--copy', '-Y',
# help='copy build target',
# metavar=('SOURCE', 'TARGET'),
# nargs=2,
# )
# action_group.add_argument(
# '--rename', '-M',
# help='rename build target',
# metavar=('SOURCE', 'TARGET'),
# nargs=2,
# )
# action_group.add_argument(
# '--delete', '-D',
# help='delete build target',
# metavar='NAME',
# )
render_group = parser.add_argument_group(
'--render flags',
'Use when rendering specific assets only.',
Expand Down
34 changes: 17 additions & 17 deletions abjad/tools/commandlinetools/ManageMaterialScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,23 @@ def _setup_argument_parser(self, parser):
help='list materials',
action='store_true',
)
action_group.add_argument(
'--copy', '-Y',
help='copy material',
metavar=('SOURCE', 'TARGET'),
nargs=2,
)
action_group.add_argument(
'--rename', '-M',
help='rename material',
metavar=('SOURCE', 'TARGET'),
nargs=2,
)
action_group.add_argument(
'--delete', '-D',
help='delete material',
metavar='NAME',
)
# action_group.add_argument(
# '--copy', '-Y',
# help='copy material',
# metavar=('SOURCE', 'TARGET'),
# nargs=2,
# )
# action_group.add_argument(
# '--rename', '-M',
# help='rename material',
# metavar=('SOURCE', 'TARGET'),
# nargs=2,
# )
# action_group.add_argument(
# '--delete', '-D',
# help='delete material',
# metavar='NAME',
# )
common_group = parser.add_argument_group('common options')
common_group.add_argument(
'--score-path', '-s',
Expand Down
34 changes: 17 additions & 17 deletions abjad/tools/commandlinetools/ManageSegmentScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,23 +392,23 @@ def _setup_argument_parser(self, parser):
help='list segments',
action='store_true',
)
action_group.add_argument(
'--copy', '-Y',
help='copy segment',
metavar=('SOURCE', 'TARGET'),
nargs=2,
)
action_group.add_argument(
'--rename', '-M',
help='rename segment',
metavar=('SOURCE', 'TARGET'),
nargs=2,
)
action_group.add_argument(
'--delete', '-D',
help='delete segment',
metavar='NAME',
)
# action_group.add_argument(
# '--copy', '-Y',
# help='copy segment',
# metavar=('SOURCE', 'TARGET'),
# nargs=2,
# )
# action_group.add_argument(
# '--rename', '-M',
# help='rename segment',
# metavar=('SOURCE', 'TARGET'),
# nargs=2,
# )
# action_group.add_argument(
# '--delete', '-D',
# help='delete segment',
# metavar='NAME',
# )
common_group = parser.add_argument_group('common options')
common_group.add_argument(
'--score-path', '-s',
Expand Down
78 changes: 78 additions & 0 deletions abjad/tools/ipythontools/Graph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
import tempfile


class Graph(object):
r'''IPython replacement callable for `topleveltools.graph()`.
'''

### SPECIAL METHODS ###

def __call__(
self,
expr,
layout='dot',
graph_attributes=None,
node_attributes=None,
edge_attributes=None,
**kwargs
):
r'''A replacement for Ajbad's graph function for IPython Notebook.
'''
from abjad.tools import systemtools
from IPython.core.display import display_png

if isinstance(expr, str):
graphviz_format = expr
else:
assert hasattr(expr, '__graph__')
graphviz_graph = expr.__graph__(**kwargs)
if graph_attributes:
graphviz_graph.attributes.update(graph_attributes)
if node_attributes:
graphviz_graph.node_attributes.update(node_attributes)
if edge_attributes:
graphviz_graph.edge_attributes.update(edge_attributes)
graphviz_format = str(graphviz_graph)

valid_layouts = (
'circo',
'dot',
'fdp',
'neato',
'osage',
'sfdp',
'twopi',
)
assert layout in valid_layouts

message = 'cannot find `{}` command-line tool.'
message = message.format(layout)
message += ' Please download Graphviz from graphviz.org.'
assert systemtools.IOManager.find_executable(layout), message
assert systemtools.IOManager.find_executable('convert')

temporary_directory = tempfile.mkdtemp()
dot_path = os.path.join(temporary_directory, 'graph.dot')
pdf_path = os.path.join(temporary_directory, 'graph.pdf')
png_path = os.path.join(temporary_directory, 'graph.png')

with open(dot_path, 'w') as file_pointer:
file_pointer.write(graphviz_format)

command = '{} -v -Tpdf {} -o {}'
command = command.format(layout, dot_path, pdf_path)
subprocess.call(command, shell=True)

command = 'convert {} -trim {}'
command = command.format(pdf_path, png_path)
subprocess.call(command, shell=True)

systemtools.IOManager.spawn_subprocess(command)
with open(png_path, 'rb') as file_pointer:
png = file_pointer.read()
shutil.rmtree(temporary_directory)
display_png(png, raw=True)
Loading

0 comments on commit fdaa07b

Please sign in to comment.