Commit 21fe8c13 authored by Yuanle Song's avatar Yuanle Song
Browse files

v2.0.0 drop support for python2.7

- use python3 venv module to replace old bundled virtualenv module.
- upgrade docker build image and runtime image to debian buster based.
- bugfix: venv cache dir includes python version in dir name.
parent 9bc4d80f
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ DEMO_PROJECT_NAME := foo-bar
https_proxy ?= 127.0.0.1:8123

default:
test: py2
test: py3
install:
	lein install
py3: install
@@ -10,12 +10,7 @@ py3: install
	lein new python $(DEMO_PROJECT_NAME)
	cd $(DEMO_PROJECT_NAME) && make test DEFAULT_PYTHON=python3
	rm -rf $(DEMO_PROJECT_NAME)
py2: py3
	rm -rf $(DEMO_PROJECT_NAME)
	lein new python $(DEMO_PROJECT_NAME)
	cd $(DEMO_PROJECT_NAME) && make test DEFAULT_PYTHON=python2
	rm -rf $(DEMO_PROJECT_NAME)
deploy:
# Please use a https proxy when run inside GFW.
	env https_proxy=$(https_proxy) lein deploy clojars
.PHONY: default test install py3 py2 deploy
.PHONY: default test install py3 deploy
+38 −34
Original line number Diff line number Diff line
* COMMENT -*- mode: org -*-
#+Date: 2014-05-09
Time-stamp: <2021-08-14>
Time-stamp: <2021-08-16>
#+STARTUP: content
* notes								      :entry:
** 2018-05-02 support test, build and deploy in gocd
@@ -46,24 +46,13 @@ Time-stamp: <2021-08-14>
- to upgrade project, make commits, and push to gitlab, the rest will follow.
  click approval to deploy to production.

** 2019-02-27 how to update virtualenv in utils/ dir
- update files
  VERSION=16.4.1
  tar tf ~/d/virtualenv-$VERSION.tar.gz
  cd src/leiningen/new/python/utils/
  tar xzf ~/d/virtualenv-$VERSION.tar.gz \
    virtualenv-$VERSION/virtualenv.py \
    virtualenv-$VERSION/virtualenv_support/ \
    virtualenv-$VERSION/LICENSE.txt
- update file list in ./src/leiningen/new/python.clj
  TODO update the code to auto include all files in utils/virtualenv-* dir.
** 2020-01-29 venv and wheelhouse cache used in "make ci-build"		:doc:
- dir layout

  on go-agent node,
  ~/.cache/ci_build/$(GO_PIPELINE_NAME)/cache                            pip cache
  ~/.cache/ci_build/$(GO_PIPELINE_NAME)/venvs        venv dir
  ~/.cache/ci_build/$(GO_PIPELINE_NAME)/wheelhouses  wheelhouse dir
  ~/.cache/ci_build/$(GO_PIPELINE_NAME)/venvs-$(BUILD_PY_VERSION)        venv dir
  ~/.cache/ci_build/$(GO_PIPELINE_NAME)/wheelhouses-$(BUILD_PY_VERSION)  wheelhouse dir

  on docker container,
  host dir                           container mount point
@@ -115,17 +104,9 @@ feature is still WIP and I won't deploy it.

* current							      :entry:
** 
** 2021-08-14 use python3 venv module instead of standalone virtualenv.
** 2021-08-14 use buster build and runtime images.
** 2021-08-05 update pip/venv cache to include python version.
- see ~/projects/yxy-kucun/Makefile
  BUILD_DOCKER_IMAGE_PY_VERSION
- also integrate other changes in that Makefile.

** 2021-08-05 update build image tag and run image tag.
- use debian 10 buster based images.
- use system python3 to bootstrap venv.
  add python3-pip etc to built deb dependencies.
** 2021-08-16 support upgrading existing application's Makefile.
- when run in existing dir, don't init git.
  just create file, let user review and do merge.

** 2019-02-28 add support for running application test using docker-compose.
see ~/websites/url-alias project for an example.
@@ -133,14 +114,6 @@ see ~/websites/url-alias project for an example.
add docker-compose.yml
update Makfile

