Skip to content

Commit a3096ed

Browse files
committed
Code cleaning for Pypi release & Docker updates
1 parent 7131c24 commit a3096ed

7 files changed

Lines changed: 30 additions & 11 deletions

File tree

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
mepcheck.egg-info
22
dist
3+
build
4+
.cache
5+
.git
36
.coverage
47
.gitignore
58
.travis.yml
69
README.md
10+
pypack.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ mepcheck.egg-info/
77
.coverage
88
.meps
99
.cache/
10+
*.sh

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ WORKDIR /mepcheck/mepcheck
66
RUN pip install -r ../requirements.txt &&\
77
pip install ../.
88

9-
ENTRYPOINT ["python", "mepcheck.py"]
9+
ENTRYPOINT ["python", "../mepcheck_docker.py"]

mepcheck/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .mepcheck import get_meps, EUvotes
2-
from . import savemeps
2+
from .savemeps import save_meps
33

4-
__all__ = ["EUvotes", "get_meps", "savemeps"]
4+
__all__ = ["EUvotes", "get_meps", "save_meps"]

mepcheck/mepcheck.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from prettytable import PrettyTable
99
import requests
1010
import os
11+
from .savemeps import save_meps
1112

1213
url = 'http://www.votewatch.eu/actions.php?euro_parlamentar_id={}&form_category=get_mep_acte&sEcho=1&iColumns=6&sColumns=&iDisplayStart=0&iDisplayLength={}&mDataProp_0=mysql_data&mDataProp_1=act_nume_full&mDataProp_2=euro_vot_valoare_special_vote_page&mDataProp_3=euro_vot_rol_euro_grup.rol_af&mDataProp_4=euro_domeniu_nume&mDataProp_5=euro_vot_valoare_text&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&iSortingCols=1&iSortCol_0=0&sSortDir_0=desc&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&bSortable_5=true&_=1486840527483'
1314

@@ -44,8 +45,7 @@ def get_meps(country=None):
4445
t.add_row([country.title()])
4546
print(t)
4647
else:
47-
import savemeps
48-
savemeps.save_meps()
48+
save_meps()
4949
get_meps(country)
5050

5151
class EUvotes(object):
@@ -70,7 +70,6 @@ def __init__(self, mep_id, limit=50):
7070
"""When launching initialization use given data
7171
to retrieve all interesting info from Votewatch.eu
7272
automatically.
73-
7473
"""
7574
self.mep_id = abs(mep_id)
7675
self.limit = abs(limit)
@@ -85,9 +84,14 @@ def __str__(self):
8584

8685
def _mep_name(self, mep_id):
8786
"""Get searched MEP name"""
88-
with open(os.path.expanduser("~/.meps"), 'rb') as f:
89-
meps = pickle.load(f)
90-
return meps[abs(mep_id) - 1][1]
87+
meps_path = os.path.expanduser("~/.meps")
88+
if os.path.isfile(meps_path):
89+
with open(os.path.expanduser(meps_path), 'rb') as f:
90+
meps = pickle.load(f)
91+
return meps[abs(mep_id) - 1][1]
92+
else:
93+
save_meps()
94+
self._mep_name(mep_id)
9195

9296
def _get_votes(self, mep_id, limit):
9397
"""Get last `limit` votes for requested MEP"""

mepcheck_docker.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from mepcheck import mepcheck_cli
2+
mepcheck_cli.cli()

setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
from setuptools import setup
22

33
setup(name="mepcheck",
4-
version="0.1",
4+
version="0.0.2",
55
description="Retrieve voting data for all MEPs and return them in a structured way",
66
url="https://github.com/alanmarazzi/mepcheck",
77
author="Alan Marazzi",
88
author_email="alan.marazzi@gmail.com",
99
license="MIT",
1010
packages=["mepcheck"],
11+
install_requires=[
12+
"beautifulsoup4",
13+
"prettytable",
14+
"requests"
15+
],
1116
zip_safe=False,
1217
download_url='https://github.com/alanmarazzi/mepcheck/archive/master.zip',
1318
keywords=['voting', 'data', 'mep'],
1419
classifiers=[
15-
'Programming Language :: Python :: 3'
20+
'Programming Language :: Python :: 3',
21+
'Programming Language :: Python :: 3.4',
22+
'Programming Language :: Python :: 3.5',
23+
'Programming Language :: Python :: 3.6'
1624
])

0 commit comments

Comments
 (0)