Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Commit af093ce

Browse files
committed
skeleton
0 parents  commit af093ce

15 files changed

+367
-0
lines changed

.gitignore

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
# Created by https://www.gitignore.io/api/osx,python
3+
4+
### OSX ###
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
9+
# Icon must end with two \r
10+
Icon
11+
12+
13+
# Thumbnails
14+
._*
15+
16+
# Files that might appear in the root of a volume
17+
.DocumentRevisions-V100
18+
.fseventsd
19+
.Spotlight-V100
20+
.TemporaryItems
21+
.Trashes
22+
.VolumeIcon.icns
23+
24+
# Directories potentially created on remote AFP share
25+
.AppleDB
26+
.AppleDesktop
27+
Network Trash Folder
28+
Temporary Items
29+
.apdisk
30+
31+
32+
### Python ###
33+
# Byte-compiled / optimized / DLL files
34+
__pycache__/
35+
*.py[cod]
36+
*$py.class
37+
38+
# C extensions
39+
*.so
40+
41+
# Distribution / packaging
42+
.Python
43+
env/
44+
build/
45+
develop-eggs/
46+
dist/
47+
downloads/
48+
eggs/
49+
.eggs/
50+
lib/
51+
lib64/
52+
parts/
53+
sdist/
54+
var/
55+
*.egg-info/
56+
.installed.cfg
57+
*.egg
58+
59+
# PyInstaller
60+
# Usually these files are written by a python script from a template
61+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
62+
*.manifest
63+
*.spec
64+
65+
# Installer logs
66+
pip-log.txt
67+
pip-delete-this-directory.txt
68+
69+
# Unit test / coverage reports
70+
htmlcov/
71+
.tox/
72+
.coverage
73+
.coverage.*
74+
.cache
75+
nosetests.xml
76+
coverage.xml
77+
*,cover
78+
.hypothesis/
79+
80+
# Translations
81+
*.mo
82+
*.pot
83+
84+
# Django stuff:
85+
*.log
86+
local_settings.py
87+
88+
# Flask instance folder
89+
instance/
90+
91+
# Sphinx documentation
92+
docs/_build/
93+
94+
# PyBuilder
95+
target/
96+
97+
# IPython Notebook
98+
.ipynb_checkpoints
99+
100+
# pyenv
101+
.python-version
102+
103+
# dotenv
104+
.env
105+
106+
/bodylabs-python-style/

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include requirements.txt
2+
include README.md

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
skeleton-py
2+
===========
3+
4+
A project starter for Body Labs Python projects.
5+
6+
To use this skeleton:
7+
8+
1. Clone the skeleton:
9+
10+
git clone [email protected]:bodylabs/template-py.git my-library
11+
12+
2. Re-initialize the git repository:
13+
14+
cd my-library && rm -rf .git && git init
15+
16+
3. Publish the license, or delete it, depending whether or not the project is
17+
open source:
18+
19+
mv RENAME-TO-LICENSE-IF-PUBLIC-ELSE-DELETE LICENSE
20+
rm RENAME-TO-LICENSE-IF-PUBLIC-ELSE-DELETE
21+
22+
4. Commit the changed files.
23+
24+
git add . && git commit -m "Project skeleton"
25+
26+
5. Make updates as needed.
27+
28+
29+
- - - - - - - - - - - - -
30+
31+
example
32+
=======
33+
34+
Short description of the module.
35+
36+
37+
Features
38+
--------
39+
40+
- This
41+
- That
42+
- The other
43+
44+
45+
Examples
46+
--------
47+
48+
```py
49+
from example.hello import hello
50+
hello()
51+
```
52+
53+
```sh
54+
hello
55+
```
56+
57+
58+
Development
59+
-----------
60+
61+
```sh
62+
pip install -r requirements_dev.txt
63+
rake test
64+
rake lint
65+
```
66+
67+
68+
Contribute
69+
----------
70+
71+
- Issue Tracker: github.com/bodylabs/example/issues
72+
- Source Code: github.com/bodylabs/example
73+
74+
Pull requests welcome!
75+
76+
77+
Support
78+
-------
79+
80+
If you are having issues, please let us know.
81+
82+
83+
License
84+
-------
85+
86+
The project is licensed under the two-clause BSD license.
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (c) 2016, Body Labs, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Rakefile

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
$style_config_version = '1.0.1'
2+
3+
desc "Install style config"
4+
task :install_style_config do
5+
FileUtils.rm_rf "bodylabs-python-style" if Dir.exists? "bodylabs-python-style"
6+
raise unless system "git clone https://github.com/bodylabs/bodylabs-python-style.git"
7+
Dir.chdir 'bodylabs-python-style' do
8+
raise unless system "git checkout tags/#{$style_config_version}"
9+
end
10+
end
11+
12+
task :require_style_config do
13+
Rake::Task[:install_style_config].invoke unless File.executable? 'bodylabs-python-style/bin/pylint_test'
14+
end
15+
16+
$mac_os = `uname -s`.strip == 'Darwin'
17+
18+
desc "Install dependencies for distribution"
19+
task :install_dist do
20+
if $mac_os
21+
raise unless system "brew update"
22+
raise unless system "brew install pandoc"
23+
raise unless system "pip install pypandoc"
24+
else
25+
puts
26+
puts "You must install:"
27+
puts
28+
puts " - pandoc"
29+
puts " - pypandoc"
30+
puts
31+
raise
32+
end
33+
end
34+
35+
def command_is_in_path?(command)
36+
system("which #{ command} > /dev/null 2>&1")
37+
end
38+
39+
task :unittest do
40+
raise unless system "nose2"
41+
end
42+
43+
task :lint => :require_style_config do
44+
raise unless system "bodylabs-python-style/bin/pylint_test example --min_rating 10.0"
45+
end
46+
47+
desc "Remove .pyc files"
48+
task :clean do
49+
system "find . -name '*.pyc' -delete"
50+
end
51+
52+
task :sdist do
53+
unless command_is_in_path? 'pandoc'
54+
puts
55+
puts "Please install pandoc."
56+
puts
57+
raise
58+
end
59+
raise unless system "python setup.py sdist"
60+
end
61+
62+
task :upload do
63+
unless command_is_in_path?('pandoc')
64+
puts
65+
puts "Please install pandoc."
66+
puts
67+
raise
68+
end
69+
raise unless system "python setup.py sdist upload"
70+
end

