Skip to content

Commit

Permalink
Move to asyncio for speed
Browse files Browse the repository at this point in the history
  • Loading branch information
oscgonfer committed Oct 23, 2023
1 parent 3a66949 commit 0fc7b3f
Show file tree
Hide file tree
Showing 16 changed files with 709 additions and 904 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install .
- name: Test with pytest
run: |
pytest
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Archive artifacts
uses: actions/upload-artifact@v1
with:
name: smartcitizen-connector-pkg
path: dist
pypi-publish:
name: Upload release to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/smartcitizen-connector
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[metadata]
description-file = README.md
description_file = README.md
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,18 @@

setup(
name="smartcitizen-connector",
version="0.2.0",
version="0.3.0",
description="Python connector to download information collected in SmartCitizen API",
author="Óscar González",
author="oscgonfer",
license="GNU General Public License v3",
keywords=['sensors', 'Smart Citizen'],
long_description = open('README.md').read(),
long_description_content_type="text/markdown",
url="https://github.com/fablabbcn/smartcitizen-connector",
packages=find_packages("src"),
package_dir={"": "src"},
project_urls=PROJECT_URLS,
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
python_requires=">=3.6",
classifiers=[
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
Expand All @@ -44,5 +41,7 @@
"Topic :: Utilities",
"Natural Language :: English",
],
install_requires=["pydantic", "requests", "pandas", "timezonefinder", "urllib3"],
install_requires=["pydantic", "requests", "pandas", "timezonefinder", "urllib3", "aiohttp"],
setup_requires=['wheel'],
zip_safe=False
)
17 changes: 17 additions & 0 deletions smartcitizen_connector/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from .models import (Sensor, Measurement, Kit, Owner, Location,
HardwareInfo, Postprocessing, Data, Device)
from .device import SCDevice

__all__ = [
"Device",
"Kit",
"Sensor",
"Measurement",
"Owner",
"Location",
"Data",
"Postprocessing",
"HardwareInfo"
]

__version__ = '0.3.0'
1 change: 1 addition & 0 deletions smartcitizen_connector/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .config import *
8 changes: 8 additions & 0 deletions smartcitizen_connector/config/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Output config
out_level = 'DEBUG'
out_timestamp = True
# Base URL for all methods
API_URL = 'https://api.smartcitizen.me/v0/'
DEVICES_URL = API_URL + 'devices/'
FRONTED_URL = 'https://smartcitizen.me/kits'
BASE_POSTPROCESSING_URL='https://raw.githubusercontent.com/fablabbcn/smartcitizen-data/master/'
1 change: 1 addition & 0 deletions smartcitizen_connector/device/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .device import SCDevice
Loading

0 comments on commit 0fc7b3f

Please sign in to comment.