Skip to content

Commit

Permalink
Merge pull request #49 from kshitijrajsharma/bump/new_release
Browse files Browse the repository at this point in the history
Feature : Commitzen (Version Control)
  • Loading branch information
kshitijrajsharma authored Jul 10, 2023
2 parents 9d6b78b + cfe5fe9 commit 6980e28
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/monthly_global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
OSM_USERNAME: ${{ secrets.OSM_USERNAME }}
OSM_PASSWORD: ${{ secrets.OSM_PASSWORD }}
run: |
osmsg --url "https://planet.openstreetmap.org/replication/day" --format image csv --last_month --tags 'building' 'highway' 'waterway' 'amenity' --name stats/Global/Monthly/stats --read_from_metadata stats/Global/Monthly/stats_metadata.json --all_tags --charts --summary --meta
osmsg --url "https://planet.openstreetmap.org/replication/day" --format image csv --last_month --tags 'building' 'highway' 'waterway' 'amenity' --name stats/Global/Monthly/stats --read_from_metadata stats/Global/Monthly/stats_metadata.json --all_tags --charts --summary --meta --temp
- name: add stats to git

Expand Down Expand Up @@ -63,4 +63,3 @@ jobs:
run: |
commit_id=$(git rev-parse --short HEAD)
python tweet.py --git $commit_id --name stats/Global/Monthly/stats --tweet 'OSM Last Month' --mention '@openstreetmap'
2 changes: 1 addition & 1 deletion .github/workflows/monthly_hotosm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Generate Monthly Hashtag Stats
run: |
osmsg --url "https://planet.openstreetmap.org/replication/day" --format csv image --last_month --tags 'building' 'highway' 'waterway' 'amenity' --name stats/hotosm/Monthly/stats --all_tags --read_from_metadata stats/hotosm/Monthly/stats_metadata.json --hashtags hotosm --force --charts --summary --workers 8 --meta
osmsg --url "https://planet.openstreetmap.org/replication/day" --format csv image --last_month --tags 'building' 'highway' 'waterway' 'amenity' --name stats/hotosm/Monthly/stats --all_tags --read_from_metadata stats/hotosm/Monthly/stats_metadata.json --hashtags hotosm --force --charts --summary --workers 8 --meta --temp
- name: add stats to git

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/monthly_nepal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:
OSM_USERNAME: ${{ secrets.OSM_USERNAME }}
OSM_PASSWORD: ${{ secrets.OSM_PASSWORD }}
run: |
osmsg --url "http://download.geofabrik.de/asia/nepal-updates" --username '${{ secrets.OSM_USERNAME }}' --password '${{ secrets.OSM_PASSWORD }}' --format image csv --last_month --tags 'building' 'highway' 'waterway' 'amenity' --name stats/Nepal/Monthly/stats --read_from_metadata stats/Nepal/Monthly/stats_metadata.json --all_tags --summary --charts --meta
osmsg --url "http://download.geofabrik.de/asia/nepal-updates" --username '${{ secrets.OSM_USERNAME }}' --password '${{ secrets.OSM_PASSWORD }}' --format image csv --last_month --tags 'building' 'highway' 'waterway' 'amenity' --name stats/Nepal/Monthly/stats --read_from_metadata stats/Nepal/Monthly/stats_metadata.json --all_tags --summary --charts --meta --temp
- name: add stats to git

run: |
git pull
git config --global user.email "[email protected]"
git config --global user.name "kshitijrajsharma"
base_dir=stats/Nepal/Monthly
mkdir -p $base_dir
Expand All @@ -63,4 +63,3 @@ jobs:
run: |
commit_id=$(git rev-parse --short HEAD)
python tweet.py --git $commit_id --name stats/Nepal/Monthly/stats --tweet 'Nepal Last Month'
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## v0.1.32 (2023-07-10)

### Perf

- **removing-files-on-temp**: temp file removal

## v0.1.31 (2023-07-07)

## v0.1.30 (2023-06-11)

## 0.1.27 (2023-03-21)

## 0.1.26 (2023-03-19)

## 0.1.25 (2023-03-18)

## 0.1.20 (2023-03-12)

## 0.1.19 (2023-03-08)

## 0.1.18 (2023-03-06)

## 0.1.17 (2023-03-05)

## 0.1.16 (2023-03-05)

## 0.1.14 (2023-03-04)

## 0.1.12 (2023-03-02)

## 0.1.10 (2023-03-01)

## 0.1.9 (2023-03-01)

## 1.0.8 (2023-02-28)

## 0.1.6 (2023-02-25)

## 1.0.5 (2023-02-25)

## 0.1.4 (2023-02-25)

## 0.1.3 (2023-02-22)

## 0.1.2 (2023-02-20)

## v0.1.1-alpha (2023-02-16)

## 0.1.1 (2023-02-16)

## 0.1.0 (2023-02-16)

