Skip to content

Commit 28ab781

Browse files
author
Dmitry Berezovsky
committed
Added primitive build script
1 parent 796161d commit 28ab781

File tree

5 files changed

+145
-4
lines changed

5 files changed

+145
-4
lines changed

README.md

-2
This file was deleted.

README.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
==================
2+
Django API commons
3+
==================
4+
5+
Common library for building django based web api applications
6+
7+
``````````````````````
8+
Development procedures
9+
``````````````````````
10+
11+
Ensure that all python sources contain license notice:
12+
::
13+
./development/copyright-update
14+
15+
Building distribution package:
16+
17+
::
18+
./build.sh clean build
19+
20+
Uploading package to PyPi:
21+
22+
::
23+
./build.sh publish

build.sh

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
# Fail on error
4+
set -e
5+
VIRTUAL_ENV_PATH="venv"
6+
7+
function print_help() {
8+
echo ""
9+
echo "Utility script for building and publishing package"
10+
echo ""
11+
echo "Usage: build command1 [command2] [command3...]"
12+
echo ""
13+
echo "Positional arguments"
14+
echo "command Command to run"
15+
echo ""
16+
}
17+
18+
source "${VIRTUAL_ENV_PATH}/bin/activate"
19+
20+
if [[ $# -eq 0 ]]; then
21+
print_help
22+
exit 1
23+
fi
24+
25+
while [[ $# -gt 0 ]]
26+
do
27+
command="$1"
28+
case $command in
29+
clean)
30+
echo "Cleaning build output dirs"
31+
rm -rf build/*
32+
rm -rf dist/*
33+
rm -rf *.egg-info
34+
;;
35+
build)
36+
echo "Building wheel package"
37+
python setup.py bdist_wheel
38+
echo "Building source distribution"
39+
python setup.py sdist
40+
;;
41+
publish)
42+
echo "Uploading packages on PyPi"
43+
twine upload dist/*
44+
esac
45+
shift
46+
done

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.idea
21
Django==1.11.2
32
djangorestframework==3.5.4
43
typing==3.5.3.0
5-
copyright==1.0.1.0
4+
copyright==1.0.1.0
5+
twine

setup.py

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"""
2+
Django API commons packaging module.
3+
See: https://packaging.python.org/en/latest/distributing.html
4+
"""
5+
6+
from setuptools import setup, find_packages
7+
from codecs import open
8+
from os import path
9+
10+
version = "1.0.0"
11+
root_dir = path.abspath(path.dirname(__file__))
12+
src_dir = root_dir
13+
# Get the long description from the README file
14+
with open(path.join(root_dir, 'README.rst'), encoding='utf-8') as f:
15+
long_description = f.read()
16+
17+
setup(
18+
name='django_api_commons',
19+
# Semantic versioning should be used:
20+
# https://packaging.python.org/distributing/?highlight=entry_points#semantic-versioning-preferred
21+
version=version,
22+
description='Common library for building django based web api applications',
23+
long_description=long_description,
24+
url='https://github.com/Logicify/python-api',
25+
keywords='django webservices api rest djangorestframework json jsonapi',
26+
27+
# Author
28+
author='Dmitry Berezovsky',
29+
30+
# License
31+
license='MIT',
32+
33+
# Technical meta
34+
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
35+
classifiers=[
36+
# How mature is this project? Common values are
37+
# 3 - Alpha
38+
# 4 - Beta
39+
# 5 - Production/Stable
40+
'Development Status :: 3 - Alpha',
41+
42+
# Who your project is intended for
43+
'Intended Audience :: Developers',
44+
'Topic :: Software Development :: Build Tools',
45+
46+
# License (should match "license" above)
47+
'License :: OSI Approved :: MIT License',
48+
# Python versions support
49+
'Programming Language :: Python :: 3',
50+
'Programming Language :: Python :: 3.5',
51+
'Programming Language :: Python :: 3.6',
52+
],
53+
54+
# Structure
55+
packages=find_packages(include=['api_commons']),
56+
57+
install_requires=[
58+
'Django==1.11.2',
59+
'djangorestframework==3.5.4',
60+
'typing==3.5.3.0'
61+
],
62+
63+
# Extra dependencies might be installed with:
64+
# pip install -e .[dev,test]
65+
extras_require={
66+
'dev': [],
67+
'test': [],
68+
},
69+
70+
package_data={
71+
'examples': [path.join(root_dir, 'example_service')],
72+
},
73+
74+
)

0 commit comments

Comments
 (0)