Skip to content

Commit

Permalink
🐛 make sure version is available in wheels distribution (#10)
Browse files Browse the repository at this point in the history
* 🐛 change steup.json file location
* 🔧 manage 1 file for version inside module
* 🎨 clean up a bit
* 🎨 clean up setup.cfg
* 👕 remove unused statements in MANIFEST.in
* 🔧 remove unused imports in __init__.py
* 🔧 remove unused imports in __init__.py
* 🐛 pydocstyle was checking the wrong directory
* 🐛 use absolute paths in setup.py
* 🐛 use absolute paths in __init__.py
* 🔧 simplify tox.ini
* 👕 clean up tox.ini
  • Loading branch information
juanesarango authored and jsmedmar committed Feb 16, 2018
1 parent 66c5d16 commit 278ad08
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 107 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

language: python

sudo: false
Expand Down
17 changes: 1 addition & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,7 @@ Additionally, a `.pydocstyle` defines *docstrings* conventions to be tested with
## Tox
Use [tox][tox] run tests on a isolated python environment. The `tox.ini` file enables you to get [pytest][pytest], [pylint][pylint], [pydocstyle][pydocstyle] and a [coverage][coverage] html report. Tox also tests the installation procedure. To execute the default environments run:
tox
You can run a set of specific test environments:
tox -e report,lint
The `report` enviroment will create a html coverage report. Use `tox --recreate` when you need to rebuild the tox environments (e.g. you changed one of the `deps` lists in the `tox.ini` file). The available tox environments are:
| Name | function |
| ------ | ------------------------------------------------------------------------------------------------- |
| py27 | Test package using python 2 (Toil) |
| lint | Run [pylint][pylint] and [pydocstyle][pydocstyle] using the `.pylintrc` and `.pydocstylerc` files |
| report | Run base tests and generate coverage statistics |
| clean | Clean a previously generated coverage report |
Use [tox][tox] run tests on a isolated python environment. The `tox.ini` file enables you to get [pytest][pytest], [pylint][pylint] and [pydocstyle][pydocstyle]. Tox also tests the installation procedure.
<!-- References -->
Expand Down
17 changes: 0 additions & 17 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
graft tests
graft docker

include CONTRIBUTING.md
include LICENSE
include README.md

include .coveragerc
include .pylintrc

include pytest.ini
include setup.json
include tox.ini
include Makefile

global-exclude *.dylib
global-exclude *.py[cod]
global-exclude *.so
global-exclude __pycache__

recursive-include toil_container *
recursive-include setup.json Makefile
18 changes: 2 additions & 16 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
[bumpversion]
current_version = 0.1.0
commit = True
tag = True

[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'

[bumpversion:file:toil_container/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[bdist_wheel]
universal = 1

[flake8]
exclude = docs
[metadata]
license_file = LICENSE

[aliases]
test = pytest
# Define setup.py command aliases here
3 changes: 1 addition & 2 deletions setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Programming Language :: Python :: 2 :: Only",
"Topic :: Utilities"
],
"description": "A base package to create Toil pipelines, using containerized jobs.",
"description": "A python package with a Toil Job Class capable of containerized system calls.",
"install_requires": [
"Click>=6.7",
"docker==2.5.1",
Expand Down Expand Up @@ -42,6 +42,5 @@
},
"test_suite": "tests",
"url": "https://github.com/leukgen/toil_container",
"version": "0.1.0",
"zip_safe": false
}
26 changes: 13 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""toil_container setup.py."""

from os.path import join
from os.path import abspath
from os.path import dirname
from os.path import join
import io
import json

from setuptools import find_packages
from setuptools import setup

ROOT = abspath(dirname(__file__))
CONF = join(ROOT, "setup.json")


def read(path, **kwargs):
"""Return content of a file."""
return io.open(path, encoding=kwargs.get("encoding", "utf8")).read()

# make sure we use absolute paths
ROOT = abspath(dirname(__file__))

# Please put setup keywords in the setup.json to keep this file clean.
with open(CONF, "r") as f:
# please put setup keywords in the setup.json to keep this file clean
with open(join(ROOT, "setup.json"), "r") as f:
SETUP = json.load(f)

setup(
# Load description from README.
# load description from README
long_description=read(join(ROOT, "README.md")),

# In combination with MANIFEST.in, package non-python files included
# in combination with MANIFEST.in, non-python files included
# inside the toil_container will be copied to the
# site-packages installation directory.
# site-packages and wheels installation directory
include_package_data=True,

# Return a list all Python packages found within the ROOT directory.
# return a list all Python packages found within the ROOT directory
packages=find_packages(),

# Pass parameters loaded from setup.json including author and version.
# The version is only defined in one place
version=read(join(ROOT, "toil_container", "VERSION")).strip(),

# pass parameters loaded from setup.json including author and version
**SETUP
)
2 changes: 1 addition & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

def test_version():
"""Sample test for the __version__ variable."""
assert __version__ == "0.1.0"
assert __version__
1 change: 1 addition & 0 deletions toil_container/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.1
17 changes: 10 additions & 7 deletions toil_container/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
"""toil_container module."""

from os.path import join
from os.path import abspath
from os.path import dirname
import json
from os.path import join

from toil_container.jobs import (
ContainerCallJob
)

from toil_container.jobs import ContainerCallJob
from toil_container.parsers import (
ContainerArgumentParser,
ContainerShortArgumentParser,
ToilShortArgumentParser
)

with open(join("setup.json"), "r") as f:
SETUP = json.load(f)
# make sure we use absolute paths
ROOT = abspath(dirname(__file__))

__version__ = SETUP.get("version")
with open(join(ROOT, "VERSION"), "r") as f:
VERSION = f.read().strip()

__author__ = SETUP.get("author")
__version__ = VERSION
42 changes: 8 additions & 34 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,43 +1,17 @@
[tox]
envlist = py27, lint
envlist = py27


[travis]
python =
2.7: py27
python = 2.7: py27


[testenv]
usedevelop=false
passenv=*
deps=-r{toxinidir}/requirements.txt
basepython={lint,py27,report,clean}: {env:TOXPYTHON27:python2.7}
commands=
pip install -U pip
usedevelop = True
passenv = *
deps = -r./requirements.txt
basepython = {py27}: {env:TOXPYTHON27:python2.7}
commands =
py.test {env:TOX_PYTEST_ARGS:-s --cov=toil_container --cov-report=term-missing -vv tests}


[testenv:lint]
skip_install=True
commands=
pylint toil_container --rcfile={toxinidir}/.pylintrc
pydocstyle --config={toxinidir}/.pydocstylerc click_pileup


[testenv:report]
skip_install=True
commands=
coverage erase
{[testenv]commands}
coverage combine --append
coverage report
coverage html


[testenv:clean]
skip_install=true
commands=coverage erase




pydocstyle toil_container --config={toxinidir}/.pydocstylerc

0 comments on commit 278ad08

Please sign in to comment.