Skip to content

mainrepo/pybasics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python basic samples

The focus of this python module is to assemble python code fragments of basic nature that can find some good use.

User Guidelines

Please use terminal for project installation, build & running locally for testing. The integrated terminal of vscode can also be used. The vscode must have an appropriate extensions installed for development work. The main one being pylance language server. Windows users can use Ubuntu or Al2 machines running on WSL 2

After cloing the samples repository; cd to the pybasics directory and fire below commands as required.

Virtual environments

A set of python versions can be installed using pyenv. We will use 3.9 variant for it's stability. Otherwise direct installation of python 3.9 is also good for these basic samples.

# check the versions that can be installed
pyenv install -l | grep -v grep | grep 3.9

# install the 3.9 variant
pyenv install 3.9.xx

# check the installed python versions
pyenv versions

# make 3.9 variant as global python version
pyenv use 3.9

# activate the 3.9 virtual environment
source /path/to/venv.d/bin/activate

Running

# running the pizza assistant, an openai bot
# please set the environment variable OPENAI_API_KEY
python src/pizza_bot.py

# running the todo module which has to-do list
python src/todo.py

# running the lists module which has list manipulations
python src/lists.py

# likewise other programs can be run

Vital info

  1. The project uses poetry (pyproject.toml) for python dependency management.
  2. Here is a screenshot of the running sample.
  3. There are also vscode settings & launcher files. Hence, the project can be run in debug mode as well.

License

MIT

About

Assembly of python code fragments of the basic nature

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages