Browse Source

Merge pypi sample project

Basti Tee 5 years ago
parent
commit
2085931545
8 changed files with 65 additions and 63 deletions
  1. 0 0
      LICENSE.txt
  2. 8 0
      MANIFEST.in
  3. 9 7
      README.md
  4. 0 12
      acme/__version__.py
  5. 1 0
      data/data_file
  6. 8 2
      make
  7. 12 4
      setup.cfg
  8. 27 38
      setup.py

+ 0 - 0
LICENSE → LICENSE.txt


+ 8 - 0
MANIFEST.in

@@ -0,0 +1,8 @@
+# Include the README
+include *.md
+
+# Include the license file
+include LICENSE.txt
+
+# Include the data files
+recursive-include data *

+ 9 - 7
README.md

@@ -3,22 +3,24 @@
 
 ## Features
 
-- Basic project/module organization
 - Flask-based dummy application running on http://localhost:9690
+- Basic project/module organization according to https://packaging.python.org
 - Makefile-like management script
-- pipenv virtual environment support
-- setup.py/egg installer script
+- pipenv virtual environments
+- setup.py-based installer script
 - Unit testing with pyTest
 - Multicore/-interpreter testing with detox
-- vscode editor configuration including debugging support
 - Linting (flake8) and code formatting (autopep8) support
+- vscode editor configuration including debugging support, unit test discovery and on-save formatting
 - Dockerized builds and run with nginx/uwsgi
 
 ## Resource
 
-- https://www.kennethreitz.org/essays/why-you-should-use-vs-code-if-youre-a-python-developer
+- http://packaging.python.org/
+- https://packaging.python.org/en/latest/distributing.html
+- https://pypi.org/
+- https://github.com/pypa/sampleproject
 - https://www.python.org/dev/peps/pep-0008/
-- http://packaging.python.org/tutorials/managing-dependencies/
+- https://www.kennethreitz.org/essays/why-you-should-use-vs-code-if-youre-a-python-developer
 - https://code.visualstudio.com/docs/python/python-tutorial
 - https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/python3.5/entrypoint.sh
-- https://medium.com/@bfortuner/python-unit-testing-with-pytest-and-mock-197499c4623c

+ 0 - 12
acme/__version__.py

@@ -1,12 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""Version statement."""
-
-__title__ = 'acme'
-__description__ = 'Python3 boilerplate module.'
-__url__ = 'https://github.com/BastiTee/python3-boilerplate'
-__version__ = '0.0.1'
-__author__ = 'Basti Tee'
-__author_email__ = 'basti.tee@posteo.de'
-__license__ = 'Apache 2.0'
-__copyright__ = 'Copyright 2019 basti.tee'

+ 1 - 0
data/data_file

@@ -0,0 +1 @@
+data_file

+ 8 - 2
make

@@ -52,7 +52,14 @@ function lint {
 
 function build {
     # Run setup.py-based build process to package application
-    pipenv run python setup.py sdist bdist_wheel $@
+    rm -fr build dist .egg *.egg-info
+    pipenv run python setup.py bdist_wheel $@
+}
+
+function publish {
+    build
+    sudo -H pip install 'twine>=1.5.0'
+	twine upload dist/*
 }
 
 function dockerbuild {
@@ -75,7 +82,6 @@ function commit {
 
 function all {
     # Full build toolchain
-    clean
     init
     test
     lint

+ 12 - 4
setup.cfg

@@ -1,5 +1,13 @@
-[bdist_wheel]
-universal = 1
-
 [metadata]
-license_file = LICENSE
+# This includes the license file(s) in the wheel.
+# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file
+license_files = LICENSE.txt
+
+[bdist_wheel]
+# This flag says to generate wheels that support both Python 2 and Python
+# 3. If your code will not run unchanged on both Python 2 and 3, you will
+# need to generate separate wheels for each Python version that you
+# support. Removing this line (or setting universal to 0) will prevent
+# bdist_wheel from trying to make a universal wheel. For more see:
+# https://packaging.python.org/guides/distributing-packages-using-setuptools/#wheels
+universal=1

+ 27 - 38
setup.py

@@ -1,53 +1,42 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
-import os
-import re
-import sys
+from setuptools import setup, find_packages
+from os import path
+from io import open
 
-from setuptools import setup
-from setuptools.command.test import test as TestCommand
-
-here = os.path.abspath(os.path.dirname(__file__))
-
-packages = ['acme']
-
-requires = [
-]
-
-about = {}
-with open(os.path.join(here, 'acme', '__version__.py'), 'r') as f:
-    exec(f.read(), about)
+with open(path.join(path.abspath(path.dirname(__file__)), 'README.md'),
+          encoding='utf-8') as f:
+    long_description = f.read()
 
 setup(
-    name=about['__title__'],
-    version=about['__version__'],
-    description=about['__description__'],
-    author=about['__author__'],
-    author_email=about['__author_email__'],
-    url=about['__url__'],
-    packages=packages,
-    package_data={'': ['LICENSE', 'NOTICE']},
-    package_dir={'acme': 'acme'},
-    include_package_data=True,
-    python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
-    install_requires=requires,
-    license=about['__license__'],
-    zip_safe=False,
+    # Basic project information
+    name='python3-boilerplate',
+    version='0.0.1',
+    # Authorship and online reference
+    author='Basti Tee',
+    author_email='basti.tee@posteo.de',
+    url='https://github.com/BastiTee/python3-boilerplate',
+    # Detailled description
+    description='Python3 boilerplate module.',
+    long_description=long_description,
+    long_description_content_type='text/markdown',
+    keywords='sample setuptools development',
     classifiers=[
-        'Development Status :: 5 - Production/Stable',
+        'Development Status :: 4 - Beta',
         'Intended Audience :: Developers',
         'Natural Language :: English',
         'License :: OSI Approved :: Apache Software License',
         'Programming Language :: Python',
-        'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.4',
-        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
-        'Programming Language :: Python :: Implementation :: CPython',
-        'Programming Language :: Python :: Implementation :: PyPy'
     ],
+    # Package configuration
+    packages=find_packages(exclude=("tests",)),
+    include_package_data=True,
+    python_requires=">=3.6",
+    install_requires=[],
+    # Licensing and copyright
+    license='Apache 2.0',
+    copyright='Copyright 2019 basti.tee',
 )