Skip to content

Virtual env examples#6

Open
Naapi wants to merge 15 commits into
turkupy:masterfrom
Naapi:master
Open

Virtual env examples#6
Naapi wants to merge 15 commits into
turkupy:masterfrom
Naapi:master

Conversation

@Naapi

@Naapi Naapi commented Oct 20, 2020

Copy link
Copy Markdown
Contributor

#4 Added some examples of virtual environment with different OS :)

@magdapoppins magdapoppins left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mainly good! I added some thoughts. Could you do something to the commit history as well, unless you plan on squashing it in the merge?

Comment thread HowToVenv/README.md

## Why to use virtual environment?
To isolate environment from the global environments and having same Python pip libraries as the project obtains is what venv is mainly used for.
Sometimes the project may require specific libraries to work as syntax of the libraries may change or they are depended on another older libraries.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specific versions?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe one could also write some example/more explanations like:

  • What is the difference if I do pip install inside a virtual environment contra without one?
  • What are libraries? What is an environment? (Really hard questions to answer in a simple way, actually!)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points to make bit more simpler level explanations. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the picture shows in commits, but at least there are some visuals about versions :)
https://github.com/Naapi/beginners-python-weather/tree/master/HowToVenv

Comment thread HowToVenv/README.md

Create a venv
```
py -m venv venv

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite unusual to have python3 aliased as py?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows magic it seems for pointing out the file path. Gives error with python/3 alias, but guess there are some workarounds for that. Tested it working locally

Comment thread HowToVenv/README.md

### Install libraries from requirements.txt

Commonly `requirements.txt` is used for listing needed libraries and versions for the projectvirtual environment. When creating a new venv, the libraries needed for the project are needed to be installed with following:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"projectvirtual". Ahaa 👍

Comment thread README.md
* Format strings using [f-strings](https://realpython.com/python-f-strings/#f-strings-a-new-and-improved-way-to-format-strings-in-python)
* Use [urllib](https://docs.python.org/3/howto/urllib2.html) to make requests to the API
* Create a [virtualenv](https://docs.python.org/3/library/venv.html) for managing dependencies
* Create a [virtualenv](https://docs.python.org/3/library/venv.html) for managing dependencies // More virtual environment examples [here](/HowToVenv)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this link work? 👀 Or does it need to point at the readme in /HowToVenv/README.md?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mainly good! I added some thoughts. Could you do something to the commit history as well, unless you plan on squashing it in the merge?

I will take a second look for that. Tried to squash them, but things went horribly wrong :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this link work? 👀 Or does it need to point at the readme in /HowToVenv/README.md?

Yep, it will point to the Folder and folder itself shows the README.md like the Repo's front page readme

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel ya! You could try
git reset HEAD~5 (or how many steps backward you wanna go)
git add .
git commit -m "My new fancy commit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try that, tried with rebase after midnight... soo maybe with more fresh mind it will work :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants