Skip to content

Commit 446b4fd

Browse files
committed
Update installation instructions and virtual environment setup.
1 parent d7b3e9c commit 446b4fd

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

README.rst

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,26 @@ This "dummy" package can be installed with pip:
8888
8989
pip install pydevtips
9090
91-
Or from source, e.g. with Anaconda / Miniconda:
91+
Or from source. Firstly, `Poetry <https://python-poetry.org/docs/#installation>`_
92+
must be installed.
9293

9394
.. code:: bash
9495
96+
# -- recommend using pipx
97+
pipx install poetry
98+
99+
# -- or with official installer
100+
# curl -sSL https://install.python-poetry.org | python3 -
101+
102+
103+
Then the following commands can be run:
104+
105+
.. code:: bash
106+
107+
# get source code
108+
git clone [email protected]:ebezzam/python-dev-tips.git
109+
cd python-dev-tips
110+
95111
# create new environment, press enter to accept
96112
# -- important to set python version, otherwise `python` executable may not exist
97113
# -- (would be `python3` instead)
@@ -106,12 +122,37 @@ Or from source, e.g. with Anaconda / Miniconda:
106122
# install package locally
107123
(project_env) poetry install --with dev
108124
125+
# install pre-commit hooks
126+
(project_env) pre-commit install
127+
109128
# run tests
110-
(project_env) poetry run pytest
129+
(project_env) pytest
111130
112131
# deactivate environment
113132
(project_env) conda deactivate
114133
134+
Or with just Poetry:
135+
136+
.. code:: bash
137+
138+
# get source code
139+
git clone [email protected]:ebezzam/python-dev-tips.git
140+
cd python-dev-tips
141+
142+
# install package locally
143+
poetry install --with dev
144+
# -- `poetry env info` to see where the virtual environment is located
145+
146+
# install pre-commit hooks
147+
poetry run pre-commit install
148+
149+
# run tests
150+
poetry run pytest
151+
152+
## NOTE that Python related commands need to be run
153+
## with `poetry run` or by activating the virtual environment
154+
## https://python-poetry.org/docs/basic-usage/#activating-the-virtual-environment
155+
115156
Examples
116157
========
117158

docs/source/virtual_env.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ you create a new environment like so:
1616
.. code:: bash
1717
1818
# create new environment, press enter to accept
19-
conda create -n project_env python=3.9
19+
# -- important to set python version, otherwise `python` executable may not exist
20+
# -- (would be `python3` instead)
21+
conda create -n project_env python=3.11
2022
2123
# view available environments
2224
conda info --envs
@@ -58,6 +60,12 @@ You can identify the location and info of the Poetry virtual environment by runn
5860
5961
poetry env info
6062
63+
You can also configure to create the virtual environment within the project folder:
64+
65+
.. code:: bash
66+
67+
poetry config virtualenvs.in-project true
68+
6169
6270
Sharing your environment
6371
------------------------
@@ -100,7 +108,7 @@ storing and keeping track of packages:
100108
101109
conda env list
102110
103-
The the name of the environment is specified at the top of ``environment.yml``.
111+
The name of the environment is specified at the top of ``environment.yml``.
104112

105113
Note that this approach is specific to Anaconda / Miniconda. More
106114
information can be found

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: project_env
1+
name: project_env_yml
22
channels:
33
- defaults
44
dependencies:

0 commit comments

Comments
 (0)