Skip to content

Commit

Permalink
Ugly hack so "pip install -e ." works in conda env
Browse files Browse the repository at this point in the history
This adds a pyproject.toml file. It is handwritten, but it declares
poetry as its backend tool. Yet we are not (as of now) using or
supporting Poetry, and that tool need not actually be installed.

The actual project does have dependencies (per environment.yml),
but this new handwritten pyproject.toml file does not list them.
Currently, that file only exists to make the project installable,
so that an editable install can be made using: "pip install -e ."

That command should, of course, only be run in the conda
environment. (If we later also support Poetry, then
"poetry install" could be used outside the conda environment, but
"pip install -e ." would still not be used.)

This makes it so that "import embed" works even when run from a
different directory. That's important because the current directory
in a Jupyter notebook varies by application, with VS Code having it
be the directory in which the notebook resides, even if that is not
the folder that VS Code has open. Now we can run "pip install -e ."
to make "import embed" statements in notebooks work again.

A possible alternative is running "conda develop ." (or
"mamba develop .") but this requires the conda-build package to be
installed. We shouldn't require that it be installed in the base
environment, because while that would be fine for the dev
container, it would impose a requirement to make a global change on
users who are running locally (without a dev container). But when
conda-build is installed in the project environment, a conda bug
causes test discovery to break in the VS Code test runner (beaker).
See the "On the test discovery bug" paragraph and its links, in
EliahKagan/palgoviz#45, for details.
  • Loading branch information
EliahKagan committed Mar 18, 2023
1 parent 1e46a2a commit dd79266
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.poetry]
name = "EmbeddingScratchwork"
version = "0.1.0"
description = "Scratch work for embeddings"
authors = [
"David Vassallo <vassallo.davidm@gmail.com>",
"Eliah Kagan <degeneracypressure@gmail.com>",
]
packages = [
{ include = "embed.py" },
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit dd79266

Please sign in to comment.