Skip to content

Commit cd95afc

Browse files
Update README.md
pip, asdf, and poetry dependencies. venv vs. poetry usage. Add toc
1 parent b0ada3d commit cd95afc

File tree

1 file changed

+103
-8
lines changed

1 file changed

+103
-8
lines changed

README.md

Lines changed: 103 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,118 @@ Extended version of the [Nimbus HTML to Markdown gist](https://gist.github.com/p
55

66
Uses [pandoc](https://pandoc.org/) to convert HTML files with asset directories exported from Nimbus for use in other vendor-agnostic Markdown readers (cf. [UpNote](https://getupnote.com/)).
77

8+
**Table of Contents**
9+
* [convert_html_md](#convert_html_md)
10+
* [Summary](#summary)
11+
* [Setup](#setup)
12+
* [Dependencies](#dependencies)
13+
* [Usage](#usage)
14+
* [TODO](#todo)
15+
* [Further Reading](#further-reading)
16+
817
## Setup
918
* Install
1019
* [editorconfig](https://editorconfig.org/)
1120
* [asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf)
1221
* [poetry](https://python-poetry.org/docs/)
1322

23+
### Dependencies
24+
`pip` comes with python by default and is sufficient to get up and running quickly. `asdf` is a wrapper for `pyenv` (among other runtimes) and takes care of python versions. `poetry` handles dependencies, virtual environments, and packaging.
25+
26+
* `pip`
27+
```bash
28+
# activate a new virtual environment
29+
python3 -m venv .venv; . .venv/bin/activate; pip3 install --upgrade pip
30+
31+
# install dependencies
32+
python3 -m pip install -r requirements.txt
33+
```
34+
* `asdf`
35+
```bash
36+
# add python plugin
37+
asdf plugin-add python
38+
39+
# install stable python
40+
asdf install python <latest> # 3.10.8
41+
42+
# uninstall version
43+
asdf uninstall python latest
44+
45+
# refresh symlinks for installed python runtimes
46+
asdf reshim python
47+
48+
# set working directory version (i.e., repo)
49+
asdf local python latest
50+
51+
# set stable to system python
52+
asdf global python latest
53+
```
54+
* `poetry`
55+
```bash
56+
# Install
57+
curl -sSL https://install.python-poetry.org | $(which python3) -
58+
59+
# Uninstall
60+
export POETRY_UNINSTALL=1
61+
curl -sSL https://install.python-poetry.org | $(which python3) -
62+
63+
# Change config
64+
poetry config virtualenvs.in-project true # .venv in `pwd`
65+
66+
# Install from requirements.txt
67+
poetry add `cat requirements.txt`
68+
69+
# Update dependencies
70+
poetry update
71+
72+
# Remove library
73+
poetry remove <lib>
74+
75+
# Generate requirements.txt
76+
poetry export -f requirements.txt --output requirements.txt --without-hashes
77+
```
78+
* Poetry with `asdf`
79+
```bash
80+
# Add poetry asdf plugin
81+
asdf plugin-add poetry https://github.com/asdf-community/asdf-poetry.git
82+
83+
# Install latest version via asdf
84+
asdf install poetry latest
85+
86+
# Set latest version as default
87+
asdf global poetry latest
88+
89+
# Install via asdf w/version
90+
ASDF_POETRY_INSTALL_URL=https://install.python-poetry.org asdf install poetry 1.2.2
91+
asdf local poetry 1.2.2
92+
```
93+
1494
## Usage
15-
```bash
16-
# activate a new virtual environment
17-
python3 -m venv venv; . venv/bin/activate; pip3 install --upgrade pip
95+
* Virtual environment
96+
```bash
97+
# source virtual environment (venv) from dependencies setup above
98+
. .venv/bin/activate
99+
100+
# run program from top-level directory
101+
python3 convert.py
102+
103+
# exit
104+
deactivate
105+
```
106+
* Poetry
107+
```bash
108+
# Run script and exit environment
109+
poetry run python convert.py
110+
111+
# Activate virtual environment (venv)
112+
poetry shell
18113
19-
# install dependencies
20-
python3 -m pip install -r requirements.txt
114+
# Run script
115+
python convert.py
21116
22-
# run program from top-level directory
23-
python3 convert.py
24-
```
117+
# Deactivate venv
118+
exit # ctrl-d
119+
```
25120

26121
## TODO
27122
* ~~Document usage~~

0 commit comments

Comments
 (0)