Skip to content

Commit 52d37bb

Browse files
committed
Updated README
1 parent 97302bd commit 52d37bb

File tree

4 files changed

+61
-25
lines changed

4 files changed

+61
-25
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; This is an ini style configuration. See http://editorconfig.org/ for more information on this file.
2+
3+
root = true
4+
5+
[*]
6+
end_of_line = lf
7+
charset = utf-8
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.py]
12+
indent_style = space
13+
indent_size = 4

CONTRIBUTING.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ Contributing
33
===============================================================================
44

55

6-
TODO
6+
In a nutshell:
7+
8+
- follow `PEP8 style guide <https://www.python.org/dev/peps/pep-0008/>` with **double quotes** and
9+
line length of **100 characters (or 120 if absolutely nescessary)**
10+
- before push, run with :code:`python3 setup.py test`, then ensure **all tests are passing** and
11+
**the coverage is above 95%**

README.rst

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,26 @@ Installation
3030

3131
Stable version - using pip:
3232

33-
.. code:: bash
33+
.. code-block:: bash
3434
3535
pip install pycaching
3636
3737
Dev version - manually from GIT:
3838

39-
.. code:: bash
39+
.. code-block:: bash
4040
4141
git clone https://github.com/tomasbedrich/pycaching.git
42-
pip install ./pycaching
42+
cd pycaching
43+
pip install .
4344
4445
Pycaching has following requirements:
4546

4647
.. code::
4748
48-
Python>=3.4
49-
requests >= 2.8
50-
beautifulsoup4 >= 4.4
51-
geopy>=1.11
49+
Python>=3.4
50+
requests>=2.8
51+
beautifulsoup4>=4.4
52+
geopy>=1.11
5253
5354
5455
Examples
@@ -57,9 +58,9 @@ Examples
5758
Login
5859
---------------------------------------------------------------------------------------------------
5960

60-
Simly call ``pycaching.login`` method and it will do all things for you.
61+
Simly call :meth:`.login` method and it will do all things for you.
6162

62-
.. code:: python
63+
.. code-block:: python
6364
6465
import pycaching
6566
geocaching = pycaching.login("user", "pass")
@@ -69,27 +70,27 @@ If you won't provide an username or password, pycaching will try to load
6970
parse it as JSON and use the keys ``username`` and ``password`` from that file
7071
as login credentials.
7172

72-
.. code:: python
73+
.. code-block:: python
7374
7475
import pycaching
7576
geocaching = pycaching.login() # assume the .gc_credentials file is presented
7677
7778
Load a cache details
7879
---------------------------------------------------------------------------------------------------
7980

80-
.. code:: python
81+
.. code-block:: python
8182
8283
cache = geocaching.get_cache("GC1PAR2")
8384
print(cache.name) # cache.load() is automatically called
8485
print(cache.location) # stored in cache, printed immediately
8586
86-
This uses lazy loading, so the ``Cache`` object is created immediately and the
87+
This uses lazy loading, so the :class:`.Cache` object is created immediately and the
8788
page is loaded when needed (accessing the name).
8889

8990
You can use different method of loading cache details. It will be much faster,
9091
but it will load less details:
9192

92-
.. code:: python
93+
.. code-block:: python
9394
9495
cache = geocaching.get_cache("GC1PAR2")
9596
cache.load_quick() # takes a small while
@@ -98,32 +99,32 @@ but it will load less details:
9899
99100
You can also load a logbook for cache:
100101

101-
.. code:: python
102+
.. code-block:: python
102103
103104
for log in cache.load_logbook(limit=200):
104105
print(log.visited, log.type, log.author, log.text)
105106
106107
Or its trackables:
107108

108-
.. code:: python
109+
.. code-block:: python
109110
110111
for trackable in cache.load_trackables(limit=5):
111112
print(trackable.name)
112113
113114
Post a log to cache
114115
---------------------------------------------------------------------------------------------------
115116

116-
.. code:: python
117+
.. code-block:: python
117118
118119
geocaching.post_log("GC1PAR2", "Found cache in the rain. Nice place, TFTC!")
119120
120-
It is also possible to call post_log on ``Cache`` object, but you would have
121-
to create ``Log`` object manually and pass it to this method.
121+
It is also possible to call post_log on :class:`.Cache` object, but you would have
122+
to create :class:`.Log` object manually and pass it to this method.
122123

123124
Search for all traditional caches around
124125
---------------------------------------------------------------------------------------------------
125126

126-
.. code:: python
127+
.. code-block:: python
127128
128129
from pycaching import Point
129130
from pycaching.cache import Type
@@ -134,14 +135,14 @@ Search for all traditional caches around
134135
if cache.type == Type.traditional:
135136
print(cache.name)
136137
137-
Notice the ``limit`` in search function. It is because ``search()``
138+
Notice the ``limit`` in search function. It is because :meth:`.Geocaching.search`
138139
returns a generator object, which would fetch the caches forever in case
139140
of simple loop.
140141

141142
Geocode adress and search around
142143
---------------------------------------------------------------------------------------------------
143144

144-
.. code:: python
145+
.. code-block:: python
145146
146147
point = geocaching.geocode("Prague")
147148
@@ -151,7 +152,7 @@ Geocode adress and search around
151152
Find caches with their approximate locations in some area
152153
---------------------------------------------------------------------------------------------------
153154

154-
.. code:: python
155+
.. code-block:: python
155156
156157
from pycaching import Point, Rectangle
157158
@@ -164,7 +165,7 @@ Find caches with their approximate locations in some area
164165
Load a trackable details
165166
---------------------------------------------------------------------------------------------------
166167

167-
.. code:: python
168+
.. code-block:: python
168169
169170
trackable = geocaching.get_trackable("TB3ZGT2")
170171
print(trackable.name, trackable.goal, trackable.description, trackable.location)

setup.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
import os
44
from setuptools import setup
5+
from setuptools.command.test import test as TestCommand
6+
7+
8+
# see http://fgimian.github.io/blog/2014/04/27/running-nose-tests-with-plugins-using-the-python-setuptools-test-command
9+
class NoseTestCommand(TestCommand):
10+
11+
def finalize_options(self):
12+
TestCommand.finalize_options(self)
13+
self.test_args = []
14+
self.test_suite = True
15+
16+
def run_tests(self):
17+
# Run nose ensuring that argv simulates running nosetests directly
18+
import nose
19+
nose.run_exit(argv=["nosetests", "--with-coverage", "--cover-package=pycaching"])
20+
521

622
root = os.path.dirname(__file__) or "."
723
f = open(os.path.join(root, "README.rst"))
@@ -20,7 +36,8 @@
2036
"long_description": long_description,
2137
"keywords": ["geocaching", "crawler", "geocache", "cache", "search", "geocode", "travelbug"],
2238
"install_requires": ["requests >= 2.8", "beautifulsoup4 >= 4.4", "geopy >= 1.11"],
23-
"test_suite": "test"
39+
"setup_requires": ["nose >= 1.3", "flake8 >= 2.4.0", "coverage >= 3.7"],
40+
"cmdclass": {"test": NoseTestCommand},
2441
}
2542

2643
setup(**info)

0 commit comments

Comments
 (0)