monarch-initiative / monarch-project-template

A Cookiecutter to kickstart Python based projects.
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Move `optional=True` representation in toml #12

Closed hrshdhgd closed 1 year ago

hrshdhgd commented 1 year ago

I am removing the optional=True from tool.poetry.group.dev.dependencies.

Reason:

I converted sssom-py to be a product of this cookiecutter. When I poetry install for the first time, all's well. But when I do it the second time or run any of the following:

It deletes virtualenv and 3 other packages.

  • Removing distlib (0.3.6)
  • Removing filelock (3.12.2)
  • Removing platformdirs (3.6.0)
  • Removing virtualenv (20.23.1)
  • Updating urllib3 (1.26.16 -> 2.0.3)

The next time I run any poetry command it errors out saying virtualenv doesn't exist.

ModuleNotFoundError: No module named 'virtualenv'

The only fix is to reinstall poetry and start over again.

Investigation:

It seemed like in the poetry.lock file all the libraries that were uninstalled had optional=True. When I took them out from the toml file.

Using the latest version of poetry v1.5.1

hrshdhgd commented 1 year ago

Solution:

A new design of the toml file where:

[tool.poetry.group.docs.dependencies] sphinx = {version = ">=6.1.3"} sphinx-rtd-theme = {version = ">=1.0.0"} sphinx-autodoc-typehints = {version = ">=1.2.0"} sphinx-click = {version = ">=4.3.0"} myst-parser = {version = ">=0.18.1"}



- `optional` packages are declared as shown above