Skip to content

Commit 9758507

Browse files
Merge pull request #836 from hugapi/develop
2.6.1 Release
2 parents 2e240cf + 16aa0a3 commit 9758507

19 files changed

+67
-21
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.6.0
2+
current_version = 2.6.1
33

44
[bumpversion:file:.env]
55

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111

1212
export PROJECT_NAME=$OPEN_PROJECT_NAME
1313
export PROJECT_DIR="$PWD"
14-
export PROJECT_VERSION="2.6.0"
14+
export PROJECT_VERSION="2.6.1"
1515

1616
if [ ! -d "venv" ]; then
1717
if ! hash pyvenv 2>/dev/null; then

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ matrix:
99
- os: linux
1010
sudo: required
1111
python: 3.6
12+
- os: linux
13+
sudo: required
14+
python: 3.8
1215
- os: linux
1316
sudo: required
1417
python: 3.7

ACKNOWLEDGEMENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Code Contributors
5252
- Lordran (@xzycn)
5353
- Stephan Fitzpatrick (@knowsuchagency)
5454
- Edvard Majakari (@EdvardM)
55+
- Sai Charan (@mrsaicharan1)
5556

5657
Documenters
5758
===================

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Ideally, within a virtual environment.
1111

1212
Changelog
1313
=========
14+
### 2.6.1 - February 6, 2019
15+
- Fixed issue #834: Bug in some cases when introspecting local documentation.
16+
1417
### 2.6.0 - August 29, 2019
1518
- Improved CLI multiple behaviour with empty defaults
1619
- Improved CLI type output for built-in types

FAQ.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ For more examples, check out Hug's [documentation](https://github.com/timothycro
66

77
Q: *Can I use Hug with a web framework -- Django for example?*
88

9-
A: You can use Hug alongside Django or the web framework of your choice, but it does have drawbacks. You would need to run hug on a separate, hug-exclusive server. You can also [mount Hug as a WSGI app](https://pythonhosted.org/django-wsgi/embedded-apps.html), embedded within your normal Django app.
9+
A: You can use Hug alongside Django or the web framework of your choice, but it does have drawbacks. You would need to run hug on a separate, hug-exclusive server. You can also [mount Hug as a WSGI app](https://pythonhosted.org/django-wsgi/embedded-apps.html), embedded within your normal Django app.
1010

1111
Q: *Is Hug compatabile with Python 2?*
1212

13-
A: Python 2 is not supported by Hug. However, if you need to account for backwards compatability, there are workarounds. For example, you can wrap the decorators:
13+
A: Python 2 is not supported by Hug. However, if you need to account for backwards compatability, there are workarounds. For example, you can wrap the decorators:
1414

15-
```Python
15+
```Python
1616
def my_get_fn(func, *args, **kwargs):
1717
if 'hug' in globals():
1818
return hug.get(func, *args, **kwargs)
@@ -29,7 +29,7 @@ Q: *How can I serve static files from a directory using Hug?*
2929

3030
A: For a static HTML page, you can just set the proper output format as: `output=hug.output_format.html`. To see other examples, check out the [html_serve](https://github.com/timothycrosley/hug/blob/develop/examples/html_serve.py) example, the [image_serve](https://github.com/timothycrosley/hug/blob/develop/examples/image_serve.py) example, and the more general [static_serve](https://github.com/timothycrosley/hug/blob/develop/examples/static_serve.py) example within `hug/examples`.
3131

32-
Most basic examples will use a format that looks something like this:
32+
Most basic examples will use a format that looks something like this:
3333

3434
```Python
3535
@hug.static('/static')
@@ -50,15 +50,15 @@ A: You can access a list of your routes by using the routes object on the HTTP A
5050

5151
`__hug_wsgi__.http.routes`
5252

53-
It will return to you a structure of "base_url -> url -> HTTP method -> Version -> Python Handler". Therefore, for example, if you have no base_url set and you want to see the list of all URLS, you could run:
53+
It will return to you a structure of "base_url -> url -> HTTP method -> Version -> Python Handler". Therefore, for example, if you have no base_url set and you want to see the list of all URLS, you could run:
5454

5555
`__hug_wsgi__.http.routes[''].keys()`
5656

5757
Q: *How can I configure a unique 404 route?*
5858

5959
A: By default, Hug will call `documentation_404()` if no HTTP route is found. However, if you want to configure other options (such as routing to a directiory, or routing everything else to a landing page) you can use the `@hug.sink('/')` decorator to create a "catch-all" route:
6060

61-
```Python
61+
```Python
6262
import hug
6363

6464
@hug.sink('/all')
@@ -67,3 +67,23 @@ def my_sink(request):
6767
```
6868

6969
For more information, check out the ROUTING.md file within the `hug/documentation` directory.
70+
71+
Q: *How can I enable CORS*
72+
73+
A: There are many solutions depending on the specifics of your application.
74+
For most applications, you can use the included cors middleware:
75+
76+
```
77+
import hug
78+
79+
api = hug.API(__name__)
80+
api.http.add_middleware(hug.middleware.CORSMiddleware(api, max_age=10))
81+
82+
83+
@hug.get("/demo")
84+
def get_demo():
85+
return {"result": "Hello World"}
86+
```
87+
For cases that are more complex then the middleware handles
88+
89+
[This comment](https://github.com/hugapi/hug/issues/114#issuecomment-342493165) (and the discussion around it) give a good starting off point.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://pypi.python.org/pypi/hug/)
99
[![Join the chat at https://gitter.im/timothycrosley/hug](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/timothycrosley/hug?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1010

11-
NOTE: For more in-depth documentation visit [hug's website](http://www.hug.rest)
11+
_________________
12+
13+
[Read Latest Documentation](https://hugapi.github.io/hug/) - [Browse GitHub Code Repository](https://github.com/hugapi/hug)
14+
_________________
1215

1316
hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a result, it drastically simplifies Python API development.
1417

examples/cli_multiple.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import hug
22

3+
34
@hug.cli()
4-
def add(numbers: list=None):
5+
def add(numbers: list = None):
56
return sum([int(number) for number in numbers])
67

78

examples/matplotlib/plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
@hug.get(output=hug.output_format.png_image)
88
def plot():
99
pyplot.plot([1, 2, 3, 4])
10-
pyplot.ylabel('some numbers')
10+
pyplot.ylabel("some numbers")
1111

1212
image_output = io.BytesIO()
13-
pyplot.savefig(image_output, format='png')
13+
pyplot.savefig(image_output, format="png")
1414
image_output.seek(0)
1515
return image_output
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Pillow==6.0.0
1+
Pillow==6.2.0

0 commit comments

Comments
 (0)