From d31c35a083b9d4bcef08dbd66b7cecf6b756d06b Mon Sep 17 00:00:00 2001 From: sober Date: Sat, 25 Jun 2016 12:12:15 +0200 Subject: added niccodemus' notes and started to specify the builddef feature --- doc/drafts/extend-envs-and-packagebuilds.md | 18 +++++++ doc/drafts/tox_conda_notes_niccodemus.md | 84 +++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 doc/drafts/tox_conda_notes_niccodemus.md diff --git a/doc/drafts/extend-envs-and-packagebuilds.md b/doc/drafts/extend-envs-and-packagebuilds.md index d7a6d36..f98649d 100644 --- a/doc/drafts/extend-envs-and-packagebuilds.md +++ b/doc/drafts/extend-envs-and-packagebuilds.md @@ -1,5 +1,7 @@ # Extension of environment handling and building packages +Issue reference: #338 + *Notes from a discussion at the pytest sprint 2016* Goal: drive building of packages and the environments needed to test them, exercising the tests and report the results for more than just virtualenvs and python virtualenvs @@ -64,3 +66,19 @@ one to one relationship from environment to directory * Floris: metadata driven. Package has metadata to the env with what env it is compatible * Holger: configuration driven. explicitly configuring which packages should be used (default sdist to be used, overridable by concrete env) * Ronny: "package definitions" (this package, this setup command) + matching definitions (matching packages (with wildcards) for environments) + +### Feature - builddef + +This feature shall allow to specify how to build an artifact in a specific build definition (builddef). + +Currently tox uses the current python interpreter to build the artifact (python package) and thus +does not allow to freely choose the interpreter to build with. +This means that as of now build environment and test environment are different by design. + +Support for different build definitions is implemented by individual tox plugins. +This would result in a collection of plugins supporting different build definitions (e.g. conda, pyenv, docker, rpm) + +Default behavior: + +To keep backwards-compatibility, a python package is built with the python interpreter tox is executed with, +using sdist. This does not require any builddef specification in tox.ini. diff --git a/doc/drafts/tox_conda_notes_niccodemus.md b/doc/drafts/tox_conda_notes_niccodemus.md new file mode 100644 index 0000000..a54189a --- /dev/null +++ b/doc/drafts/tox_conda_notes_niccodemus.md @@ -0,0 +1,84 @@ +[tox] +envlist=py27,py35 + +[testenv] +commands= py.test --timeout=180 {posargs:tests} +deps=pytest>=2.3.5 + pytest-timeout + +# USE CASE 1: plain conda, with deps on tox.ini +create_env_command = conda create --prefix {envdir} python={python_version} +install_command = conda install --prefix {envdir} {opts} {packages} +list_dependencies_command = conda list --prefix {envdir} + +# deprecated: see tox_create_popen hook +linux:env_activate_command=source activate {envdir} +win:env_activate_command=activate.bat {envdir} + +# USE CASE 2: plain conda, using requirements.txt +install_command = conda install --prefix {envdir} {opts} --file requirements.txt + +# USE CASE 3: conda env +create_env_command = conda env create --prefix {envdir} python={python_version} --file environment.yml +install_command = + +[testenv] +type=virtualenv +type=venv +type=conda +type=conda-reqs +type=conda-env + +1. Create a new ``create_env_command`` option. +;2. Create a new ``env_activate_command`` option (also consider how to make that platform dependent). +2. New substitution variable: {python_version} ('3.4', '2.7', etc') +3. env type concept: different types change the default options. + +1. tox_addoption can now add new "testenv" sections to tox.ini: + +[virtualenv] +[conda] +[venv] + +2. extend hooks: + + * tox_addoption + * tox_configure + for each requested env in config: + tox_testenv_up_to_date(envmeta) + tox_testenv_create(envmeta) + tox_testenv_install_deps(envmeta, env) + tox_runtest_pre(envmeta, env) + tox_runtest(envmeta, env, popen) + tox_runtest_post(envmeta, env) + +3. separate virtualenv details from "VirtualEnv" class into a plugin. + +[tox] +envlist={py27,py35}-{sdist,wheel,conda} + +[package-sdist] +command = python setup.py sdist + +[package-wheel] +command = python setup.py bdist_wheel + +[package-conda] +command = conda build ./conda-recipe + +[testenv:{sdist,wheel}] +commands = py.test + +[testenv:conda] +packages = sdist,wheel +commands = py.test --conda-only + +* tox_addoption +* tox_get_python_executable +* tox_configure +for each requested env in config: + tox_testenv_create(envmeta) + tox_testenv_install_deps(envmeta, env) + tox_runtest_pre(envmeta, env) + tox_runtest(envmeta, env, popen) + tox_runtest_post(envmeta, env) -- cgit v1.2.1