Skip to content

Commit

Permalink
Time to merge V3 into Develop
Browse files Browse the repository at this point in the history
  • Loading branch information
csparpa committed Apr 14, 2020
2 parents dc6e06c + 2678c9b commit b87018e
Show file tree
Hide file tree
Showing 286 changed files with 7,825 additions and 11,657 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sphinx/_build/*
.tox/*
.coverage
tests/integration/.tox/*
tests/proxy/.tox/*
.cache
.eggs/
htmlcov/*
Expand Down
33 changes: 10 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
dist: xenial
language: python
python:
- "3.4"
- "3.5"
- "3.6"
- "3.7-dev"
- "3.7"
- "3.8-dev"
script: tox
after_success:
- coveralls
Expand All @@ -16,7 +15,7 @@ env:
- TEST_PYPI_URL=https://test.pypi.org/legacy/
- PYPI_URL=https://upload.pypi.org/legacy/
install:
- pip install --upgrade pip && pip install -r dev-requirements.txt && pip install .
- pip install --upgrade pip && pip install -r requirements.txt && pip install --upgrade -r dev-requirements.txt && pip install .
cache: pip

stages:
Expand All @@ -30,37 +29,25 @@ jobs:
include:
- &local_installation_test
stage: "Local Installation Test"
python: 3.4
python: "3.7"
script: bash tests/local_installation_test.sh
- <<: *local_installation_test
python: 3.5
- <<: *local_installation_test
python: 3.6
- <<: *local_installation_test
python: "3.7-dev"
python: "3.8-dev"

- stage: "Build docs"
script: cd sphinx && make clean && make html

- &deploy_to_pypi
stage: "Deploy to PyPI"
python: 3.4
python: "3.7"
script: bash deploy/deploy_to_pypi.sh
- <<: *deploy_to_pypi
python: 3.5
- <<: *deploy_to_pypi
python: 3.6
- <<: *deploy_to_pypi
python: "3.7-dev"
python: "3.8-dev"

- &pypi_installation_test
stage: "PyPI Installation Test"
python: 3.4
python: "3.7"
if: branch = master
script: bash tests/pypi_installation_test.sh
- <<: *pypi_installation_test
python: 3.5
- <<: *pypi_installation_test
python: 3.6
- <<: *pypi_installation_test
python: "3.7-dev"
python: "3.8-dev"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Claudio Sparpaglione
Copyright (c) 2019 Claudio Sparpaglione

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
8 changes: 2 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
include pyowm/pollutionapi30/xsd/*.xsd
include pyowm/stationsapi30/xsd/*.xsd
include pyowm/uvindexapi30/xsd/*.xsd
include pyowm/weatherapi25/cityids/*.gz
include pyowm/weatherapi25/xsd/*.xsd
include pyowm/docs/*.md
include pyowm/requirements.txt
include pyowm/commons/cityids/*.bz2
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[![Coverage Status](https://coveralls.io/repos/github/csparpa/pyowm/badge.svg?branch=master)](https://coveralls.io/github/csparpa/pyowm?branch=master)
<br>
<a href="https://www.buymeacoffee.com/LmAl1n9" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/black_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/csparpa)
[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/csparpa%40gmail.com)

## What is it?
PyOWM is a client Python wrapper library for OpenWeatherMap (OWM) web APIs.
Expand All @@ -33,7 +33,7 @@ With PyOWM you can integrate into your code any of the following OpenWeatherMap
- **[Weather Alerts API v3.0](https://pyowm.readthedocs.io/en/latest/usage-examples-v2/alerts-api-usage-examples.html)**, allowing to set triggers on weather conditions and areas and poll for spawned alerts
- **[Image tiles](https://pyowm.readthedocs.io/en/latest/usage-examples-v2/map-tiles-client-examples.html)** for several map layers provided by OWM

PyOWM runs on Python 2.7 and Python 3.4+ (but watch out! Python 2.x will eventually be dropped - [check details out](https://github.com/csparpa/pyowm/wiki/Timeline-for-dropping-Python-2.x-support))
PyOWM runs on Python 3.5+

PyOWM also integrates with [Django 1.10+ models](https://github.com/csparpa/pyowm/wiki/Django-support).

Expand Down Expand Up @@ -83,14 +83,14 @@ owm = pyowm.OWM('your-API-key') # You MUST provide a valid API key

# Search for current weather in London (Great Britain)
observation = owm.weather_at_place('London,GB')
w = observation.get_weather()
w = observation.weather
print(w) # <Weather - reference time=2013-12-18 09:20,
# status=Clouds>

# Weather details
w.get_wind() # {'speed': 4.6, 'deg': 330}
w.get_humidity() # 87
w.get_temperature('celsius') # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}
w.wind() # {'speed': 4.6, 'deg': 330}
w.humidity() # 87
w.temperature('celsius') # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}

# Search current weather observations in the surroundings of
# lat=22.57W, lon=43.12S (Rio de Janeiro, BR)
Expand Down
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
coverage
coveralls
Jinja2
pip>=18.0
pproxy==2.2.0
pytest
recommonmark
Sphinx
Expand Down
24 changes: 0 additions & 24 deletions dockerfiles/Dockerfile.alpine-dev

This file was deleted.

10 changes: 0 additions & 10 deletions dockerfiles/Dockerfile.alpine-py2

This file was deleted.

11 changes: 0 additions & 11 deletions dockerfiles/Dockerfile.alpine-py3

This file was deleted.

29 changes: 0 additions & 29 deletions dockerfiles/Dockerfile.ubuntu-py2-py3

This file was deleted.

65 changes: 1 addition & 64 deletions pyowm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,67 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
The PyOWM init file
**Author**: Claudio Sparpaglione, @csparpa <csparpa@gmail.com>
**Platform**: platform independent
"""

from pyowm import constants
from pyowm.utils import timeutils, stringutils


stringutils.check_if_running_with_python_2()


def OWM(API_key=constants.DEFAULT_API_KEY, version=constants.LATEST_OWM_API_VERSION,
config_module=None, language=None, subscription_type=None, use_ssl=None):
"""
A parametrized factory method returning a global OWM instance that
represents the desired OWM Weather API version (or the currently supported one
if no version number is specified)
:param API_key: the OWM Weather API key (defaults to a test value)
:type API_key: str
:param version: the OWM Weather API version. Defaults to ``None``, which means
use the latest web API version
:type version: str
:param config_module: the Python path of the configuration module you want
to provide for instantiating the library. Defaults to ``None``, which
means use the default configuration values for the web API version
support you are currently requesting. Please be aware that malformed
user-defined configuration modules can lead to unwanted behaviour!
:type config_module: str (eg: 'mypackage.mysubpackage.myconfigmodule')
:param language: the language in which you want text results to be returned.
It's a two-characters string, eg: "en", "ru", "it". Defaults to:
``None``, which means use the default language.
:type language: str
:param subscription_type: the type of OWM Weather API subscription to be wrapped.
Can be 'free' (free subscription) or 'pro' (paid subscription),
Defaults to: 'free'
:type subscription_type: str
:param use_ssl: whether API calls should be made via SSL or not.
Defaults to: False
:type use_ssl: bool
:returns: an instance of a proper *OWM* subclass
:raises: *ValueError* when unsupported OWM API versions are provided
"""
if version == '2.5':
if config_module is None:
config_module = "pyowm.weatherapi25.configuration25"
cfg_module = __import__(config_module, fromlist=[''])
from pyowm.weatherapi25.owm25 import OWM25
if language is None:
language = cfg_module.language
if subscription_type is None:
subscription_type = cfg_module.API_SUBSCRIPTION_TYPE
if subscription_type not in ['free', 'pro']:
subscription_type = 'free'
if use_ssl is None:
use_ssl = cfg_module.USE_SSL
return OWM25(cfg_module.parsers, API_key, cfg_module.cache,
language, subscription_type, use_ssl)
raise ValueError("Unsupported OWM Weather API version")
from pyowm.owm import OWM
13 changes: 13 additions & 0 deletions pyowm/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pyowm import constants
from pyowm.utils.strings import version_tuple_to_str

__title__ = 'pyowm'
__description__ = 'A Python wrapper around OpenWeatherMap web APIs'
__url__ = 'https://github.com/csparpa/pyowm'
__version__ = version_tuple_to_str(constants.PYOWM_VERSION)
__author__ = 'Claudio Sparpaglione'
__author_email__ = 'csparpa@gmail.com'
__license__ = 'MIT'
29 changes: 0 additions & 29 deletions pyowm/abstractions/jsonparser.py

This file was deleted.

0 comments on commit b87018e

Please sign in to comment.