osmsg 0.2.3__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of osmsg might be problematic. Click here for more details.

@@ -1,13 +1,23 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osmsg
3
- Version: 0.2.3
4
- Summary: OpenStreetMap Stats Generator : Commandline
5
- Home-page: https://github.com/kshitijrajsharma/OSMSG
6
- Author: Kshitij Raj Sharma
3
+ Version: 0.3.0
4
+ Summary: OpenStreetMap Stats Generator: Commandline
5
+ License: GPL-3.0-only
6
+ Keywords: osm,stats,commandline,openstreetmap
7
7
  Author-email: Kshitij Raj Sharma <skshitizraj@gmail.com>
8
- License: MIT
8
+ Requires-Python: >=3.9
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Topic :: Scientific/Engineering :: GIS
14
+ Classifier: Topic :: Utilities
15
+ Provides-Extra: docs
16
+ Provides-Extra: test
17
+ Project-URL: documentation, https://github.com/kshitijrajsharma/osmsg
18
+ Project-URL: homepage, https://github.com/kshitijrajsharma/osmsg
19
+ Project-URL: repository, https://github.com/kshitijrajsharma/osmsg
9
20
  Description-Content-Type: text/markdown
10
- License-File: LICENSE
11
21
 
12
22
  # OpenStreetMap Stats Generator
13
23
 
@@ -15,7 +25,7 @@ On the Fly Commandline Stats Generator for OpenStreetMap User Contributions
15
25
 
16
26
  I tweet stats Every day/week/month for Global/Region and #hotosm hashtag at https://twitter.com/stats_osm and store them [OSMSG Stats Dir](https://github.com/kshitij-raj-sharma/OSMSG-stats/)
17
27
 
18
- Monitored stats are available under `stats`, Currently Bot monitors OSM as whole , hotosm hashtag , Nepal Country : weekly,monthly and yearly stats are stored in github and twitter.
28
+ Monitored stats are available under `stats`, Currently Bot monitors OSM as whole , hotosm hashtag , Nepal Country : weekly,monthly and yearly stats are stored in github and twitter.
19
29
 
20
30
  ### Usage:
21
31
  For installation & Local Setup follow [Installation](./docs/Installation.md)
@@ -91,3 +101,4 @@ Follow [stats_request_docs](./docs/Request_Stats.md)
91
101
  pip install streamlit
92
102
  streamlit run streamlit_app.py
