2

I have seen people using pip install docker-py or pip install 'molecule[docker]'.

I believe they are similar (equivalent?)

I read https://molecule.readthedocs.io/en/stable/getting-started.html which says :

Molecule requires an external Python dependency for the Docker driver which is provided when installing Molecule using pip install 'molecule[docker]'.

so is the molecule[docker] one better in some way ?

k1eran
  • 4,492
  • 8
  • 50
  • 73

2 Answers2

2

My guess would be that pip install docker-py install the library globally, or installs the entire library.

Whereas pip install molecule[docker] either only installs the necessary bits for molecule, or it installs it specifically in a molecule location.

I'm more inclined to believe it's the first option - that it saves on space and resources by only installing what is necessary. But that is just my guess.

Jamie
  • 1,530
  • 1
  • 19
  • 35
2

pip install molecule[docker] is special pip syntax to say "install the molecule package, with its additional docker option". Using this is almost certainly better than installing molecule with no additional options, and then trying to manually install its Docker dependencies separately.

David Maze
  • 130,717
  • 29
  • 175
  • 215