diff --git a/.editorconfig b/.editorconfig index e717f5e..1472023 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,12 +2,15 @@ root = true [*] +charset = utf-8 indent_style = space -indent_size = 2 +indent_size = 4 end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true insert_final_newline = true +trim_trailing_whitespace = true + +[*.{html,js,css}] +indent_size = 2 -[*.md] -trim_trailing_whitespace = false +[Makefile] +indent_style = tab diff --git a/README.md b/README.md index f048472..eb58b24 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,13 @@ To install generator-python-package from npm, run: $ npm install -g generator-python-package ``` +Install ``kxxoling/generator-python-package``: + +```bash +$ git clone https://github.com/kxxoling/generator-python-package.git +$ cd generator-python-package && npm link +``` + Finally, initiate the generator: ```bash diff --git a/app/index.js b/app/index.js index 62142b9..c52a99f 100644 --- a/app/index.js +++ b/app/index.js @@ -56,11 +56,13 @@ var PythonPackageGenerator = yeoman.generators.Base.extend({ } var pythonVersions = [ - { name: "Python 2.6", value: "2.6@py26@Python :: 2.6", checked: false }, { name: "Python 2.7", value: "2.7@py27@Python :: 2.7", checked: true }, { name: "Python 3.2", value: "3.2@py32@Python :: 3.2", checked: false }, { name: "Python 3.3", value: "3.3@py33@Python :: 3.3", checked: false }, - { name: "Python 3.4", value: "3.4@py34@Python :: 3.4", checked: true }, + { name: "Python 3.4", value: "3.4@py34@Python :: 3.4", checked: false }, + { name: "Python 3.5", value: "3.5@py35@Python :: 3.5", checked: true }, + { name: "Python 3.6", value: "3.6@py36@Python :: 3.6", checked: true }, + { name: "Python 3.7", value: "3.7@py37@Python :: 3.7", checked: true }, { name: "PyPy", value: "pypy@pypy@Python :: Implementation :: PyPy", checked: true }, ]; @@ -212,6 +214,7 @@ var PythonPackageGenerator = yeoman.generators.Base.extend({ this.template('_tox.ini', 'tox.ini'); this.template('_gitignore', '.gitignore'); this.template('_travis.yml', '.travis.yml'); + this.template('_editorconfig', '.editorconfig'); if (!pkg.includePackageTests) { this.template('_manifest.in', 'MANIFEST.in'); @@ -224,7 +227,6 @@ var PythonPackageGenerator = yeoman.generators.Base.extend({ // pkg.name/ this.template('_root_init.py', pkg.pythonName + '/__init__.py'); - this.template('_version.py', pkg.pythonName + '/version.py'); // tests/ this.template('_init.py', 'tests/__init__.py'); diff --git a/app/templates/_coveragerc b/app/templates/_coveragerc index d2cd2a0..8a1a752 100644 --- a/app/templates/_coveragerc +++ b/app/templates/_coveragerc @@ -1,10 +1,3 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - [run] omit = *tests.py diff --git a/app/templates/_editorconfig b/app/templates/_editorconfig new file mode 100644 index 0000000..934d0e8 --- /dev/null +++ b/app/templates/_editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = false +indent_style = space +indent_size = 4 + +[Makefile] +indent_style = tab diff --git a/app/templates/_gitignore b/app/templates/_gitignore index 7d82ce3..414b218 100644 --- a/app/templates/_gitignore +++ b/app/templates/_gitignore @@ -1,10 +1,3 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/app/templates/_init.py b/app/templates/_init.py index a7138fc..394a0a0 100644 --- a/app/templates/_init.py +++ b/app/templates/_init.py @@ -1,9 +1,2 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- - -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> +# coding: utf-8 diff --git a/app/templates/_makefile b/app/templates/_makefile index f51211d..a9eb10b 100644 --- a/app/templates/_makefile +++ b/app/templates/_makefile @@ -1,10 +1,3 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - # lists all available targets list: @sh -c "$(MAKE) -p no_targets__ | awk -F':' '/^[a-zA-Z0-9][^\$$#\/\\t=]*:([^=]|$$)/ {split(\$$1,A,/ /);for(i in A)print A[i]}' | grep -v '__\$$' | grep -v 'make\[1\]' | grep -v 'Makefile' | sort" diff --git a/app/templates/_manifest.in b/app/templates/_manifest.in index 1d8a69a..aae9579 100644 --- a/app/templates/_manifest.in +++ b/app/templates/_manifest.in @@ -1,8 +1 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - recursive-exclude tests * diff --git a/app/templates/_redis.conf b/app/templates/_redis.conf index e408316..6abc169 100644 --- a/app/templates/_redis.conf +++ b/app/templates/_redis.conf @@ -1,10 +1,3 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - daemonize yes pidfile /tmp/redis_<%= package.name %>.pid port 4444 diff --git a/app/templates/_redis_tests.conf b/app/templates/_redis_tests.conf index 8dbb79d..8714f2e 100644 --- a/app/templates/_redis_tests.conf +++ b/app/templates/_redis_tests.conf @@ -1,10 +1,3 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - daemonize yes pidfile /tmp/redis_<%= package.name %>_tests.pid port 4448 diff --git a/app/templates/_root_init.py b/app/templates/_root_init.py index 1c8e37b..e1be280 100644 --- a/app/templates/_root_init.py +++ b/app/templates/_root_init.py @@ -1,11 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- +# coding: utf-8 -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - -from <%= package.pythonName %>.version import __version__ # NOQA +__version__ = '<%= package.version %>' # NOQA diff --git a/app/templates/_setup.py b/app/templates/_setup.py index ab61fb2..ebed9a7 100644 --- a/app/templates/_setup.py +++ b/app/templates/_setup.py @@ -1,16 +1,10 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- - -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - +# coding: utf-8 from setuptools import setup, find_packages + from <%= package.pythonName %> import __version__ + tests_require = [ 'mock', 'nose', diff --git a/app/templates/_test_base.py b/app/templates/_test_base.py index 8dad5e8..2a01d28 100644 --- a/app/templates/_test_base.py +++ b/app/templates/_test_base.py @@ -1,13 +1,5 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- - -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - +# coding: utf-8 from unittest import TestCase as PythonTestCase diff --git a/app/templates/_test_version.py b/app/templates/_test_version.py index b5aec3f..c03215b 100644 --- a/app/templates/_test_version.py +++ b/app/templates/_test_version.py @@ -1,13 +1,5 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- - -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - +# coding: utf-8 from preggy import expect from <%= package.pythonName %> import __version__ diff --git a/app/templates/_tox.ini b/app/templates/_tox.ini index 6fbd1e3..e77f0fb 100644 --- a/app/templates/_tox.ini +++ b/app/templates/_tox.ini @@ -1,10 +1,3 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - [tox] envlist = <%= package.pythonVersions.join(', ') %> diff --git a/app/templates/_travis.yml b/app/templates/_travis.yml index e0bda7b..e813679 100644 --- a/app/templates/_travis.yml +++ b/app/templates/_travis.yml @@ -1,10 +1,3 @@ -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - language: python python:<% for (var i=0; i < package.travis.length; i++) { %> diff --git a/app/templates/_version.py b/app/templates/_version.py deleted file mode 100644 index f452eb3..0000000 --- a/app/templates/_version.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# This file is part of <%= package.name %>. -# <%= package.url %> - -# Licensed under the <%= package.license %> license: -# http://www.opensource.org/licenses/<%= package.license%>-license -# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.author.email %>> - -__version__ = '<%= package.version %>' # NOQA