How to manage libraries and configuration files in Python

Question:
The python and the flask templates have :

  1. poetry lock files
  2. replix.nix files that have dependencies listed in them
  3. and, also, there is a “packages” installation menu in the replit toolbar

So I am confused — when we need a library in Python, should we add it to 1), to 2), to 3), or to several of them at the same time ?

Another question is, regarding the “run” command in the .replit configuration file. The syntax of the “interpreter” is hard to understand. Hence, we we want to customize anything, are we expected to remove the entire [interpreter] section and edit the run command at the top only?

Repl link:

https://replit.com/@kenxyz/python-tempalte#main.py
https://replit.com/@kenxyz/flask-template#

When installing a package for python just use the packages installer, it automatically adds the package to the poetry files. The packages under replit.nix are nix packages.

4 Likes

As @InvisibleOne said, just use the packages option in the menu. After clicking on the option, a search option will appear. You search for the package you need and then click on install

image

4 Likes

thanks @WindLother !

and as for whether the [interpreter] section of the .replit file can be deleted in order to simply use the more customizable “run=” command ?

You used to be able to deleted everything out of the .replit file and just have run ="command" but I don’t think you can do that anymore. Someone correct me if I’m wrong.

2 Likes

Since the core setup and dependencies for the Replit environment are now primarily configured through the replit.nix file I don’t think there is a problem deleting the [interpreter] or [language] section in the .replit file and instead handle the interpreter and dependencies using the replit.nix configuration.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.