Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
goerz committed Jan 4, 2016
1 parent f3f8f3c commit e6b6c96
Show file tree
Hide file tree
Showing 8 changed files with 498 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
.venv/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
sudo: false # use container-based infrastructure (pre-requisite for caching)
install:
- pip install -e .[dev]
script:
py.test --cov=tmuxpair.py --doctest-modules tmuxpair.py test_tmuxpair.py
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Michael Goerz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
72 changes: 72 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
PROJECT_NAME = tmuxpair
PACKAGES = pip pytest coverage
TESTPYPI = https://testpypi.python.org/pypi

TESTOPTIONS = -v -s -x --doctest-modules --cov=tmuxpair.py
TESTS = tmuxpair.py test_tmuxpair.py


install:
pip install .

develop:
pip install -e .[dev]

uninstall:
pip uninstall $(PROJECT_NAME)

upload:
python setup.py register
python setup.py sdist upload

test-upload:
python setup.py register -r $(TESTPYPI)
python setup.py sdist upload -r $(TESTPYPI)

test-install:
pip install -i $(TESTPYPI) $(PROJECT_NAME)

.venv/py27/bin/py.test:
@conda create -y -m -p .venv/py27 python=2.7 $(PACKAGES)
@.venv/py27/bin/pip install -e .[dev]

.venv/py33/bin/py.test:
@conda create -y -m -p .venv/py33 python=3.3 $(PACKAGES)
@.venv/py33/bin/pip install -e .[dev]

.venv/py34/bin/py.test:
@conda create -y -m -p .venv/py34 python=3.4 $(PACKAGES)
@.venv/py34/bin/pip install -e .[dev]

.venv/py35/bin/py.test:
@conda create -y -m -p .venv/py35 python=3.5 $(PACKAGES)
@.venv/py35/bin/pip install -e .[dev]

test27: .venv/py27/bin/py.test
$< -v $(TESTOPTIONS) $(TESTS)

test33: .venv/py33/bin/py.test
$< -v $(TESTOPTIONS) $(TESTS)

test34: .venv/py34/bin/py.test
$< -v $(TESTOPTIONS) $(TESTS)

test35: .venv/py35/bin/py.test
$< -v $(TESTOPTIONS) $(TESTS)

test: test27 test33 test34 test35

coverage: test35
@rm -rf htmlcov/index.html
.venv/py35/bin/coverage html

clean:
@rm -f *.pyc
@rm -rf __pycache__
@rm -rf *.egg-info
@rm -rf htmlcov

distclean: clean
@rm -rf .venv

.PHONY: install develop uninstall upload test-upload test-install test clean distclean coverage
36 changes: 36 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# tmuxpair #

Command line script for setting up a temporary tmux session for pair programming

Author: Michael Goerz <<goerz@stanford.edu>>

Website: [Github][]

[Github]: programming#tmuxpair


## Installation ##

It is strongly recommended that you use [virtualenv][]/[pipsi][]/[conda env][].
Activate your environment, and then run

pip install tmuxpair

This will install `tmuxpair` in the environment's `bin` folder.

[virtualenv]: http://docs.python-guide.org/en/latest/dev/virtualenvs/
[pipsi]: https://github.com/mitsuhiko/pipsi#pipsi
[conda env]: http://conda.pydata.org/docs/using/envs.html


## Usage ##

See `tmuxpair -h`


## License ##

This software is available under the terms of the MIT license. See [LICENSE][]
for details.

[LICENSE]: LICENSE
41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python
import setuptools


def get_version(filename):
with open(filename) as in_fh:
for line in in_fh:
if line.startswith('__version__'):
return line.split('=')[1].strip()[1:-1]
raise ValueError("Cannot extract version from %s" % filename)


setuptools.setup(
name="tmuxpair",
version=get_version("tmuxpair.py"),
url="programming",
author="Michael Goerz",
author_email="goerz@stanford.edu",
description="Command line script for setting up a temporary tmux session for pair programming",
install_requires=[
'Click>=5', 'sh>=1', 'sshkeys>=0.5',
],
extras_require={'dev': ['pytest', 'coverage', 'pytest-cov']},
py_modules=['tmuxpair'],
entry_points='''
[console_scripts]
tmuxpair=tmuxpair:main
''',
classifiers=[
'Environment :: Console',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
)
26 changes: 26 additions & 0 deletions test_tmuxpair.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Collection of tests for tmuxpair.py"""
import click
from click.testing import CliRunner
from distutils.version import LooseVersion
from tmuxpair import main, __version__


def test_version():
"""Ensure that --version shows a version number that matches the
__version__ defined in the module, and is parsable by LooseVersion"""
runner = CliRunner()
result = runner.invoke(main, args=['--version'])
assert result.exit_code == 0
version = result.output.split()[-1]
assert version == __version__
assert LooseVersion(version) >= LooseVersion('0.1.0')


def test_help():
"""Ensure that -h and --help display the help"""
runner = CliRunner()
result = runner.invoke(main, args=['-h'])
result2 = runner.invoke(main, args=['--help'])
assert result.exit_code == 0
assert result.output.startswith("Usage:")
assert result.output == result2.output
Loading

0 comments on commit e6b6c96

Please sign in to comment.