Skip to content

Commit 7312fcc

Browse files
prepare project for Pypi and fix Readme issue
1 parent 6cff9fa commit 7312fcc

File tree

6 files changed

+112
-18
lines changed

6 files changed

+112
-18
lines changed

Apollo/__init__.py

Whitespace-only changes.

apollo.py Apollo/apollo.py

+25-17
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
from colorama import Fore,Style,init
88

99
# ----------------------function----------------------
10+
#get weather information from API
1011
def forecast(city,condition):
1112
# open config.json file(read)
12-
with open("config.json", "r") as data_file:
13+
with open('config.json', 'r') as data_file:
1314
data = json.load(data_file)
14-
owm = OWM(data["Api_Key"])
15-
Name = data["Name"]
16-
Surname = data["Surname"]
15+
owm = OWM(data['Api_Key'])
16+
Name = data['Name']
17+
Surname = data['Surname']
1718
if condition == True:
18-
city = data["City"]
19+
city = data['City']
1920
# close json
2021
data_file.close()
2122
#get weather forecast and information about city
@@ -33,25 +34,32 @@ def forecast(city,condition):
3334
#print information
3435
init()
3536
print("\nUser")
36-
print(Fore.YELLOW + Name + " " + Surname + Style.RESET_ALL)
37-
print("\nCity")
37+
print(Fore.YELLOW + Name + ' ' + Surname + Style.RESET_ALL)
38+
print('\nCity')
3839
print(Fore.CYAN + city + Style.RESET_ALL)
39-
print("\nWeather condition")
40+
print('\nWeather condition')
4041
print(Fore.CYAN + weather_val + Style.RESET_ALL)
41-
print("\nWind")
42+
print('\nWind')
4243
print(Fore.CYAN + wind_val + Style.RESET_ALL)
43-
print("\nTemperature [Celsius]")
44+
print('\nTemperature [Celsius]')
4445
print(Fore.CYAN + temperature_val + Style.RESET_ALL)
45-
print("\nHumidity")
46-
print(Fore.CYAN + humidity_val + "%" + Style.RESET_ALL)
46+
print('\nHumidity')
47+
print(Fore.CYAN + humidity_val + '%' + Style.RESET_ALL)
48+
#help command
49+
def help ():
50+
print ('Apollo usage:\n\n' +
51+
'Apollo[city_name] : show weather information about city')
4752

4853
# ----------------------main----------------------
4954
if len(sys.argv) == 1:
50-
print("\nWelcome to Apollo: The great weather forecast tool\n\n")
51-
print("Weather forecast for default city are:\n\n")
55+
print('\nWelcome to Apollo: The great weather forecast tool\n\n')
56+
print('Weather forecast for default city are:\n\n')
5257
check_default_city = True
5358
forecast('',check_default_city)
5459
else:
55-
check_default_city = False
56-
#call forecast with user's city
57-
forecast(sys.argv[1],check_default_city)
60+
if sys.argv[1] == '--help':
61+
help()
62+
else:
63+
check_default_city = False
64+
#call forecast with user's city
65+
forecast(sys.argv[1],check_default_city)

config.json Apollo/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"City": "#","Api_Key": "1fad2670e91546ebd6f280e185b23732","Name": "paolo", "Surname": "delly"}
1+
{"City": "#","Api_Key": "1fad2670e91546ebd6f280e185b23732","Name": "#", "Surname": "#"}

README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Apollo
2+
3+
Apollo is the great tool to get fast waether forecast,for your city.
4+
5+
# Introduction
6+
With Apollo, you can get many weather deatails for your city, for example:
7+
- wind
8+
- weather condition
9+
- humidity
10+
11+
12+
Apollo is written in python, an easy and powerful language for powerful tools
13+
14+
### Get Started
15+
16+
Follow this step for use Apollo correctly:
17+
* [Setup.py] - Run Setup.py to install all dependecies
18+
* [config.json] - Open config file and add your name and surname,also you must add default city value, for example your city
19+
* [Apollo.py] - Run Apollo.py and add next city name
20+
* [help] - Run Apollo.py help to print all commands
21+
22+
### Dependencies
23+
24+
The project use third-party modules to work properly.
25+
The imported modules are:
26+
* [sys] - for command-line arguments
27+
* [pyowm] - for OWM Api
28+
*[json] - for load and modify config.json
29+
30+
31+
### Development
32+
33+
Want to contribute? Great!
34+
35+
36+
Fork Apollo Repo:
37+
```sh
38+
Click the Fork button in the header of the repository.
39+
```
40+
41+
Second Tab:
42+
```sh
43+
You’ve successfully forked the Apollo repository, but so far, you will need to clone it to your computer.
44+
```
45+
46+
Third:
47+
```sh
48+
At last, when you’re ready to propose changes into the main project, make a pull request.
49+
```
50+
### Contributor
51+
> Main: Dellaquila Francesco Paolo

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[bdist_wheel]
2+
universal=1

setup.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from distutils.core import setup
2+
3+
setup(
4+
name='Apollo',
5+
version='0.1',
6+
packages=['Apollo'],
7+
url='https://github.com/PugliaSOS/Apollo',
8+
license='Apache',
9+
author='paolo',
10+
author_email='[email protected]',
11+
description='command line tool to get weather condition',
12+
13+
classifiers=[
14+
'Development Status :: 5 - Stable',
15+
16+
'Intended Audience :: Developers',
17+
'Topic :: Software Development :: Build Tools',
18+
19+
'License :: Apache License',
20+
21+
'Programming Language :: Python :: 2',
22+
'Programming Language :: Python :: 2.6',
23+
'Programming Language :: Python :: 2.7',
24+
'Programming Language :: Python :: 3',
25+
'Programming Language :: Python :: 3.3',
26+
'Programming Language :: Python :: 3.4',
27+
'Programming Language :: Python :: 3.5',
28+
],
29+
30+
keywords='sample weather condition tool development',
31+
32+
install_requires=['pyowm','colorama'],
33+
)

0 commit comments

Comments
 (0)