Skip to content

Commit

Permalink
Run pytest when building conda pkg and move setup.py deps to conda (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
timdiels committed Feb 23, 2021
1 parent 03aebb8 commit 0a8dc27
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 44 deletions.
35 changes: 24 additions & 11 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
# Conda recipe
{% set data = load_setup_py_data() %}

package:
name: coexpnetviz
version: '{{ data['version'] }}'

source:
path: ..

build:
script: '{{ PYTHON }} -m pip install . -vv'
entry_points:
- coexpnetviz = coexpnetviz.main:main

requirements:
build:
- pip
- python
- setuptools
host:
# Conda recommends always adding the interpreter as a host dep
- python
run:
- python
- attrs>=17
- matplotlib>=1
- numpy>=1
- pandas>=0.19
- more-itertools>=3
- varbio==3.*
- python >=3.6 # a reasonable minimum
- attrs >=17
- matplotlib >=1
- numpy >=1
- pandas >=0.19
- more-itertools >=3
- varbio ==3.*

test:
# A very simple test, ensure we can run coexpnetviz without error
source_files:
- pytest.ini
- tests
requires:
- pytest >=3
- pytil ==8.*
commands:
# Ensure we can run coexpnetviz without error
- coexpnetviz --help
# Ensure tests succeed
- pytest

about:
# TODO point home to cytoscape app page instead
home: https://gitlab.psb.ugent.be/deep_genome/coexpnetviz.git
home: https://github.com/CoExpNetViz/coexpnetviz-python
license: LGPL3
license_file: LICENSE.txt
summary: Internal python CLI used by CoExpNetViz Cytoscape app
40 changes: 7 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
from setuptools import setup, find_packages
from collections import defaultdict
from pathlib import Path
import os

setup_args = dict(
version='5.0.0.dev1',
name='coexpnetviz',
long_description=Path('README.rst').read_text(),
packages=find_packages(),
extras_require={
'dev': [
'pytest>=3',
'pytil[data_frame,test]==8.*',
],
},
name = 'coexpnetviz'
setup(
version='5.0.0.dev',
name=name,
entry_points={'console_scripts': [
'coexpnetviz = coexpnetviz.main:main'
]},
)

# Generate package data
#
# Anything placed underneath a directory named 'data' in a package, is added to
# the package_data of that package; i.e. included in the sdist/bdist and
# accessible via pkg_resources.resource_*
project_root = Path(__file__).parent
package_data = defaultdict(list)
for package in setup_args['packages']:
package_dir = project_root / package.replace('.', '/')
data_dir = package_dir / 'data'
if data_dir.exists() and not (data_dir / '__init__.py').exists():
# Found a data dir
for parent, _, files in os.walk(str(data_dir)):
package_data[package].extend(str((data_dir / parent / file).relative_to(package_dir)) for file in files)
setup_args['package_data'] = {k: sorted(v) for k,v in package_data.items()} # sort to avoid unnecessary git diffs

# setup
setup(**setup_args)
# Only include {name}/, not e.g. tests/
packages=find_packages(include=(name, name + '.*')),
)

0 comments on commit 0a8dc27

Please sign in to comment.