Skip to content

Commit 7c19dcc

Browse files
author
tcezard
committedFeb 24, 2017
change the structure to support install via setup.py
1 parent 0451c25 commit 7c19dcc

15 files changed

+70
-14
lines changed
 

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
*.pyc
22
.idea
33
.cache
4+
__pycache__
5+
build/
6+
*.egg-info/
7+
dist/

‎.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ python:
33
- "3.4"
44

55
# command to install dependencies
6-
install: "pip install -r requirements.txt"
6+
install:
7+
- "pip install -r requirements.txt"
8+
- "python setup.py install"
79
script: PYTHONPATH=. py.test
810

911
notifications:

‎CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Changelog for EGCG-Core
2+
===========================
3+
4+
0.2 (unreleased)
5+
------------------
6+
- Support for installing via setup.py
7+
8+
0.1.1
9+
------

‎EPPs/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import pkg_resources
2+
3+
__version__ = pkg_resources.get_distribution("clarity_scripts").version
File renamed without changes.

‎EPPs/convert_and_dispatch_genotypes.py ‎bin/convert_and_dispatch_genotypes.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python
12
import csv
23
from os import remove
34
from os.path import join, dirname, abspath

‎EPPs/create_reagents_for_run.py ‎bin/create_reagents_for_run.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python
12
import os
23
import sys
34
import time

‎EPPs/prepare_discard_plate.py ‎bin/prepare_discard_plate.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python
12
import sys
23
from logging import FileHandler
34
from egcg_core.app_logging import logging_default as log_cfg

‎requirements.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
git+https://github.com/EdinburghGenomics/EGCG-Core.git@v0.4.3
2-
genologics==0.3.8.post0
1+
EGCG-Core==0.6.7

‎setup.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python
2+
import glob
3+
import subprocess
4+
from setuptools import setup, find_packages
5+
from os.path import join, abspath, dirname
6+
import pip
7+
8+
# Fetch version from git tags.
9+
#version = subprocess.Popen(["git", "describe", "--abbrev=0"],stdout=subprocess.PIPE, universal_newlines=True).communicate()[0].rstrip()
10+
#version = version.decode("utf-8")
11+
12+
requirements_txt = join(abspath(dirname(__file__)), 'requirements.txt')
13+
# reqs is a list of requirement
14+
# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
15+
requirements = [l.strip() for l in open(requirements_txt) if l and not l.startswith('#')]
16+
17+
18+
version = '0.1.1'
19+
20+
21+
setup(
22+
name='clarity_scripts',
23+
version=version,
24+
packages=find_packages(exclude=('tests',)),
25+
url='https://github.com/EdinburghGenomics/clarity_scripts',
26+
license='MIT',
27+
description='Clarity EPPs used in Edinburgh Genomics',
28+
long_description='Set of scripts used at Edinburgh Genomics to automate steps of in Clarity LIMS',
29+
install_requires=requirements, # actual module requirements
30+
scripts=glob.glob("bin/*.py"),
31+
zip_safe=False,
32+
author='Timothee Cezard',
33+
author_email='timothee.cezard@ed.ac.uk'
34+
35+
)

‎tests/test_assign_to_workflow_stage.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from tests.test_common import fake_all_inputs, TestEPP
22
from unittest.mock import Mock, patch
3-
from EPPs import assign_to_workflow_stage
3+
from bin import assign_to_workflow_stage
44

55

66
class TestAsignWorkflowStage(TestEPP):
@@ -31,14 +31,14 @@ def setUp(self):
3131
self.epp2._lims = Mock()
3232

3333
def test_assign(self):
34-
with patch('EPPs.assign_to_workflow_stage.get_workflow_stage', return_value=Mock(uri='a_uri')) as p:
34+
with patch('bin.assign_to_workflow_stage.get_workflow_stage', return_value=Mock(uri='a_uri')) as p:
3535
self.epp._run()
3636
p.assert_called_with(self.epp.lims, self.epp.workflow_name, 'a_stage_name')
3737
exp_artifacts = ['a1', 'a2']
3838
assert sorted([a.id for a in self.epp.lims.route_artifacts.call_args[0][0]]) == exp_artifacts
3939
assert self.epp.lims.route_artifacts.call_args[1] == {'stage_uri': 'a_uri'}
4040

41-
with patch('EPPs.assign_to_workflow_stage.get_workflow_stage', return_value=Mock(uri='a_uri')) as p:
41+
with patch('bin.assign_to_workflow_stage.get_workflow_stage', return_value=Mock(uri='a_uri')) as p:
4242
self.epp2._run()
4343
p.assert_called_with(self.epp2.lims, self.epp2.workflow_name, 'a_stage_name')
4444
print(self.epp2.lims.route_artifacts.call_count)

‎tests/test_common.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from os.path import join, dirname, abspath
22
from unittest.case import TestCase
3+
34
from EPPs.common import EPP
45
from unittest.mock import Mock
56

@@ -45,5 +46,6 @@ def setUp(self):
4546
self.epp._process = Mock()
4647
self.epp._lims = Mock()
4748

49+
4850
def test_init(self):
4951
assert self.epp.baseuri == 'http://server:8080'

‎tests/test_convert_and_dispatch_genotypes.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from os.path import join
33
from tests.test_common import TestCommon, TestEPP, FakeEntity
44
from unittest.mock import Mock, patch
5-
from EPPs.convert_and_dispatch_genotypes import GenotypeConversion, UploadVcfToSamples
5+
from bin.convert_and_dispatch_genotypes import GenotypeConversion, UploadVcfToSamples
66

77

88
class TestGenotypeConversion(TestCommon):
@@ -113,9 +113,9 @@ def setUp(self):
113113
self.epp._process = Mock(all_inputs=fake_all_inputs)
114114

115115
def test_upload(self):
116-
patched_log = patch('EPPs.convert_and_dispatch_genotypes.UploadVcfToSamples.info')
117-
patched_generate_vcf = patch('EPPs.convert_and_dispatch_genotypes.GenotypeConversion.generate_vcf')
118-
patched_remove = patch('EPPs.convert_and_dispatch_genotypes.remove')
116+
patched_log = patch('bin.convert_and_dispatch_genotypes.UploadVcfToSamples.info')
117+
patched_generate_vcf = patch('bin.convert_and_dispatch_genotypes.GenotypeConversion.generate_vcf')
118+
patched_remove = patch('bin.convert_and_dispatch_genotypes.remove')
119119

120120
exp_log_msgs = (
121121
('Matching against %s artifacts', 1),

‎tests/test_prepare_discard_plate.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from tests.test_common import fake_all_inputs, TestEPP, FakeEntity
22
from unittest.mock import Mock, patch
3-
from EPPs import prepare_discard_plate
3+
from bin import prepare_discard_plate
44

55

66
class FakeContainer(FakeEntity):
@@ -33,8 +33,8 @@ def setUp(self):
3333
self.epp._process = Mock(all_inputs=fake_all_inputs)
3434

3535
def test_discard(self):
36-
patched_stage = patch('EPPs.prepare_discard_plate.get_workflow_stage', return_value=Mock(uri='a_uri'))
37-
patched_log = patch('EPPs.prepare_discard_plate.FindPlateToRoute.info')
36+
patched_stage = patch('bin.prepare_discard_plate.get_workflow_stage', return_value=Mock(uri='a_uri'))
37+
patched_log = patch('bin.prepare_discard_plate.FindPlateToRoute.info')
3838

3939
exp_log_messages = (
4040
('Found Stage %s uri: %s', 'Discard Plates EG 1.0', 'a_uri'),

‎version.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.