bin/hello

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env python
2+
3+
from example.hello import hello
4+
hello()

circle.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
general:
2+
branches:
3+
ignore:
4+
- /zz.*/ # Don't run tests on deprecated branches.
5+
6+
machine:
7+
environment:
8+
PYTHONPATH: /usr/local/lib/python2.7/dist-packages
9+
10+
dependencies:
11+
override: # Rather than using their autodetected steps, use these instead
12+
- rake install_style_config
13+
- pip install -r requirements_dev.txt
14+
15+
test:
16+
override: # rather than using their autodetected steps, use these instead
17+
- rake unittest
18+
- rake lint

example/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '1.0.0'

example/hello.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def hello():
2+
from example.resources.constants import WELCOME_MESSAGE
3+
print WELCOME_MESSAGE

example/resources/__init__.py

Whitespace-only changes.

example/resources/constants.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WELCOME_MESSAGE = 'Hello world'

example/test_hello.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import unittest
2+
3+
class TestHello(unittest.TestCase):
4+
5+
def test_hello_runs(self):
6+
from example.hello import hello
7+
hello()

requirements.txt

Whitespace-only changes.

requirements_dev.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r requirements.txt
2+
3+
nose2==0.5.0
4+
pylint==1.5.4

setup.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Conversion from Markdown to pypi's restructured text: https://coderwall.com/p/qawuyq -- Thanks James.
2+
3+
try:
4+
import pypandoc
5+
long_description = pypandoc.convert('README.md', 'rst')
6+
except (IOError, ImportError):
7+
long_description = ''
8+
print 'warning: pandoc or pypandoc does not seem to be installed; using empty long_description'
9+
10+
import importlib
11+
from pip.req import parse_requirements
12+
from setuptools import setup
13+
14+
install_requires = parse_requirements('requirements.txt', session=False)
15+
install_requires = [str(ir.req) for ir in install_requires]
16+
17+
setup(
18+
name='example',
19+
version=importlib.import_module('example').__version__,
20+
author='Body Labs',
21+
author_email='[email protected]',
22+
description='___',
23+
long_description=long_description,
24+
url='https://github.com/bodylabs/___',
25+
license='MIT',
26+
packages=[
27+
'example',
28+
'example/util',
29+
],
30+
scripts=[
31+
'bin/hello',
32+
],
33+
install_requires=install_requires,
34+
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
35+
classifiers=[
36+
'Development Status :: 3 - Alpha',
37+
'Intended Audience :: Developers',
38+
'License :: OSI Approved :: BSD License',
39+
'Operating System :: OS Independent',
40+
'Programming Language :: Python',
41+
]
42+
)

0 commit comments

Comments
 (0)