Skip to content

Commit a9c17d2

Browse files
authored
Merge branch 'master' into master
2 parents 766b45e + c5b08a3 commit a9c17d2

18 files changed

+407
-234
lines changed

.github/workflows/publish-docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install poetry
3232
run: |
3333
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
34-
python get-poetry.py -y
34+
python get-poetry.py -y --version 1.0.10
3535
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
3636
rm get-poetry.py
3737

.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
python-version: [ '2.7', '3.x' ]
14-
tmux-version: [ '2.6', '2.7', '2.8', '3.0', 'master' ]
14+
tmux-version: [ '2.6', '2.7', '2.8', '3.0a', '3.1b', 'master' ]
1515
steps:
1616
- uses: actions/checkout@v1
1717

@@ -28,7 +28,7 @@ jobs:
2828
- name: Install poetry
2929
run: |
3030
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
31-
python get-poetry.py -y
31+
python get-poetry.py -y --version 1.0.10
3232
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
3333
rm get-poetry.py
3434

CHANGES

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@ Here you can find the recent changes to libtmux
66

77
current
88
-------
9-
- :issue:`251`: Enchance subprocess interaction std[in|out|err]. Needed for interact with big buffer
9+
- :issue:`251`: Enchance subprocess interaction std[in|out|err]. Needed
10+
for interact with big buffer
11+
- :issue:`303` Add ``common.get_libtmux_version`` which gives the tmux
12+
version as a loose constraint. Fix linking to terms inside docs, and
13+
duplicate description of module which sphinx warned about in api.rst.
14+
- :issue:`266` Fix issue on local tests where env variables would cause
15+
show-environment to pause tests indefinitely.
16+
- *Insert changes/features/fixes for next release here*
17+
18+
libtmux 0.8.4 (2020-10-25)
19+
--------------------------
20+
- :issue:`234`: ``Window.split_window``: Allow passing ``percent``, Thank
21+
you @jinankjain!
22+
- :issue:`289`: Fix warning due to invalid escape sequences, Thank you
23+
@tirkarthi!
1024
- :issue:`295`: Publish docs via our own action
1125
- :issue:`295`: Move more packaging over to poetry, though we'll keep
1226
setup.py for the moment to ensure compatibility package maintainers.

docs/api.rst

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ Internals
8686

8787
.. automethod:: libtmux.common.handle_option_error
8888

89+
.. automethod:: libtmux.common.get_libtmux_version
90+
8991
Exceptions
9092
----------
9193

docs/developing.md

+49
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,54 @@ CI. See the configuration in `pyproject.toml` and `setup.cfg`:
4141

4242
## Releasing
4343

44+
Since this software is used by tens of thousands of users daily, we don't want
45+
to release breaking changes. Additionally this is packaged on large Linux/BSD
46+
distros, so we must be mindful of architectural changes.
47+
48+
Choose what the next version is. Assuming it's version 0.9.0, it could be:
49+
50+
- 0.9.0post0: postrelease, if there was a packaging issue
51+
- 0.9.1: bugfix / security / tweak
52+
- 0.10.0: breaking changes, new features
53+
54+
Let's assume we pick 0.9.1
55+
56+
`CHANGES`: Assure any PRs merged since last release are mentioned. Give a
57+
thank you to the contributor. Set the header with the new version and the date.
58+
Leave the "current" header and _Insert changes/features/fixes for next release here_ at
59+
the top::
60+
61+
current
62+
-------
63+
- *Insert changes/features/fixes for next release here*
64+
65+
libtmux 0.9.1 (2020-10-12)
66+
--------------------------
67+
- :issue:`1`: Fix bug
68+
69+
`libtmux/__init__.py` and `__about__.py` - Set version
70+
71+
`git commit -m 'Tag v0.9.1'`
72+
73+
`git tag v0.9.1`
74+
75+
`pip install wheel twine`
76+
77+
`python setup.py sdist bdist_wheel`
78+
79+
`twine upload dist/*`
80+
81+
### Twine
82+
83+
`twine upload dist/*`
84+
85+
You will be asked for PyPI login information.
86+
87+
### Releasing with Poetry (hypothetical)
88+
89+
This isn't used yet since package maintainers may want setup.py in the source.
90+
See https://github.com/tmux-python/tmuxp/issues/625.
91+
4492
As of 0.10, [poetry] handles virtualenv creation, package requirements, versioning,
4593
building, and publishing. Therefore there is no setup.py or requirements files.
4694

