Skip to content

Commit

Permalink
Merge pull request #163 from biocommons/147-ipython-optional
Browse files Browse the repository at this point in the history
Merging into `develop` branch for breaking change.
  • Loading branch information
reece authored Jul 5, 2024
2 parents 5013e7f + ab237cc commit 373b0c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ tested. Patches to get other systems working would be welcomed.

### OS X

$ brew install python libpq
brew install python libpq

### Ubuntu

$ sudo apt install -y python3-dev gcc zlib1g-dev tabix
sudo apt install -y python3-dev gcc zlib1g-dev tabix

### All platforms

$ python -m venv venv
$ source venv/bin/activate
$ pip install seqrepo
$ pip install biocommons.seqrepo
$ sudo mkdir -p /usr/local/share/seqrepo
$ sudo chown $USER /usr/local/share/seqrepo
$ seqrepo pull -i 2018-11-26
Expand All @@ -138,7 +138,9 @@ tested. Patches to get other systems working would be welcomed.
>> sr["NC_000001.11"][780000:780020]
'TGGTGGCACGCGCTTGTAGT'

# Or, use the seqrepo shell for even easier access
# Optional: Install with the `shell` dependency group
# (i.e., `pip install biocommons.seqrepo[shell]`)
# and use the seqrepo shell
$ seqrepo start-shell -i 2018-11-26
In [1]: sr["NC_000001.11"][780000:780020]
Out[1]: 'TGGTGGCACGCGCTTGTAGT'
Expand Down Expand Up @@ -198,7 +200,7 @@ Install pre-commit hook:

## Building a docker image

Docker images are available at https://hub.docker.com/r/biocommons/seqrepo.
Docker images are available at <https://hub.docker.com/r/biocommons/seqrepo>.
Tags correspond to the version of data, not the version of seqrepo, because the
intent is to make it easy to depend on a local version of seqrepo *files*. Each
docker image is an installation of seqrepo that downloads the corresponding
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ dynamic = ["version"]
dependencies = [
"bioutils > 0.4",
"coloredlogs ~= 15.0",
"ipython ~= 8.4",
"pysam ~= 0.22",
"requests ~= 2.31",
"tqdm ~= 4.66",
"yoyo-migrations ~= 8.2",
]

[project.optional-dependencies]
shell = ["ipython ~= 8.4"]
dev = [
"bandit ~= 1.7",
"build ~= 0.8",
"flake8 ~= 4.0",
"ipython ~= 8.4",
"isort ~= 5.10",
"mypy-extensions ~= 1.0",
"pre-commit ~= 3.4",
Expand Down
6 changes: 5 additions & 1 deletion src/biocommons/seqrepo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,11 @@ def _drop_write(p):
def start_shell(opts: argparse.Namespace) -> None:
seqrepo_dir = os.path.join(opts.root_directory, opts.instance_name)
sr = SeqRepo(seqrepo_dir) # noqa: 682
import IPython
try:
import IPython
except ImportError as e:
msg = "Unable to import IPython to start SeqRepo shell. Is the `shell` dependency group installed?" # noqa: E501
raise ImportError(msg) from e

IPython.embed(
header="\n".join(
Expand Down

0 comments on commit 373b0c3

Please sign in to comment.