Skip to content

Commit 8f71844

Browse files
Merge pull request #810 from hugapi/develop
2.5.5 Release
2 parents 3f51f0d + ddcc792 commit 8f71844

29 files changed

+247
-67
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.5.4
2+
current_version = 2.5.5
33

44
[bumpversion:file:.env]
55

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
root = true
22

33
[*.py]
4-
max_line_length = 120
4+
max_line_length = 100
55
indent_style = space
66
indent_size = 4
77
ignore_frosted_errors = E103
8-
skip = runtests.py,build
9-
balanced_wrapping = true
10-
not_skip = __init__.py

.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.5.4"
14+
export PROJECT_VERSION="2.5.5"
1515

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

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*.egg-info
99
build
1010
eggs
11+
.eggs
1112
parts
1213
var
1314
sdist
@@ -73,3 +74,6 @@ venv/
7374

7475
# Emacs backup
7576
*~
77+
78+
# VSCode
79+
/.vscode

.isort.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[settings]
2+
multi_line_output=3
3+
include_trailing_comma=True
4+
force_grid_wrap=0
5+
use_parentheses=True
6+
line_length=100

.travis.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,27 @@ matrix:
2020
- os: linux
2121
sudo: required
2222
python: 3.7
23-
env: TOXENV=py37-marshmallow2
23+
env: TOXENV=py37-marshmallow3
24+
- os: linux
25+
sudo: required
26+
python: 3.7
27+
env: TOXENV=py37-black
28+
- os: linux
29+
sudo: required
30+
python: 3.7
31+
env: TOXENV=py37-flake8
32+
- os: linux
33+
sudo: required
34+
python: 3.7
35+
env: TOXENV=py37-bandit
36+
- os: linux
37+
sudo: required
38+
python: 3.7
39+
env: TOXENV=py37-vulture
40+
- os: linux
41+
sudo: required
42+
python: 3.7
43+
env: TOXENV=py37-isort
2444
- os: linux
2545
sudo: required
2646
python: pypy3.5-6.0

ACKNOWLEDGEMENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Documenters
8484
- Joshua Crowgey (@jcrowgey)
8585
- Antti Kaihola (@akaihola)
8686
- Simon Ince (@Simon-Ince)
87+
- Edvard Majakari (@EdvardM)
88+
8789

8890

8991
--------------------------------------------

CHANGELOG.md

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