@@ -53,6 +101,7 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
53101
poetry build
54102
poetry deploy
55103

104+
[twine]: https://twine.readthedocs.io/
56105
[poetry]: https://python-poetry.org/
57106
[entr(1)]: http://eradman.com/entrproject/
58107
[black]: https://github.com/psf/black

libtmux/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__title__ = 'libtmux'
22
__package_name__ = 'libtmux'
3-
__version__ = '0.8.3'
3+
__version__ = '0.8.4'
44
__description__ = 'scripting library / orm for tmux'
55
__email__ = '[email protected]'
66
__author__ = 'Tony Narlock'

libtmux/__init__.py

-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
# -*- coding: utf-8 -*-
22
# flake8: NOQA
3-
"""API for interfacing with tmux servers, sessions, windows and panes.
4-
5-
libtmux
6-
~~~~~~~
7-
8-
:copyright: Copyright 2016-2018 Tony Narlock.
9-
:license: MIT, see LICENSE for details
10-
11-
"""
12-
133
from .__about__ import (
144
__author__,
155
__copyright__,

libtmux/_compat.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@
2020
itervalues = lambda d: d.itervalues()
2121
iteritems = lambda d: d.iteritems()
2222

23+
from itertools import imap, izip
24+
25+
import ConfigParser as configparser
26+
import cPickle as pickle
2327
from cStringIO import StringIO as BytesIO
2428
from StringIO import StringIO
25-
import cPickle as pickle
26-
import ConfigParser as configparser
27-
28-
from itertools import izip, imap
2929

3030
range_type = xrange
3131

3232
cmp = cmp
3333

3434
input = raw_input
35+
from collections import MutableMapping
3536
from string import lower as ascii_lowercase
36-
import urlparse
3737

38-
from collections import MutableMapping
38+
import urlparse
3939

4040
exec('def reraise(tp, value, tb=None):\n raise tp, value, tb')
4141

@@ -60,9 +60,9 @@ def console_to_str(s):
6060
itervalues = lambda d: iter(d.values())
6161
iteritems = lambda d: iter(d.items())
6262

63-
from io import StringIO, BytesIO
64-
import pickle
6563
import configparser
64+
import pickle
65+
from io import BytesIO, StringIO
6666

6767
izip = zip
6868
imap = map
@@ -71,9 +71,9 @@ def console_to_str(s):
7171
cmp = lambda a, b: (a > b) - (a < b)
7272

7373
input = input
74-
from string import ascii_lowercase
7574
import urllib.parse as urllib
7675
import urllib.parse as urlparse
76+
from string import ascii_lowercase
7777
from urllib.request import urlretrieve
7878

7979
console_encoding = sys.__stdout__.encoding
@@ -97,6 +97,7 @@ def reraise(tp, value, tb=None):
9797

9898
number_types = integer_types + (float,)
9999

100+
100101
def str_from_console(s):
101102
try:
102103
return text_type(s)

libtmux/common.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from distutils.version import LooseVersion
1616

1717
from . import exc
18-
from ._compat import console_to_str, str_from_console, MutableMapping
18+
from ._compat import MutableMapping, console_to_str, str_from_console
1919

2020
logger = logging.getLogger(__name__)
2121

@@ -229,7 +229,7 @@ def __init__(self, *args, **kwargs):
229229

230230
class TmuxMappingObject(MutableMapping):
231231

232-
"""Base: :py:class:`MutableMapping`.
232+
r"""Base: :py:class:`MutableMapping`.
233233
234234
Convenience container. Base class for :class:`Pane`, :class:`Window`,
235235
:class:`Session` and :class:`Server`.
@@ -664,3 +664,16 @@ def handle_option_error(error):
664664
raise exc.AmbiguousOption(error)
665665
else:
666666
raise exc.OptionError(error) # Raise generic option error
667+
668+
669+
def get_libtmux_version():
670+
"""Return libtmux version is a PEP386 compliant format.
671+
672+
Returns
673+
-------
674+
distutils.version.LooseVersion
675+
libtmux version
676+
"""
677+
from libtmux.__about__ import __version__
678+
679+
return LooseVersion(__version__)

libtmux/pane.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class Pane(TmuxMappingObject, TmuxRelationalObject):
2020
"""
21-
A :term:`tmux(1)` :term:`pane` [#]_.
21+
A :term:`tmux(1)` :term:`Pane` [#]_.
2222
2323
``Pane`` instances can send commands directly to a pane, or traverse
2424
between linked tmux objects.
@@ -153,9 +153,11 @@ def clear(self):
153153
def reset(self):
154154
"""Reset and clear pane history. """
155155

156-
self.cmd('send-keys', '-R \; clear-history')
156+
self.cmd('send-keys', r'-R \; clear-history')
157157

158-
def split_window(self, attach=False, vertical=True, start_directory=None):
158+
def split_window(
159+
self, attach=False, vertical=True, start_directory=None, percent=None
160+
):
159161
"""
160162
Split window at pane and return newly created :class:`Pane`.
161163
@@ -167,6 +169,8 @@ def split_window(self, attach=False, vertical=True, start_directory=None):
167169
split vertically
168170
start_directory : str, optional
169171
specifies the working directory in which the new pane is created.
172+
percent: int, optional
173+
percentage to occupy with respect to current pane
170174
171175
Returns
172176
-------
@@ -177,6 +181,7 @@ def split_window(self, attach=False, vertical=True, start_directory=None):
177181
start_directory=start_directory,
178182
attach=attach,
179183
vertical=vertical,
184+
percent=percent,
180185
)
181186

