Skip to content

Commit

Permalink
init.
Browse files Browse the repository at this point in the history
  • Loading branch information
huntzhan committed Aug 11, 2016
0 parents commit 80be5ea
Show file tree
Hide file tree
Showing 18 changed files with 240 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# pyenv
.python-version

# vim
*.swp
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"

install:
- pip install -r requirements.txt
- pip install -e .

script:
- py.test

# after_success:
# - coveralls
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include README.md
include requirements.txt
recursive-include tests *
recursive-include scripts *
global-exclude __pycache__
global-exclude *.py[co]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Init:

1. `./bash-scripts/pip-install-pkgs-of-requirements.sh`
2. `python setup.py develop`

Cleanup:

1. `python setup.py develop --uninstall`
7 changes: 7 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys

collect_ignore = []
if sys.version_info.major < 3:
# controlling pytest testcase collection.
# collect_ignore.append("tests/test_py3_annotation.py")
pass
Empty file added img2url/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions img2url/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa


def entry_point():
print("entry_point")
return 42
17 changes: 17 additions & 0 deletions img2url/metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)


NAME = 'img2url'
VERSION = '0.1.0'
AUTHORS = [
'huntzhan',
]
EMAILS = [
'[email protected]',
]
LICENSE = ''
URL = ''
DESCRIPTION = 'upload image to github and return corresponding url.'
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = -x --flake8 --cov-report term-missing --cov=img2url
12 changes: 12 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pytest>=2.7.2
# bug fix: a dependency of pytest-pep8 require setuptools-scm,
# in the case that pip could not properly handle in offline environment.
setuptools-scm
wheel
pytest-flake8
pytest-cov
pytest-mock
pytest-travis-fold
coveralls

future
1 change: 1 addition & 0 deletions scripts/install-from-source.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
1 change: 1 addition & 0 deletions scripts/install-from-yum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
6 changes: 6 additions & 0 deletions scripts/pip-install-pkgs-of-requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
PROJECT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
for line in $(cat "${PROJECT_DIR}/requirements.txt" | grep -v ^#)
do
pip install $line
done
3 changes: 3 additions & 0 deletions scripts/push-to-pypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python setup.py register
python setup.py sdist upload
python setup.py bdist_wheel upload
3 changes: 3 additions & 0 deletions scripts/push-to-testpypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python setup.py register -r test
python setup.py sdist upload -r test
python setup.py bdist_wheel upload -r test
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[metadata]
description-file = README.md

[bdist_wheel]
universal = 1
65 changes: 65 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)

import codecs
import imp
import os
from setuptools import setup, find_packages

# load metadata.
metadata = imp.load_source(
'metadata',
os.path.join('img2url', 'metadata.py'),
)


def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding='utf-8').read()


def load_requirements(fname):
# only handles a simple subset of requirements format.
pkgs = []
for line in read(fname).split(os.linesep):
if not line or line.startswith('#'):
continue
pkgs.append(line)
return pkgs


setup(
# informations.
name=metadata.NAME,
version=metadata.VERSION,
author=metadata.AUTHORS[0],
author_email=metadata.EMAILS[0],
maintainer=metadata.AUTHORS[0],
maintainer_email=metadata.EMAILS[0],
license=metadata.LICENSE,
url=metadata.URL,
description=metadata.DESCRIPTION,
long_description=read('README.md'),
# https://pypi.python.org/pypi?:action=list_classifiers
classifiers=[
'License :: OSI Approved :: MIT License',
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
# critical configurations.
packages=find_packages(),
install_requires=load_requirements('requirements.txt'),
entry_points={
'console_scripts': [
'img2url = img2url.main:entry_point'
],
},
)
13 changes: 13 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa

# remove following code.
from img2url.main import entry_point


def test_entry_point():
assert 42 == entry_point()

0 comments on commit 80be5ea

Please sign in to comment.