Skip to content

Commit

Permalink
Merge pull request #76 from PennLINC/fix/pip_install
Browse files Browse the repository at this point in the history
[FIX] cannot find yaml file error when installed by `pip install .`
  • Loading branch information
Chenying Zhao authored Apr 17, 2023
2 parents d6f1956 + 30909e5 commit fe04448
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ jobs:
name: pytest of BABS
no_output_timeout: 1h
command: |
pip install -e .[tests]
pip install .[tests]
pytest -n 6 -sv
# TODO: change back to `pip install .` after fixing the bug!
workflows:
Expand Down
11 changes: 11 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#Misc
# include CHANGES.rst
include LICENSE

# necessary files in babs/:
# by default it only includes *.py
recursive-include babs *.yaml

# versioneer
include versioneer.py
include babs/_version.py
8 changes: 6 additions & 2 deletions babs/babs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,9 @@ def __init__(self, system_type):

def get_dict(self):
# location of current python script:
__location__ = op.realpath(op.dirname(__file__))
# `op.abspath()` is to make sure always returns abs path, regardless of python version
# ref: https://note.nkmk.me/en/python-script-file-path/
__location__ = op.realpath(op.dirname(op.abspath(__file__)))

fn_dict_cluster_systems_yaml = op.join(__location__, "dict_cluster_systems.yaml")
with open(fn_dict_cluster_systems_yaml) as f:
Expand Down Expand Up @@ -2791,7 +2793,9 @@ def generate_bash_test_job(self, folder_check_setup,

# Copy the existing python script to this BABS project:
# location of current python script:
__location__ = op.realpath(op.dirname(__file__))
# `op.abspath()` is to make sure always returns abs path, regardless of python version
# ref: https://note.nkmk.me/en/python-script-file-path/
__location__ = op.realpath(op.dirname(op.abspath(__file__)))
fn_from = op.join(__location__, "template_test_job.py")
# copy:
shutil.copy(fn_from, fn_test_job)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from setuptools import setup
from setuptools import setup, find_packages
import versioneer


Expand All @@ -15,6 +15,7 @@


setup(name='babs',
packages=find_packages(),
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
setup_requires=SETUP_REQUIRES
Expand Down
4 changes: 3 additions & 1 deletion tests/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from babs.utils import (read_yaml) # noqa

# =============== Define several constant variables: ==================
__location__ = op.dirname(__file__) # the path to the directory of current python script
__location__ = op.dirname(op.abspath(__file__)) # the path to the directory of current python script
# ^^ `op.abspath()` is to make sure always returns abs path, regardless of python version
# ref: https://note.nkmk.me/en/python-script-file-path/

# containers:
LIST_WHICH_BIDSAPP = ["toybidsapp", "fmriprep", "qsiprep"]
Expand Down

0 comments on commit fe04448

Please sign in to comment.