Skip to content

Commit fe54050

Browse files
committed
Enhancements to installation guide
More clarity on `poetry` and some guidance regarding `pip`
1 parent 304403b commit fe54050

File tree

1 file changed

+90
-14
lines changed

1 file changed

+90
-14
lines changed

INSTALL.md

+90-14
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
`oascomply` requires Python 3.8 or later, and has primarily been tested with 3.8.
44

55
Currently, `oascomply` must be checked out from GitHub and installed using
6-
the Python dependency management tool `poetry`. Publication to PyPI
7-
and support for installation with `pip` will be part of Milestone 4.
6+
the Python dependency management tool [`poetry`](https://python-poetry.org/docs/).
7+
Publication to PyPI will be part of Milestone 4.
88

99
## Installing Python
1010

@@ -26,27 +26,70 @@ will be added prior to publication. No support for earlier Python versions
2626
will be added due to the requirements of various dependencies. Please
2727
contact the maintainer if you can help with Windows testing._
2828

29-
## Installing `oascomply` from GitHub with `poetry`
29+
## A note on using `pip`
30+
31+
For those of you who prefer `pip` over `poetry`,
32+
While it is possible to install `oascomply` using `pip -e .` from
33+
the checked-out repository directory, `pip` may install slightly
34+
different package versions as it understands the `pyproject.toml`
35+
file, but
36+
up a b
37+
38+
## Installing `oascomply` from GitHub
39+
40+
`oascomply` is expected to be published to PyPI by October 2023.
3041

31-
`oascomply` is expected to be `pip`-installable by October 2023.
3242
Currently, it must be checked out from GitHub and installed
33-
using [`poetry`](https://python-poetry.org/docs/).
43+
using [`poetry`](https://python-poetry.org/docs/) (preferably)
44+
or alternatively with `pip -e`..
45+
46+
```ShellSession
47+
~/src % git clone https://github.com//OAI/oascomply.git
48+
~/src % cd oascomply
49+
~/src/oascomply %
50+
```
51+
52+
### Installing with `poetry` (recommended)
53+
54+
Installation instructions for `poetry` can be found in its
55+
[documentation](https://python-poetry.org/docs/#installation),
56+
but the simplest way on Mac OS X, Linux, or Windows (WSL) is:
57+
58+
```ShellSession
59+
~/src/oascomply % curl -sSL https://install.python-poetry.org | python3 -
60+
~/src/oascomply % which poetry
61+
/Users/handrews/.local/bin/poetry
62+
```
63+
64+
Or on Windows PowerShell (replace `py` with `python` if you installed
65+
Python through the Microsoft Store):
66+
67+
```PowerShell
68+
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
69+
```
3470

3571
```ShellSession
36-
src % curl -sSL https://install.python-poetry.org | python3 -
37-
src % git clone https://github.com//OAI/oascomply.git
38-
src % cd oascomply
39-
oascomply % poetry install
72+
~/src/oascomply % poetry install
4073
```
4174

42-
This keeps all of the `oascomply` dependencies in their own environment,
43-
which you can access with
44-
[`poetry shell`](https://python-poetry.org/docs/cli/#shell). Alternatively,
75+
This keeps all of the `oascomply` dependencies and command line scripts
76+
in their own environment, which you can access with
77+
[`poetry shell`](https://python-poetry.org/docs/cli/#shell) from either
78+
a Posix/Linux/Max OS X shell or from Windows Powershell. Alternatively,
4579
you can prefix each command that you want to run with
4680
[`poetry run`](https://python-poetry.org/docs/cli/#run), e.g.:
4781

4882
```ShellSession
49-
oascomply % poetry run python oascomply -h
83+
~/src/oascomply % poetry run python oascomply -h
84+
usage: oascomply [-h] [-f FILE [URI] [TYPE]] [-d DIRECTORY URI_PREFIX]
85+
[-D DIRECTORY [URI_PREFIX]] [-x [{auto,true,false}]] [-n]
86+
[-e {true,false}] [-i]
87+
[-o [nt | ttl | n3 | trig | json-ld | xml | hext | ...]]
88+
[-O OUTPUT_FILE] [-t {none}] [-v] [--test-mode]
89+
90+
optional arguments:
91+
-h, --help show this help message and exit
92+
...
5093
```
5194

5295
Note that all `poetry` commands need to be run from inside
@@ -56,8 +99,41 @@ directories for a `pyproject.toml` file. Otherwise you will
5699
see an error like this:
57100

58101
```ShellSession
59-
src % poetry run python oascomply -h
102+
~/src/src % poetry run python oascomply -h
60103

61104
Poetry could not find a pyproject.toml file in /Users/someone/src or its parents
62105
```
63106

107+
However, if you use `poetry shell` you can work from any directory within that shell session:
108+
109+
```ShellSession
110+
~/src/oascomply % poetry shell
111+
Spawning shell within /Users/handrews/Library/Caches/pypoetry/virtualenvs/oascomply-4cBi6hCb-py3.8
112+
(oascomply-py3.8) ~/src/oascomply % emulate bash -c '. /Users/handrews/Library/Caches/pypoetry/virtualenvs/oascomply-4cBi6hCb-py3.8/bin/activate'
113+
(oascomply-py3.8) ~/src/oascomply % cd ..
114+
(oascomply-py3.8) ~/src % which oascomply
115+
/Users/handrews/Library/Caches/pypoetry/virtualenvs/oascomply-4cBi6hCb-py3.8/bin/oascomply
116+
```
117+
118+
You can leave the `poetry` sub-shell with `exit`:
119+
120+
```ShellSession
121+
(oascomply-py3.8) ~/src % exit
122+
123+
Saving session...
124+
...saving history...truncating history files...
125+
...completed.
126+
```
127+
~/src %
128+
```
129+
130+
### Installing with `pip -e .`
131+
132+
It is possible to install `oascomply` in development mode using `pip -e .`,
133+
optionally in a virtual environment that you have set up with `venv` or some
134+
other tool. Note that since `pip` only understands `pyrproject.toml` and
135+
not `poetry`'s `poetry.lock` file, you may get slightly different versions
136+
of some libraries.
137+
138+
If reporting a bug from a `pip`-intalled set-up, please verify your installed
139+
library versions against `poetry.lock` first.

0 commit comments

Comments
 (0)