Skip to content

Commit 08eb00f

Browse files
author
roll
committed
updated management tools compliant with oki-py
1 parent 812782f commit 08eb00f

21 files changed

+224
-145
lines changed

.coveragerc

-26
This file was deleted.

.travis.yml

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
language: python
1+
sudo:
2+
false
3+
4+
language:
5+
python
6+
27
python:
38
- 2.7
49
- 3.3
510
- 3.4
11+
- 3.5
12+
13+
env:
14+
global:
15+
- TOXENV="py${PYTHON_VERSION//./}"
616

717
install:
8-
- pip install --upgrade -r requirements/base.txt
9-
- pip install --upgrade -r requirements/test.txt
18+
- make develop
1019
- pip install coveralls
1120

1221
script:
13-
- py.test --cov jsontableschema --cov-config .coveragerc --cov-report term-missing
22+
# FIXME: configure linter
23+
# - make lint
24+
- make test
1425

1526
after_success:
1627
- coveralls
28+
29+
deploy:
30+
provider: pypi
31+
user: okfn
32+
on:
33+
tags: true
34+
password:
35+
secure: Iuf7V4+XHL6wwFYt4IyEe0vWLGO/uOpMJWQnO+1eUjmcQ1qi4E9vyEJvsJRzWKm5+/Lv9uFIRGlmpNWQzUPs5VnMc3LEBh7Clv/WIlRGvi+omCeWoEPAPUueF8qjBcvpT37QNzjB5QXJY074uAihmKh/DU2xA4K0yCB8YQefBHYeNBl0pNYVnELUW8BFmz0GE0lTwHOnM681vgR01LdPjrgIHVEvnTZkKYtDXc/cwkw610fqrFS10srnTX6KjjC/pgDm4WSuaUxbPycmriIhZR29QgAx24NO/wrdGdp5H8TIsvBFnNFlC4QuHfwiXdAKpjL6cMu2uMo639Sev/484XxTorg2QQvNhNAJtiESVAaqVviAlmUItGdmsw4xhZb0JK6NC8fOuOoccL4DBD6JtCyGurwSpznuGXh1DQUYZ7fTd5qaUDnzBuhYGc8XDvcj14XU4P5OKES4NdruRVJOwFiNSMOAT6wm8b2Ue6N+FvgsghjwUr9ESKBrPj0VoouC2+FGZWT65vt/3R9PhFuBdC6SgMLWHESBuU5GW9Bc2ucS3HUi+uUV1IGjpfIsc3qifojNJiaU7hSAggJs9QlXd7goH2fKhb9ro2klzcDKmpBLXmMk3uH0QRpv1dGUYFtgGeEFN93vP3cxYsXf8OvV+MuCxYYGgrGZu3h8fvbc5hY=

