Skip to content

Commit 40f4a61

Browse files
committed
Make targets for a virtualenv
It's common to make a virtualenv inside of your cloned repo to ensure that you have the right enviornment for that repository, and .venv is a common convention for that virtualenv. This adds targets to create and clean a .venv virtual env using the checked-in requirements.txt file. It also adds the .venv to the .gitignore, and updates the README.
1 parent 51326f8 commit 40f4a61

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ jsonschema-*.txt
44
relative-json-pointer.html
55
relative-json-pointer.pdf
66
relative-json-pointer.txt
7+
8+
# For the Python enviornment
9+
.venv

Makefile

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
XML2RFC ?= xml2rfc
2+
VENV ?= .venv
23

34
OUT = \
45
jsonschema-core.html jsonschema-core.txt \
56
jsonschema-validation.html jsonschema-validation.txt \
67
relative-json-pointer.html relative-json-pointer.txt
78

8-
99
all: $(OUT)
1010

1111
%.txt: %.xml
@@ -25,6 +25,16 @@ json-schema.tar.gz: $(OUT)
2525
tar -czf json-schema.tar.gz --exclude '.*' json-schema
2626
rm -rf json-schema
2727

28+
venv: $(VENV)
29+
30+
$(VENV):
31+
python -m venv .venv
32+
. .venv/bin/activate && python -m pip install --upgrade pip setuptools wheel
33+
. .venv/bin/activate && python -m pip install -r requirements.txt
34+
35+
venv-clean:
36+
rm -rf .venv
37+
2838
clean:
2939
rm -f $(OUT) json-schema.tar.gz
3040

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ Labels are assigned based on [Sensible Github Labels](https://github.com/Releque
3535
* links.json - JSON Hyper-Schema's Link Description Object meta-schema
3636
* hyper-schema-output.json - The recommended output format for JSON Hyper-Schema links
3737

38-
Install "xml2rfc" using "pip" (https://pypi.org/project/xml2rfc/) and type "make" at a shell to build the .txt and .html spec files:
38+
The Makefile can create the necessary Python virtual environment for you:
39+
40+
```sh
41+
make venv
42+
source .venv/bin/activate
43+
make
44+
```
45+
46+
Or you can manually install "xml2rfc" using "pip" (https://pypi.org/project/xml2rfc/) and type "make" at a shell to build the .txt and .html spec files:
3947

4048
```sh
4149
pip install --requirement requirements.txt

0 commit comments

Comments
 (0)