Skip to content

Commit

Permalink
tasks.py re-org
Browse files Browse the repository at this point in the history
  • Loading branch information
edublancas committed Feb 7, 2022
1 parent b27f108 commit 17c757b
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
'with the README.md and setup.py files)')


def _print_psycopg_msg():
print("Failed to run the command 'invoke setup'. Have issues "
"installing the psycopg2 package? Remove it from "
"setup.py then try again.")


@task
def db_credentials(c):
"""Encode db credentials (for github actions)
Expand Down Expand Up @@ -50,16 +56,13 @@ def setup(c, doc=False, version=None):
cmds.pop(0)

c.run(f'conda create --name {env_name} python={version} --yes')

try:
c.run(' && '.join(cmds))
except Exception as e:
print(
"Failed to run the command 'invoke setup'. Have issues installing the psycopg2 package? Remove it from setup.py then try again."
)
except Exception:
_print_psycopg_msg()
raise


if doc:
cmds = [
'eval "$(conda shell.bash hook)"',
Expand All @@ -83,11 +86,9 @@ def setup_pip(c, doc=False):
# install ploomber in editable mode and include development dependencies
try:
c.run('pip install --editable ".[dev]"')
except Exception as e:
print(
"Failed to run the command'invoke setup-pip'. Have issues installing the psycopg2 package? Remove it from setup.py then try again."
)
raise
except Exception:
_print_psycopg_msg()
raise

# install sample package required in some tests
c.run('pip install --editable tests/assets/test_pkg')
Expand Down

0 comments on commit 17c757b

Please sign in to comment.