93
103
  ```
104
+
@@ -4,7 +4,7 @@ On the Fly Commandline Stats Generator for OpenStreetMap User Contributions
4
4
 
5
5
  I tweet stats Every day/week/month for Global/Region and #hotosm hashtag at https://twitter.com/stats_osm and store them [OSMSG Stats Dir](https://github.com/kshitij-raj-sharma/OSMSG-stats/)
6
6
 
7
- Monitored stats are available under `stats`, Currently Bot monitors OSM as whole , hotosm hashtag , Nepal Country : weekly,monthly and yearly stats are stored in github and twitter.
7
+ Monitored stats are available under `stats`, Currently Bot monitors OSM as whole , hotosm hashtag , Nepal Country : weekly,monthly and yearly stats are stored in github and twitter.
8
8
 
9
9
  ### Usage:
10
10
  For installation & Local Setup follow [Installation](./docs/Installation.md)
@@ -0,0 +1 @@
1
+ __version__ = "0.3.0"
@@ -41,6 +41,7 @@ import pandas as pd
41
41
  from matplotlib.font_manager import FontProperties
42
42
  from tqdm import tqdm
43
43
 
44
+ from .__version__ import __version__
44
45
  from .changefiles import (
45
46
  get_download_urls_changefiles,
46
47
  get_prev_hour,
@@ -471,6 +472,9 @@ def auth(username, password):
471
472
 
472
473
  def parse_args():
473
474
  parser = argparse.ArgumentParser()
475
+ parser.add_argument(
476
+ "--version", action="version", version=f"%(prog)s {__version__}"
477
+ )
474
478
  parser.add_argument(
475
479
  "--start_date",
476
480
  help="Start date in the format YYYY-MM-DD HH:M:Sz eg: 2023-01-28 17:43:09+05:45",
@@ -313,7 +313,7 @@ def create_charts(df, fname):
313
313
  other_editors_count = grouped_editors.iloc[num_categories:].sum()
314
314
 
315
315
  # Create a new series with the top categories and "others" count
316
- editors_data = top_editors.append(
316
+ editors_data = top_editors._append(
317
317
  pd.Series(other_editors_count, index=["Others"])
318
318
  )
319
319
 
@@ -528,12 +528,16 @@ def update_stats(df1, df2):
528
528
  # Iterate over the integer columns and update the values
529
529
  for col in int_cols:
530
530
  merged_df[col] = merged_df.apply(
531
- lambda row: pd.to_numeric(row[f"{col}_x"], errors="coerce")
532
- + pd.to_numeric(row[f"{col}_y"], errors="coerce")
533
- if pd.notnull(row[f"{col}_x"]) and pd.notnull(row[f"{col}_y"])
534
- else pd.to_numeric(row[f"{col}_x"], errors="coerce") or 0
535
- if pd.notnull(row[f"{col}_x"])
536
- else pd.to_numeric(row[f"{col}_y"], errors="coerce") or 0,
531
+ lambda row: (
532
+ pd.to_numeric(row[f"{col}_x"], errors="coerce")
533
+ + pd.to_numeric(row[f"{col}_y"], errors="coerce")
534
+ if pd.notnull(row[f"{col}_x"]) and pd.notnull(row[f"{col}_y"])
535
+ else (
536
+ pd.to_numeric(row[f"{col}_x"], errors="coerce") or 0
537
+ if pd.notnull(row[f"{col}_x"])
538
+ else pd.to_numeric(row[f"{col}_y"], errors="coerce") or 0
539
+ )
540
+ ),
537
541
  axis=1,
538
542
  )
539
543
 
@@ -641,12 +645,16 @@ def update_summary(df1, df2):
641
645
  # Iterate over the integer columns and update the values
642
646
  for col in int_cols:
643
647
  merged_df[col] = merged_df.apply(
644
- lambda row: pd.to_numeric(row[f"{col}_x"], errors="coerce")
645
- + pd.to_numeric(row[f"{col}_y"], errors="coerce")
646
- if pd.notnull(row[f"{col}_x"]) and pd.notnull(row[f"{col}_y"])
647
- else pd.to_numeric(row[f"{col}_x"], errors="coerce") or 0
648
- if pd.notnull(row[f"{col}_x"])
649
- else pd.to_numeric(row[f"{col}_y"], errors="coerce") or 0,
648
+ lambda row: (
649
+ pd.to_numeric(row[f"{col}_x"], errors="coerce")
650
+ + pd.to_numeric(row[f"{col}_y"], errors="coerce")
651
+ if pd.notnull(row[f"{col}_x"]) and pd.notnull(row[f"{col}_y"])
652
+ else (
653
+ pd.to_numeric(row[f"{col}_x"], errors="coerce") or 0
654
+ if pd.notnull(row[f"{col}_x"])
655
+ else pd.to_numeric(row[f"{col}_y"], errors="coerce") or 0
656
+ )
657
+ ),
650
658
  axis=1,
651
659
  )
652
660
  if "editors" in df1.columns:
@@ -0,0 +1,142 @@
1
+ [project]
2
+ name = "osmsg"
3
+ version = "0.3.0"
4
+ dynamic = []
5
+ description = "OpenStreetMap Stats Generator: Commandline"
6
+ readme = "README.md"
7
+ authors = [
8
+ { name = "Kshitij Raj Sharma", email = "skshitizraj@gmail.com" },
9
+ ]
10
+ requires-python = ">=3.9"
11
+ dependencies = [
12
+ "pandas <= 2.2.2",
13
+ "osmium <= 3.7.0",
14
+ "requests <= 2.32.3",
15
+ "shapely <= 2.0.6",
16
+ "geopandas <= 1.0.1",
17
+ "tqdm <= 4.66.5",
18
+ "seaborn <= 0.13.2",
19
+ "matplotlib <= 3.9.2",
20
+ "humanize <= 4.10.0",
21
+ ]
22
+ keywords = [
23
+ "osm",
24
+ "stats",
25
+ "commandline",
26
+ "openstreetmap",
27
+ ]
28
+ classifiers = [
29
+ "Topic :: Utilities",
30
+ "Topic :: Scientific/Engineering :: GIS",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.9",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ ]
36
+
37
+ [project.license]
38
+ text = "GPL-3.0-only"
39
+
40
+ [project.urls]
41
+ homepage = "https://github.com/kshitijrajsharma/osmsg"
42
+ documentation = "https://github.com/kshitijrajsharma/osmsg"
43
+ repository = "https://github.com/kshitijrajsharma/osmsg"
44
+
45
+ [project.optional-dependencies]
46
+ test = [
47
+ "pytest>=7.4.2",
48
+ "pytest-mock>=3.14.0",
49
+ "coverage>=7.6.1",
50
+ "coverage-badge>=1.1.2",
51
+ ]
52
+ docs = [
53
+ "mkdocs>=1.5.3",
54
+ "mkdocs-material>=9.4.2",
55
+ "mkdocstrings-python>=1.7.0",
56
+ "mkdocs-exclude>=1.0.2",
57
+ ]
58
+
59
+ [project.scripts]
60
+ osmsg = "osmsg.app:main"
61
+
62
+ [build-system]
63
+ requires = [
64
+ "pdm-pep517>=1.1.4",
65
+ ]
66
+ build-backend = "pdm.pep517.api"
67
+
68
+ [tool.pytest.ini_options]
69
+ addopts = "-ra -q -p no:warnings"
70
+ testpaths = [
71
+ "tests",
72
+ ]
73
+ pythonpath = "osmsg"
74
+
75
+ [tool.commitizen]
76
+ name = "cz_conventional_commits"
77
+ tag_format = "v$version"
78
+ version_scheme = "semver"
79
+ version_provider = "pep621"
80
+ update_changelog_on_bump = true
81
+ version_files = [
82
+ "pyproject.toml:version",
83
+ "osmsg/__version__.py",
84
+ ]
85
+
86
+ [tool.pdm.version]
87
+ from = "osmsg/__version__.py"
88
+
89
+ [tool.pdm.build]
90
+ includes = [
91
+ "osmsg",
92
+ ]
93
+ source-includes = [
94
+ "tests",
95
+ "LICENSE",
96
+ "README.md",
97
+ ]
98
+
99
+ [tool.black]
100
+ line-length = 132
101
+ target-versions = [
102
+ "py39",
103
+ "py310",
104
+ "py311",
105
+ ]
106
+
107
+ [tool.ruff]
108
+ fix = true
109
+ line-length = 132
110
+ target-version = "py39"
111
+ exclude = [
112
+ ".git",
113
+ ".ruff_cache",
114
+ ".vscode",
115
+ "__pypackages__",
116
+ "build",
117
+ "dist",
118
+ "osmsg/__version__.py",
119
+ ]
120
+
121
+ [tool.ruff.lint]
122
+ select = [
123
+ "I",
124
+ "E",
125
+ "W",
126
+ "D",
127
+ "B",
128
+ "F",
129
+ "N",
130
+ "Q",
131
+ ]
132
+
133
+ [tool.ruff.lint.pydocstyle]
134
+ convention = "google"
135
+
136
+ [tool.coverage.run]
137
+ source = [
138
+ "osmsg",
139
+ ]
140
+
141
+ [tool.coverage.report]
142
+ show_missing = true
osmsg-0.2.3/MANIFEST.in DELETED
@@ -1 +0,0 @@
1
- include data/countries_un.geojson
osmsg-0.2.3/PKG-INFO DELETED
@@ -1,93 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: osmsg
3
- Version: 0.2.3
4
- Summary: OpenStreetMap Stats Generator : Commandline
5
- Home-page: https://github.com/kshitijrajsharma/OSMSG
6
- Author: Kshitij Raj Sharma
7
- Author-email: Kshitij Raj Sharma <skshitizraj@gmail.com>
8
- License: MIT
9
- Description-Content-Type: text/markdown
10
- License-File: LICENSE
11
-
12
- # OpenStreetMap Stats Generator
13
-
14
- On the Fly Commandline Stats Generator for OpenStreetMap User Contributions
15
-
16
- I tweet stats Every day/week/month for Global/Region and #hotosm hashtag at https://twitter.com/stats_osm and store them [OSMSG Stats Dir](https://github.com/kshitij-raj-sharma/OSMSG-stats/)
17
-
18
- Monitored stats are available under `stats`, Currently Bot monitors OSM as whole , hotosm hashtag , Nepal Country : weekly,monthly and yearly stats are stored in github and twitter.
19
-
20
- ### Usage:
21
- For installation & Local Setup follow [Installation](./docs/Installation.md)
22
- ```
23
- osmsg [-h] [--start_date START_DATE] [--end_date END_DATE] [--username USERNAME]
24
- [--password PASSWORD] [--timezone {Nepal,UTC}] [--name NAME]
25
- [--country COUNTRY [COUNTRY ...]] [--tags TAGS [TAGS ...]]
26
- [--hashtags HASHTAGS [HASHTAGS ...]] [--length LENGTH [LENGTH ...]] [--force]
27
- [--field_mappers] [--meta] [--tm_stats] [--rows ROWS] [--users USERS [USERS ...]]
28
- [--workers WORKERS] [--url URL [URL ...]] [--last_week] [--last_day] [--last_month]
29
- [--last_year] [--last_hour] [--days DAYS] [--charts] [--summary] [--exact_lookup]
30
- [--changeset] [--all_tags] [--temp]
31
- [--format {csv,json,excel,image,text} [{csv,json,excel,image,text} ...]]
32
- [--read_from_metadata READ_FROM_METADATA] [--boundary BOUNDARY] [--update]
33
- ```
34
-
35
- ### Options:
36
- Hit following command for listing out the option with their documentation
37
- ```
38
- osmsg --help
39
- ```
40
-
41
- ### Features
42
- It is a python package that processes osm files live and produces stats on the fly
43
-
44
- 1. It can Generate Stats on Country Level for countries based on geofabrik urls . Countries are available in [here](./data/countries.csv)
45
- 2. It can also take any other server replication changefile to extract stats (Tested with Geofabrik and Planet Replication)
46
- 3. Can Generate hashtag statistics
47
- 4. Supports multiple output formats , Visualize Automatic Stats Being Genarated [here](./stats/)
48
- 5. It can create summary charts automatically along with stats , Visualize them [here](./stats/Global/Daily/)
49
- 6. Can generate stats for any custom timestamp provided
50
-
51
- ```
52
- {"name":"username","uid":uid,"changesets":1,"nodes.create":1071,"nodes.modify":2100,"nodes.delete":0,"ways.create":146,"ways.modify":69,"ways.delete":0,"relations.create":0,"relations.modify":1,"relations.delete":0,"building.create":138,"building.modify":11,"building.delete":0,"highway.create":5,"highway.modify":49,"highway.delete":0,"waterway.create":0,"waterway.modify":4,"waterway.delete":0,"amenity.create":0,"amenity.modify":3,"amenity.delete":0,"landuse.create":3,"landuse.modify":1,"landuse.delete":0,"natural.create":0,"natural.modify":3,"natural.delete":0,"total_map_changes":3387}
53
- ```
54
-
55
- ### Get Started :
56
-
57
- - Extract Stat of last hour and visualize stats/charts
58
-
59
- By default replication is minute url.
60
-
61
- ```
62
- osmsg --last_hour
63
- ```
64
-
65
- - With Hashtags information
66
-
67
- ```
68
- osmsg --last_hour --changeset
69
- ```
70
-
71
-
72
- - Last week data with summary & all tags info and using day replication
73
- ```
74
- osmsg --last_week --url day --summary --all_tags
75
- ```
76
-
77
- For More , Follow [Manual](./docs/Manual.md)
78
-
79
- ### Contributing
80
- Contributions are always welcome! Follow [Contributing Guidelines](./CONTRIBUTING.md) & Go through [Code of Conduct](./CODE_OF_CONDUCT.md)
81
-
82
- ### Version Control
83
- Follow [Version Control Docs](./docs/Version_control.md)
84
-
85
- ### Request Stats Tracking on Github
86
- Follow [stats_request_docs](./docs/Request_Stats.md)
87
-
88
- ## Visualize stats with streamlit
89
-
90
- ```bash
91
- pip install streamlit
92
- streamlit run streamlit_app.py
93
- ```