CONTRIBUTING.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Contributing
2+
3+
The project follows the [Open Knowledge International coding standards](https://github.com/okfn/coding-standards).
4+
5+
## Getting Started
6+
7+
Recommended way to get started is to create and activate a project virtual environment.
8+
To install package and development dependencies into active environment:
9+
10+
```
11+
$ make develop
12+
```
13+
14+
## Linting
15+
16+
To lint the project codebase:
17+
18+
```
19+
$ make lint
20+
```
21+
22+
Under the hood `pylint` configured in `pylintrc` is used. On this stage it's already
23+
installed into your environment and could be used separately with more fine-grained control
24+
as described in documentation - https://www.pylint.org/.
25+
26+
For example to check only errors:
27+
28+
```
29+
$ pylint -E <path>
30+
```
31+
32+
## Testing
33+
34+
To run tests with coverage:
35+
36+
```
37+
$ make test
38+
```
39+
Under the hood `tox` powered by `py.test` and `coverage` configured in `tox.ini` is used.
40+
It's already installed into your environment and could be used separately with more fine-grained control
41+
as described in documentation - https://testrun.org/tox/latest/.
42+
43+
For example to check subset of tests against Python 2 environment with increased verbosity.
44+
All positional arguments and options after `--` will be passed to `py.test`:
45+
46+
```
47+
tox -e py27 -- -v tests/<path>
48+
```

LICENSE LICENSE.md

File renamed without changes.

MANIFEST.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
include LICENSE
1+
global-include VERSION
2+
include LICENSE.md
3+
include Makefile
4+
include pylintrc
25
include README.md
6+
include tox.ini

Makefile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.PHONY: all develop list lint release test version
2+
3+
4+
PACKAGE := $(shell grep '^PACKAGE =' setup.py | cut -d "'" -f2)
5+
VERSION := $(shell head -n 1 $(PACKAGE)/VERSION)
6+
7+
8+
all: list
9+
10+
develop:
11+
pip install --upgrade -e .[develop]
12+
13+
list:
14+
@grep '^\.PHONY' Makefile | cut -d' ' -f2- | tr ' ' '\n'
15+
16+
lint:
17+
pylint $(PACKAGE)
18+
19+
release:
20+
bash -c '[[ -z `git status -s` ]]'
21+
git tag -a -m release $(VERSION)
22+
git push --tags
23+
24+
test:
25+
tox
26+
27+
version:
28+
@echo $(VERSION)

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
A utility library for working with JSON Table Schema in Python.
77

8-
98
## Start
109

1110
```
@@ -71,7 +70,7 @@ Where the option `fail_fast` is given, it will raise the first error it encouter
7170

7271
#### Types
7372

74-
Data values can be cast to native Python objects with a type instance from `jsontableschema.types`.
73+
Data values can be cast to native Python objects with a type instance from `jsontableschema.types`.
7574

7675
Types can either be instantiated directly, or returned from `SchemaModel` instances instantiated with a JSON Table Schema.
7776

@@ -221,7 +220,7 @@ JSON Table Schema features a CLI called `jsontableschema`. This CLI exposes the
221220

222221
The optional argument `--encoding` allows a character encoding to be specified for the data file. The default is utf-8.
223222

224-
See the above [Infer](#infer) section for details. The response is a schema as JSON.
223+
See the above [Infer](#infer) section for details. The response is a schema as JSON.
225224

226225
#### Validate
227226

@@ -230,3 +229,11 @@ See the above [Infer](#infer) section for details. The response is a schema as J
230229
```
231230

232231
The response is...
232+
233+
## Contributing
234+
235+
Please read the contribution guideline:
236+
237+
[How to Contribute](CONTRIBUTING.md)
238+
239+
Thanks!

jsontableschema/VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.5.1

jsontableschema/cli.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313

1414

1515
DIR = os.path.abspath(os.path.dirname(__file__))
16-
INFO = 'info.json'
17-
INFO_PATH = os.path.join(DIR, INFO)
18-
19-
with io.open(INFO_PATH, mode='r+t', encoding='utf-8') as stream:
20-
info_data = json.loads(stream.read())
16+
VERSION_FILE = os.path.join(os.path.dirname(__file__), 'VERSION')
17+
VERSION = io.open(VERSION_FILE, encoding='utf-8').read().strip()
2118

2219

2320
@click.group()
@@ -28,7 +25,7 @@ def main():
2825
@main.command()
2926
def info():
3027
"""Return info on this version of JSON Table Schema"""
31-
click.echo(json.dumps(info_data, ensure_ascii=False, indent=4))
28+
click.echo(json.dumps({'version': VERSION}, ensure_ascii=False, indent=4))
3229

3330

3431
@main.command()

jsontableschema/info.json

-11
This file was deleted.

publish.sh

-2
This file was deleted.

pylintrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[BASIC]
2+
3+
# List of builtins function names that should not be used, separated by a comma.
4+
bad-functions=map,filter,input,open
5+
6+
[FORMAT]
7+
8+
# Maximum number of characters on a single line.
9+
max-line-length=79
10+
11+
[MESSAGES CONTROL]
12+
13+
# Allow modules to be without docstrings.
14+
disable=C0111

requirements.txt

-1
This file was deleted.

requirements/base.txt

-6
This file was deleted.

requirements/local.txt

-3
This file was deleted.

requirements/test.txt

-4
This file was deleted.

setup.cfg

-2
This file was deleted.

0 commit comments

Comments
 (0)