1212
Changelog
1313
=========
14+
### 2.5.5 - June 13, 2019
15+
- Fixed issue #808: Problems with command line invocation via hug CLI
16+
- Fixed issue #647: Support for arbitrary URL complexity when using CORS middleware
17+
- Fixed issue #805: Added documentation for `map_params` feature
18+
- Added initial automated code cleaning and linting partially satisfying [HOPE-8 -- Style Guideline for Hug](https://github.com/hugapi/HOPE/blob/master/all/HOPE-8--Style-Guide-for-Hug-Code.md#hope-8----style-guide-for-hug-code)
19+
- Implemented [HOPE-20 -- The Zen of Hug](https://github.com/hugapi/HOPE/blob/master/all/HOPE-20--The-Zen-of-Hug.md)
20+
1421
### 2.5.4 hotfix - May 19, 2019
1522
- Fix issue #798 - Development runner `TypeError` when executing cli
1623

Pipfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
8+
[dev-packages]
9+
10+
[requires]
11+
python_version = "3.7"

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ As a result of these goals, hug is Python 3+ only and built upon [Falcon's](http
2525

2626
[![HUG Hello World Example](https://raw.github.com/hugapi/hug/develop/artwork/example.gif)](https://github.com/hugapi/hug/blob/develop/examples/hello_world.py)
2727

28-
2928
Installing hug
3029
===================
3130

@@ -37,9 +36,9 @@ pip3 install hug --upgrade
3736

3837
Ideally, within a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/).
3938

40-
4139
Getting Started
4240
===================
41+
4342
Build an example API with a simple endpoint in just a few lines.
4443

4544
```py
@@ -118,7 +117,6 @@ Then you can access the example from `localhost:8000/v1/echo?text=Hi` / `localho
118117

119118
Note: versioning in hug automatically supports both the version header as well as direct URL based specification.
120119

121-
122120
Testing hug APIs
123121
===================
124122

@@ -141,7 +139,6 @@ def tests_happy_birthday():
141139
assert response.data is not None
142140
```
143141

144-
145142
Running hug with other WSGI based servers
146143
===================
147144

@@ -155,7 +152,6 @@ uwsgi --http 0.0.0.0:8000 --wsgi-file examples/hello_world.py --callable __hug_w
155152

156153
To run the hello world hug example API.
157154

158-
159155
Building Blocks of a hug API
160156
===================
161157

@@ -182,7 +178,6 @@ def math(number_1:int, number_2:int): #The :int after both arguments is the Type
182178
Type annotations also feed into `hug`'s automatic documentation
183179
generation to let users of your API know what data to supply.
184180

185-
186181
**Directives** functions that get executed with the request / response data based on being requested as an argument in your api_function.
187182
These apply as input parameters only, and can not be applied currently as output formats or transformations.
188183

@@ -242,7 +237,6 @@ def hello():
242237

243238
as shown, you can easily change the output format for both an entire API as well as an individual API call
244239

245-
246240
**Input Formatters** a function that takes the body of data given from a user of your API and formats it for handling.
247241

248242
```py
@@ -253,7 +247,6 @@ def my_input_formatter(data):
253247

254248
Input formatters are mapped based on the `content_type` of the request data, and only perform basic parsing. More detailed parsing should be done by the Type Annotations present on your `api_function`
255249

256-
257250
**Middleware** functions that get called for every request a hug API processes
258251

259252
```py
@@ -272,6 +265,18 @@ You can also easily add any Falcon style middleware using:
272265
__hug__.http.add_middleware(MiddlewareObject())
273266
```
274267

268+
**Parameter mapping** can be used to override inferred parameter names, eg. for reserved keywords:
269+
270+
```py
271+
import marshmallow.fields as fields
272+
...
273+
274+
@hug.get('/foo', map_params={'from': 'from_date'}) # API call uses 'from'
275+
def get_foo_by_date(from_date: fields.DateTime()):
276+
return find_foo(from_date)
277+
```
278+
279+
Input formatters are mapped based on the `content_type` of the request data, and only perform basic parsing. More detailed parsing should be done by the Type Annotations present on your `api_function`
275280

276281
Splitting APIs over multiple files
277282
===================
@@ -314,7 +319,6 @@ Or alternatively - for cases like this - where only one module is being included
314319
hug.API(__name__).extend(something, '/something')
315320
```
316321

317-
318322
Configuring hug 404
319323
===================
320324

@@ -346,14 +350,14 @@ def not_found_handler():
346350
return "Not Found"
347351
```
348352

349-
350353
Asyncio support
351354
===============
352355

353356
When using the `get` and `cli` method decorator on coroutines, hug will schedule
354357
the execution of the coroutine.
355358

356359
Using asyncio coroutine decorator
360+
357361
```py
358362
@hug.get()
359363
@asyncio.coroutine
@@ -362,6 +366,7 @@ def hello_world():
362366
```
363367

364368
Using Python 3.5 async keyword.
369+
365370
```py
366371
@hug.get()
367372
async def hello_world():
@@ -371,9 +376,9 @@ async def hello_world():
371376
NOTE: Hug is running on top Falcon which is not an asynchronous server. Even if using
372377
asyncio, requests will still be processed synchronously.
373378

374-
375379
Using Docker
376380
===================
381+
377382
If you like to develop in Docker and keep your system clean, you can do that but you'll need to first install [Docker Compose](https://docs.docker.com/compose/install/).
378383

379384
Once you've done that, you'll need to `cd` into the `docker` directory and run the web server (Gunicorn) specified in `./docker/gunicorn/Dockerfile`, after which you can preview the output of your API in the browser on your host machine.
@@ -413,7 +418,6 @@ bash-4.3# tree
413418
1 directory, 3 files
414419
```
415420

416-
417421
Why hug?
418422
===================
419423

0 commit comments

Comments
 (0)