Skip to content

Commit 1199b44

Browse files
committed
update test and readme
1 parent 5522f1a commit 1199b44

13 files changed

Lines changed: 88 additions & 12 deletions

README.rst

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,22 @@ Example Usage
151151

152152
**NOTE**:
153153

154-
``uszipcode`` has two backend database, ``SimpleZipcode`` and ``Zipcode``. ``Zipcode`` has more info, but the database file is 450MB (takes more time to download). ``SimpleZipcode`` doesn't has all data points listed above, but the database file is smaller (9MB). By default ``uszipcode`` use ``SimpleZipcode``. You can use this code to choose to use the rich info ``Zipcode``::
154+
``uszipcode`` has two backend database, ``SimpleZipcode`` and ``Zipcode``. ``Zipcode`` has more info, but the database file is 450MB (takes more time to download). ``SimpleZipcode`` doesn't has all data points listed above, but the database file is smaller (9MB). By default ``uszipcode`` use ``SimpleZipcode``. You can use this code to choose to use the rich info ``Zipcode``:
155+
156+
.. code-block:: python
155157
156158
>>> from uszipcode import SearchEngine
157159
>>> search = SearchEngine(simple_zipcode=False)
158160
161+
From 0.2.4, ``uszipcode`` **allows developer to choose which directory you want to use to download the database file**. By default, it is ``$HOME/.uszipcode``, but you can easily change it.:
162+
163+
.. code-block:: python
164+
165+
>>> search = SearchENgine(db_file_dir="/tmp")
166+
167+
For example, AWS Lambda doesn't allow to download file to $HOME directory, but allows to download to ``/tmp`` folder.
168+
169+
159170
**Examples**:
160171

161172
.. code-block:: python
@@ -253,6 +264,19 @@ You can **easily sort your results** by any field, or distance from a coordinate
253264
... # do whatever you want...
254265
255266
267+
Deploy Uszipcode as a Web Service
268+
------------------------------------------------------------------------------
269+
270+
If you want to build a private uszipcode API server you have two choice:
271+
272+
1. Use a VM like EC2 machine, and deploy a web api server with the machine.
273+
2. (RECOMMEND) Dump the sqlite database to any relational database like Postgres, MySQL, and inject the database connection info in your application server.
274+
275+
In the feature release, I will provide an easy way that allow you to deploy uszipcode as a private web api service.
276+
277+
Thank you.
278+
279+
256280
.. _install:
257281

258282
Install

release-history.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ Release and Version History
44
==============================================================================
55

66

7-
0.2.3 (TODO)
7+
0.2.5 (TODO)
88
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99
**Features and Improvements**
1010

1111
- Get lat lng and more geo info from Google Geocoding API for **Unique** and **PO Box** zipcode.
12+
- Allow user to dump the data to any relational database easily and use self-hosted database to query.
1213

1314
**Minor Improvements**
1415

@@ -17,6 +18,26 @@ Release and Version History
1718
**Miscellaneous**
1819

1920

21+
0.2.4 (2019-10-16)
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
**Features and Improvements**
24+
25+
- Now you can use ``SearchEngine(..., db_file_dir="/tmp")`` to specify where you want to put your database. By default it is ``${HOME}/.uszipcode``.
26+
27+
**Minor Improvements**
28+
29+
**Bugfixes**
30+
31+
**Miscellaneous**
32+
33+
34+
0.2.3 (2019-10-07)
35+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36+
**Miscellaneous**
37+
38+
- move the default download dir to /tmp folder, so this database can be used in AWS Lambda.
39+
40+
2041
0.2.2 (2018-10-15)
2142
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2243

tests/all.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
if __name__ == "__main__":

tests/pkg/test_fuzzywuzzy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
from uszipcode.pkg.fuzzywuzzy import process

tests/pkg/test_haversine.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
import pytest

tests/search/all.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
if __name__ == "__main__":

tests/search/base.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
from uszipcode.search import SearchEngine
@@ -40,3 +39,15 @@ def setup_class(cls):
4039
@classmethod
4140
def teardown_class(cls):
4241
cls.search.close()
42+
43+
44+
class TestComplexSearchEngineBase(object):
45+
search = None
46+
47+
@classmethod
48+
def setup_class(cls):
49+
cls.search = SearchEngine(simple_zipcode=False)
50+
51+
@classmethod
52+
def teardown_class(cls):
53+
cls.search.close()

tests/search/test_census_data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
import pytest

tests/search/test_search_by_city_and_state.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
import pytest

tests/search/test_search_by_coordinate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
import pytest

0 commit comments

Comments
 (0)