182187
def set_width(self, width):

libtmux/server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class Server(TmuxRelationalObject, EnvironmentMixin):
2727

2828
"""
29-
The :term:`tmux(1)` :term:`server` [#]_.
29+
The :term:`tmux(1)` :term:`Server` [#]_.
3030
3131
- :attr:`Server._sessions` [:class:`Session`, ...]
3232

libtmux/session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
class Session(TmuxMappingObject, TmuxRelationalObject, EnvironmentMixin):
2929
"""
30-
A :term:`tmux(1)` :term:`session` [#]_.
30+
A :term:`tmux(1)` :term:`Session` [#]_.
3131
3232
Holds :class:`Window` objects.
3333

libtmux/window.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class Window(TmuxMappingObject, TmuxRelationalObject):
2222
"""
23-
A :term:`tmux(1)` :term:`window` [#]_.
23+
A :term:`tmux(1)` :term:`Window` [#]_.
2424
2525
Holds :class:`Pane` objects.
2626
@@ -382,7 +382,13 @@ def last_pane(self):
382382
return self.select_pane('-l')
383383

384384
def split_window(
385-
self, target=None, start_directory=None, attach=True, vertical=True, shell=None
385+
self,
386+
target=None,
387+
start_directory=None,
388+
attach=True,
389+
vertical=True,
390+
shell=None,
391+
percent=None,
386392
):
387393
"""
388394
Split window and return the created :class:`Pane`.
@@ -407,6 +413,8 @@ def split_window(
407413
NOTE: When this command exits the pane will close. This feature
408414
is useful for long-running processes where the closing of the
409415
window upon completion is desired.
416+
percent: int, optional
417+
percentage to occupy with respect to current window
410418
411419
Returns
412420
-------
@@ -446,6 +454,9 @@ def split_window(
446454
else:
447455
tmux_args += ('-h',)
448456

457+
if percent is not None:
458+
tmux_args += ('-p %d' % percent,)
459+
449460
tmux_args += ('-P', '-F%s' % ''.join(tmux_formats)) # output
450461

451462
if start_directory:

0 commit comments

Comments
 (0)