You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,20 @@ Once you have verified that you system matches the base requirements you can sta
33
33
- If you don't have autoenv set-up, run `source .env` to set up the local environment. You will need to run this script every time you want to work on the project - though it will not cause the entire set up process to re-occur.
34
34
4. Run `test` to verify your everything is set up correctly. If the tests all pass, you have successfully set up hug for local development! If not, you can ask for help diagnosing the error [here](https://gitter.im/timothycrosley/hug).
35
35
36
+
At step 3, you can skip using autoenv and the `.env` script,
37
+
and create your development virtul environment manually instead
38
+
using e.g. [`python3 -m venv`](https://docs.python.org/3/library/venv.html)
39
+
or `mkvirtualenv` (from [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/)).
40
+
41
+
Install dependencies by running `pip install -r requirements/release.txt`,
42
+
and optional build or development dependencies
43
+
by running `pip install -r requirements/build.txt`
44
+
or `pip install -r requirements/build.txt`.
45
+
46
+
Install Hug itself with `pip install .` or `pip install -e .` (for editable mode).
47
+
This will compile all modules with [Cython](https://cython.org/) if it's installed in the environment.
48
+
You can skip Cython compilation using `pip install --without-cython .` (this works with `-e` as well).
49
+
36
50
Making a contribution
37
51
=========
38
52
Congrats! You're now ready to make a contribution! Use the following as a guide to help you reach a successful pull-request:
Or, to specify an output_format for a specific endpoint, simply specify the output format within its router:
16
+
By default, this only applies to the output format of HTTP responses.
17
+
To change the output format of the command line interface:
18
+
19
+
@hug.default_output_format(cli=True, http=False)
20
+
def my_output_formatter(data, request, response):
21
+
# Custom output formatting code
22
+
23
+
To specify an output_format for a specific endpoint, simply specify the output format within its router:
17
24
18
25
@hug.get(output=hug.output_format.html)
19
26
def my_endpoint():
@@ -42,6 +49,29 @@ Finally, an output format may be a collection of different output formats that g
42
49
43
50
In this case, if the endpoint is accessed via my_endpoint.js, the output type will be JSON; however if it's accessed via my_endoint.html, the output type will be HTML.
44
51
52
+
You can also change the default output format globally for all APIs with either:
0 commit comments