** 2016-09-08 support updating site file, deb scripts etc after project is generated.
- the domain in site file could change.
- the pkg name could change.
- whether to use uwsgi could change.

./utils/update_site_file.py --domain foo.emacsos.com --uwsgi
./utils/update_site_file.py --domain foo.emacsos.com --http

** 2016-09-06 support adding celery to existing project.
- This will add a celeryconfig module and a tasks module.
  see examples in
@@ -158,6 +131,17 @@ see example ~/.pylintrc
** 2014-05-09 add sphinx support

* done								      :entry:
** 2021-08-05 update pip/venv cache to include python version.
- see ~/projects/yxy-kucun/Makefile
  BUILD_DOCKER_IMAGE_PY_VERSION
- also integrate other changes in that Makefile.

** 2021-08-05 update build image tag and run image tag.
- DONE use debian 10 buster based images.
- DONE use system python3 to bootstrap venv.
  DONE add python3-pip etc to built deb dependencies.

** 2021-08-14 use python3 venv module instead of standalone virtualenv.
** 2019-02-24 fix :url in project.clj
create a blog post about this template.
** 2019-03-01 switch to apache license 2.0
@@ -411,7 +395,27 @@ chmod -R +x utils/
- it requires me listing all template and plain files. this is bad. should
  just generate the file list on the fly.

* obsolete                                                            :entry:
** 2019-02-27 how to update virtualenv in utils/ dir
- update files
  VERSION=16.4.1
  tar tf ~/d/virtualenv-$VERSION.tar.gz
  cd src/leiningen/new/python/utils/
  tar xzf ~/d/virtualenv-$VERSION.tar.gz \
    virtualenv-$VERSION/virtualenv.py \
    virtualenv-$VERSION/virtualenv_support/ \
    virtualenv-$VERSION/LICENSE.txt
- update file list in ./src/leiningen/new/python.clj
  WONTFIX update the code to auto include all files in utils/virtualenv-* dir.
* wontfix							      :entry:
** 2016-09-08 support updating site file, deb scripts etc after project is generated.
- the domain in site file could change.
- the pkg name could change.
- whether to use uwsgi could change.

./utils/update_site_file.py --domain foo.emacsos.com --uwsgi
./utils/update_site_file.py --domain foo.emacsos.com --http

** 2020-01-02 failed to deploy new version to clojars.
first deploy has a HTTP timeout.
send deploy show redeploying non-snapshots is not allowed
+1 −1
Original line number Diff line number Diff line
(defproject python/lein-template "1.14.0"
(defproject python/lein-template "2.0.0"
  :description "lein template for a python project"
  :url "https://gitlab.emacsos.com/sylecn/python-project-template"
  :license {:name "Apache License 2.0"
+1 −7
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@
  (string/replace name "-" "_"))

(defn python
  "a standard python project with virtualenv, githooks, pep8, pylint etc"
  "a standard python project with venv, githooks, pep8, pylint etc"
  [name]
  (let [data {:name name
              :sanitized (name-to-path name)
@@ -73,12 +73,6 @@
                        ]
        plain-files ["utils/__init__.py"
                     "utils/choose_default_python.sh"
                     ;; virtualenv
                     "utils/virtualenv-16.4.1/virtualenv_support/pip-19.0.3-py2.py3-none-any.whl"
                     "utils/virtualenv-16.4.1/virtualenv_support/setuptools-40.8.0-py2.py3-none-any.whl"
                     "utils/virtualenv-16.4.1/virtualenv_support/wheel-0.33.1-py2.py3-none-any.whl"
                     "utils/virtualenv-16.4.1/virtualenv_support/__init__.py"
                     "utils/virtualenv-16.4.1/virtualenv.py"
                     ]
        empty-files []
        package-files ["__init__.py"
+1 −1
Original line number Diff line number Diff line
FROM sylecn/debian:stretch-slim-cn
FROM sylecn/debian:buster-slim

#LABEL description="TODO add image description and uncomment this"

Loading