Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Migrate to python3 🐍 #68

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2
jobs:
build:
docker:
- image: udata/circleci
- image: udata/circleci:py3
- image: mongo:3.2
- image: redis
- image: udata/elasticsearch:2.4.5
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
- run:
name: Install python dependencies
command: |
virtualenv venv
virtualenv -ppython3.6 venv
source venv/bin/activate
# Workaround to bad transitive dependencies resolution:
# Install package first then all other dependencies
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:

publish:
docker:
- image: udata/circleci
- image: udata/circleci:py3
steps:
- attach_workspace:
at: .
Expand All @@ -98,7 +98,7 @@ jobs:

github:
docker:
- image: udata/circleci
- image: udata/circleci:py3
environment:
BASH_ENV: /root/.bashrc
steps:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Current (in progress)

- Nothing yet
- Migrate to python3 🐍 [#68](https://github.com/opendatateam/udata-piwik/pull/68)

## 1.3.1 (2018-11-05)

Expand Down
2 changes: 1 addition & 1 deletion requirements/install.pip
Original file line number Diff line number Diff line change
@@ -1 +1 @@
udata>=1.6.1
udata>=2.0.0.dev
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import re
Expand Down Expand Up @@ -102,7 +101,7 @@ def pip(filename):

setup(
name='udata-piwik',
version='1.3.2.dev',
version='2.0.0.dev',
description='Piwik support for uData',
long_description=long_description,
url='https://github.com/opendatateam/udata-piwik',
Expand Down Expand Up @@ -137,8 +136,8 @@ def pip(filename):
'Intended Audience :: Developers',
'Topic :: System :: Software Distribution',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
3 changes: 0 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

import os

from invoke import task, call
Expand Down
3 changes: 0 additions & 3 deletions tests/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from datetime import datetime

import requests
Expand Down
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os

from udata.settings import Testing
Expand Down
3 changes: 0 additions & 3 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import pytest

from datetime import date, timedelta
Expand Down
3 changes: 0 additions & 3 deletions tests/test_piwik.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import pytest

from datetime import date, datetime, timedelta
Expand Down
2 changes: 0 additions & 2 deletions udata_piwik/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
3 changes: 0 additions & 3 deletions udata_piwik/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging
import requests

Expand Down
3 changes: 0 additions & 3 deletions udata_piwik/commands.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging

import click
Expand Down
3 changes: 0 additions & 3 deletions udata_piwik/counter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging

from werkzeug.exceptions import NotFound
Expand Down
3 changes: 0 additions & 3 deletions udata_piwik/download_counter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging
import re
import uuid
Expand Down
7 changes: 2 additions & 5 deletions udata_piwik/metrics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import itertools
import logging

Expand Down Expand Up @@ -111,15 +108,15 @@ def aggregate_reuses_daily(org, day):

def upsert_metric_for_day(obj, day, data):
oid = obj.id if hasattr(obj, 'id') else obj
if not isinstance(day, basestring):
if not isinstance(day, str):
day = (day or date.today()).isoformat()
commands = dict(('inc__values__{0}'.format(k), data[k]) for k in KEYS)
metrics = Metrics.objects(object_id=oid, level='daily', date=day)
return metrics.update_one(upsert=True, **commands)


def clear_metrics_for_day(day):
if not isinstance(day, basestring):
if not isinstance(day, str):
day = (day or date.today()).isoformat()
commands = dict(('unset__values__{0}'.format(k), 1) for k in KEYS)
metrics = Metrics.objects(level='daily', date=day)
Expand Down
3 changes: 0 additions & 3 deletions udata_piwik/tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging
from datetime import date, timedelta

Expand Down
5 changes: 1 addition & 4 deletions udata_piwik/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from datetime import date

from flask import _app_ctx_stack
Expand Down Expand Up @@ -39,7 +36,7 @@ def route_from(url, method=None):

def is_today(day):
today = date.today()
if isinstance(day, basestring):
if isinstance(day, str):
return day == today.isoformat()
else:
return day == today
3 changes: 0 additions & 3 deletions udata_piwik/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from flask import render_template, Blueprint
from jinja2 import contextfunction

Expand Down