Loading project.clj +1 −1 Original line number Diff line number Diff line (defproject python/lein-template "0.20.2" (defproject python/lein-template "0.20.3" :description "lein template for a python project" :repositories [["snapshots" {:url "http://devserv.game.yy.com/nexus/content/repositories/snapshots" Loading src/leiningen/new/python.clj +8 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,17 @@ (if (not (empty? output)) (main/info output)))) (defn name-to-python-pkg-name "convert project name to python pkg name" [name] (string/replace name "-" "_")) (defn python "a standard python project with virtualenv, githooks, pep8, pylint etc" [name] (let [data {:name name :sanitized (name-to-path name) :python-pkg-name (name-to-python-pkg-name name) :date (let [cal (Calendar/getInstance)] (.format (new SimpleDateFormat "yyyy-MM-dd") (.getTime cal)))} Loading Loading @@ -64,7 +70,7 @@ "utils/virtualenv-15.1.0/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl" "utils/virtualenv-15.1.0/virtualenv_support/__init__.py" ] empty-files ["{{name}}/__init__.py"] empty-files ["{{python-pkg-name}}/__init__.py"] package-files ["logger.conf" "configlogger.py" "config.py" Loading @@ -77,7 +83,7 @@ (concat (map (fn [f] [f ""]) empty-files) (map (fn [f] [f (render f data)]) template-files) (map (fn [f] [(str "{{name}}/" f) (render f data)]) package-files) (map (fn [f] [(str "{{python-pkg-name}}/" f) (render f data)]) package-files) (map (fn [f] [f (io/input-stream (get-template-file f))]) ;; using input-stream here because the result of rendering ;; binary file is undefined even when data is empty hashmap. Loading src/leiningen/new/python/Makefile +9 −9 Original line number Diff line number Diff line PYTHON_MODULES := {{name}} PYTHON_MODULES := {{python-pkg-name}} PYTHONPATH := . VENV := .venv PYTEST := env PYTHONPATH=$(PYTHONPATH) PYTEST=1 $(VENV)/bin/py.test Loading @@ -17,11 +17,11 @@ default: check-coding-style build: debug: env DEBUG=1 $(PYTHON) {{name}}/main.py env DEBUG=1 $(PYTHON) {{python-pkg-name}}/main.py run: $(PYTHON) {{name}}/main.py $(PYTHON) {{python-pkg-name}}/main.py uwsgi: $(VENV)/bin/uwsgi --processes=2 --threads=4 --wsgi-file={{name}}/main.py --env=PYTHONPATH=. --http=localhost:8082 --disable-logging $(VENV)/bin/uwsgi --processes=2 --threads=4 --wsgi-file={{python-pkg-name}}/main.py --env=PYTHONPATH=. --http=localhost:8082 --disable-logging shell: $(PYTHON) -i Loading @@ -44,7 +44,7 @@ bootstrap-dev: venv requirements install: bootstrap $(PYTHON) setup.py -q install uninstall: bootstrap $(PIP) uninstall {{name}} # TODO not tested. $(PIP) uninstall {{python-pkg-name}} # TODO not tested. deb: utils/build-deb pipfreeze: Loading @@ -56,11 +56,11 @@ wheel: bootstrap-dev check: just-test sanity-check: bootstrap $(PYTHON) {{name}}/sanity_check.py $(PYTHON) {{python-pkg-name}}/sanity_check.py check-coding-style: bootstrap-dev $(PEP8) $(PYTHON_MODULES) $(PYLINT) -E $(PYTHON_MODULES) $(PYTHON) {{name}}/config.py $(PYTHON) {{python-pkg-name}}/config.py pylint-full: check-coding-style $(PYLINT) $(PYTHON_MODULES) test: check-coding-style Loading @@ -76,7 +76,7 @@ clean: find . -name "__pycache__" -type d -exec rm -rf {} \; || true find . -name "*.pyc" -type f -exec rm -rf {} \; || true full-clean: rm -rf $(VENV) build/ dist/ wheelhouse/ {{name}}.egg-info/ distribute-*.tar.gz rm -rf $(VENV) build/ dist/ wheelhouse/ {{python-pkg-name}}.egg-info/ distribute-*.tar.gz find . -name "__pycache__" -type d -exec rm -rf {} \; || true find . -name "*.pyc" -type f -exec rm -rf {} \; || true todo: Loading @@ -90,5 +90,5 @@ install-git-hooks-force: ./utils/install-git-hooks -f loc: find . -regex '.*\.pyw?$$' -exec wc -l {} \+ | tail -n 1 which cloc >/dev/null && cloc {{name}}/ which cloc >/dev/null && cloc {{python-pkg-name}}/ .PHONY: default build debug run uwsgi shell venv bootstrap bootstrap-dev install uninstall deb pipfreeze wheel check check-coding-style pylint-full test just-test test-prod clean full-clean todo TAGS update-git-hooks install-git-hooks install-git-hooks-force loc src/leiningen/new/python/conf/uwsgi.ini +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ socket=127.0.0.1:8082 chdir=/opt/{{name}} wsgi-file={{name}}/main.py wsgi-file={{python-pkg-name}}/main.py env=PYTHONPATH=. processes=4 Loading src/leiningen/new/python/config.py +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ config variables from __future__ import (absolute_import, division, print_function, unicode_literals, with_statement) import {{name}}.configlogger import {{python-pkg-name}}.configlogger import logging import os Loading Loading
project.clj +1 −1 Original line number Diff line number Diff line (defproject python/lein-template "0.20.2" (defproject python/lein-template "0.20.3" :description "lein template for a python project" :repositories [["snapshots" {:url "http://devserv.game.yy.com/nexus/content/repositories/snapshots" Loading
src/leiningen/new/python.clj +8 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,17 @@ (if (not (empty? output)) (main/info output)))) (defn name-to-python-pkg-name "convert project name to python pkg name" [name] (string/replace name "-" "_")) (defn python "a standard python project with virtualenv, githooks, pep8, pylint etc" [name] (let [data {:name name :sanitized (name-to-path name) :python-pkg-name (name-to-python-pkg-name name) :date (let [cal (Calendar/getInstance)] (.format (new SimpleDateFormat "yyyy-MM-dd") (.getTime cal)))} Loading Loading @@ -64,7 +70,7 @@ "utils/virtualenv-15.1.0/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl" "utils/virtualenv-15.1.0/virtualenv_support/__init__.py" ] empty-files ["{{name}}/__init__.py"] empty-files ["{{python-pkg-name}}/__init__.py"] package-files ["logger.conf" "configlogger.py" "config.py" Loading @@ -77,7 +83,7 @@ (concat (map (fn [f] [f ""]) empty-files) (map (fn [f] [f (render f data)]) template-files) (map (fn [f] [(str "{{name}}/" f) (render f data)]) package-files) (map (fn [f] [(str "{{python-pkg-name}}/" f) (render f data)]) package-files) (map (fn [f] [f (io/input-stream (get-template-file f))]) ;; using input-stream here because the result of rendering ;; binary file is undefined even when data is empty hashmap. Loading
src/leiningen/new/python/Makefile +9 −9 Original line number Diff line number Diff line PYTHON_MODULES := {{name}} PYTHON_MODULES := {{python-pkg-name}} PYTHONPATH := . VENV := .venv PYTEST := env PYTHONPATH=$(PYTHONPATH) PYTEST=1 $(VENV)/bin/py.test Loading @@ -17,11 +17,11 @@ default: check-coding-style build: debug: env DEBUG=1 $(PYTHON) {{name}}/main.py env DEBUG=1 $(PYTHON) {{python-pkg-name}}/main.py run: $(PYTHON) {{name}}/main.py $(PYTHON) {{python-pkg-name}}/main.py uwsgi: $(VENV)/bin/uwsgi --processes=2 --threads=4 --wsgi-file={{name}}/main.py --env=PYTHONPATH=. --http=localhost:8082 --disable-logging $(VENV)/bin/uwsgi --processes=2 --threads=4 --wsgi-file={{python-pkg-name}}/main.py --env=PYTHONPATH=. --http=localhost:8082 --disable-logging shell: $(PYTHON) -i Loading @@ -44,7 +44,7 @@ bootstrap-dev: venv requirements install: bootstrap $(PYTHON) setup.py -q install uninstall: bootstrap $(PIP) uninstall {{name}} # TODO not tested. $(PIP) uninstall {{python-pkg-name}} # TODO not tested. deb: utils/build-deb pipfreeze: Loading @@ -56,11 +56,11 @@ wheel: bootstrap-dev check: just-test sanity-check: bootstrap $(PYTHON) {{name}}/sanity_check.py $(PYTHON) {{python-pkg-name}}/sanity_check.py check-coding-style: bootstrap-dev $(PEP8) $(PYTHON_MODULES) $(PYLINT) -E $(PYTHON_MODULES) $(PYTHON) {{name}}/config.py $(PYTHON) {{python-pkg-name}}/config.py pylint-full: check-coding-style $(PYLINT) $(PYTHON_MODULES) test: check-coding-style Loading @@ -76,7 +76,7 @@ clean: find . -name "__pycache__" -type d -exec rm -rf {} \; || true find . -name "*.pyc" -type f -exec rm -rf {} \; || true full-clean: rm -rf $(VENV) build/ dist/ wheelhouse/ {{name}}.egg-info/ distribute-*.tar.gz rm -rf $(VENV) build/ dist/ wheelhouse/ {{python-pkg-name}}.egg-info/ distribute-*.tar.gz find . -name "__pycache__" -type d -exec rm -rf {} \; || true find . -name "*.pyc" -type f -exec rm -rf {} \; || true todo: Loading @@ -90,5 +90,5 @@ install-git-hooks-force: ./utils/install-git-hooks -f loc: find . -regex '.*\.pyw?$$' -exec wc -l {} \+ | tail -n 1 which cloc >/dev/null && cloc {{name}}/ which cloc >/dev/null && cloc {{python-pkg-name}}/ .PHONY: default build debug run uwsgi shell venv bootstrap bootstrap-dev install uninstall deb pipfreeze wheel check check-coding-style pylint-full test just-test test-prod clean full-clean todo TAGS update-git-hooks install-git-hooks install-git-hooks-force loc
src/leiningen/new/python/conf/uwsgi.ini +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ socket=127.0.0.1:8082 chdir=/opt/{{name}} wsgi-file={{name}}/main.py wsgi-file={{python-pkg-name}}/main.py env=PYTHONPATH=. processes=4 Loading
src/leiningen/new/python/config.py +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ config variables from __future__ import (absolute_import, division, print_function, unicode_literals, with_statement) import {{name}}.configlogger import {{python-pkg-name}}.configlogger import logging import os Loading