## 0.0.31 (2023-02-16)

## 0.0.30 (2023-02-16)

## 0.0.29 (2023-02-02)

## 0.0.16 (2023-01-31)

## 0.0.11 (2023-01-28)

## 0.0.10 (2023-01-25)

## 0.0.9 (2023-01-23)

## 0.0.8 (2023-01-20)

## 0.0.7 (2023-01-13)

## 0.0.6 (2023-01-12)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ Contributions are always welcome! Project is in active development phase , Impro
- Fork the repository.
- Make your changes and submit a pull request.

### Version Control
Follow [Version Control Docs](./docs/Version_control.md)

### Request Stats Tracking on Github
Follow [stats_request_docs](./docs/Request_Stats.md)
61 changes: 61 additions & 0 deletions docs/Version_control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Version Control

## Conventional Commits

A [specification](https://www.conventionalcommits.org/en/v1.0.0) for adding human and machine readable meaning to commit messages.

**Format**: <type>[optional scope]: <description>

Example `feat: allow provided config object to extend other configs`
Example `fix: fixed the bug in issue #123`

**Advantage**: Automated SemVer version management (major.minor.patch), and automated changelogs.

## Commitizen CLI

[Commitizen](https://commitizen-tools.github.io/commitizen) is a Python tool to help with creating **conventional commits** and automating version control.

### Install

`pip install commitizen`

### Commiting Code

- Instead of `git commit` use `cz commit` and follow the prompts.
- You can select the type of commit, plus additional metadata.

### Bumping a Version

- When you decide it is time to create a new version:

1. Create a new branch

`git checkout -b bump/new_release`

2. Bump the version and push

```bash
pip install commitizen # (if not installed)

cz bump

git push
```

This will:
- Update the SemVer version number in locations specific in `pyproject.toml`, throughout the codebase.
- If a `feat` commit is included, the version is bumped by a minor increment (0.x.0), if only `fix` is included a patch will be used (0.0.x).
- Automatically update CHANGELOG.md with all changes since the last version.
- Create a tag matching the version number.

> Note: in a repo where you have direct push access, you would simply update on main and push. As we are using Git-Flow, a PR is necessary.
## Creating Releases

1. Update the version throughout the code ([Bumping a Version](#bumping-a-version)).
2. Click `Draft a new release`.
3. Click `Choose a tag`, then input the current version number and press enter (this will automatically create a matching tag for your release).
4. Set the `Release title` to v`x.x.x`, replacing with your version number.
5. Add a description if possible, then release.

This should trigger the PyPi publishing workflow, and your version will be available on [PyPi](https://pypi.org/project/osmsg/).
9 changes: 9 additions & 0 deletions osmsg/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ def process_changefiles(url):
except Exception as ex:
print(f"File may be corrupt : Error at {url} : {ex}")

if remove_temp_files:
os.remove(file_path[:-3])


def process_changesets(url):
# print(f"Processing {url}")
Expand All @@ -441,6 +444,9 @@ def process_changesets(url):
except Exception as ex:
print(f"File may be corrupt : Error at {url} : {ex}")

if remove_temp_files:
os.remove(file_path[:-3])


def auth(username, password):
print("Authenticating...")
Expand Down Expand Up @@ -786,6 +792,7 @@ def main():
global collect_field_mappers_stats
global geom_filter_df
global geom_boundary
global remove_temp_files

all_tags = args.all_tags
additional_tags = args.tags
Expand All @@ -796,6 +803,8 @@ def main():
summary = args.summary
collect_field_mappers_stats = args.field_mappers
geom_boundary = args.boundary
remove_temp_files = args.temp

if args.boundary:
if not args.changeset and not args.hashtags:
args.changeset = True
Expand Down
2 changes: 1 addition & 1 deletion osmsg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def process_boundary(input_data):
geom = polygons[0]
### return geom gdf here
gdf = gpd.GeoDataFrame(geometry=gpd.GeoSeries(geom))
print("Filtering data with: ",gdf)
print("Filtering data with: ", gdf)
return gdf


Expand Down
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "osmsg"
version = "0.1.32"
description = "OpenStreetMap Stats Generator : Commandline"
readme = "README.md"
authors = [{name = "Kshitij Raj Sharma", email = "[email protected]"}]
license = {text = "MIT"}

[tool.poetry.dependencies]
python = "^3.6"
osmium = "*"
pandas = "==1.5.2"
requests = "*"
shapely = "*"
geopandas = "==0.10.2"
tqdm = "*"
seaborn = "*"
matplotlib = "*"
humanize = "*"

[tool.poetry.scripts]
osmsg = "osmsg.app:main"

[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_scheme = "semver"
version_provider = "pep621"
update_changelog_on_bump = true
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="osmsg",
version="0.1.31",
version="0.1.32",
description="OpenStreetMap Stats Generator : Commandline",
long_description=readme,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 6980e28

Please sign in to comment.