Skip to content

Commit

Permalink
Merge pull request #224 from hotosm/feature/version-control
Browse files Browse the repository at this point in the history
Feature : Version Control
  • Loading branch information
kshitijrajsharma authored Mar 7, 2024
2 parents a1d7ac7 + 453e799 commit 3cbff8b
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Unit-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
python setup.py install
- name: Launch Default Worker
run: |
Expand All @@ -87,4 +87,4 @@ jobs:
- name: Run Tests
run: |
py.test -v -s
python -m pytest -v -s
8 changes: 3 additions & 5 deletions .github/workflows/docker-image-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ name: Create and publish a Docker image

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
push:
branches:
- master
- develop
release:
types: [released]
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
Expand All @@ -20,7 +18,7 @@ jobs:
permissions:
contents: read
packages: write
#
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## 1.0.17 (2024-03-06)

### Fix

- add optional param to wrap flatgeobuf in geomcollection
- default add spatial index to generated flatgeobuf files

### Refactor

- remove ENCODING param for flatgeobuf (does nothing)
- use f-string for flatgeobuf ogr command

## 1.0.16 (2022-12-19)

## 1.0.15 (2022-12-13)

## 1.0.14 (2022-12-13)

## 1.0.13 (2022-12-07)

## 1.0.12 (2022-12-07)

## 1.0.11 (2022-12-07)

## 1.0.10 (2022-12-07)

## 1.0.9 (2022-12-07)

## 1.0.8 (2022-12-07)

## 1.0.7 (2022-12-04)

## v1.0.6 (2022-09-15)

## v1.0.5 (2022-09-09)

## v1.0.4 (2022-08-02)

## v1.0.3 (2022-08-01)

## v1.0.2 (2022-08-01)

## v1.0.1 (2022-07-29)

## v1.0.0 (2022-07-29)
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.10
ARG PYTHON_VERSION=3.11

FROM docker.io/python:${PYTHON_VERSION}-slim-bookworm as base

Expand All @@ -17,13 +17,17 @@ RUN apt-get update \
build-essential libpq-dev libspatialite-dev libgdal-dev libboost-numpy-dev
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN gdal-config --version | awk -F'[.]' '{print $1"."$2}'

COPY setup.py .
COPY pyproject.toml .
COPY requirements.txt .
COPY README.md .
RUN pip install --user --no-cache-dir --upgrade pip \
COPY LICENSE .
RUN pip install --user --no-cache-dir --upgrade pip setuptools wheel\
&& pip install --user --no-cache-dir GDAL=="$(gdal-config --version)" \
&& pip install --user --no-cache-dir -r requirements.txt \
&& pip install --user --no-cache-dir -e .
&& pip install --user --no-cache-dir -r requirements.txt

RUN pip install --user -e .

FROM base as runner
WORKDIR /home/appuser
Expand All @@ -46,6 +50,7 @@ COPY README.md .
# COPY config.txt ./config.txt

COPY setup.py .
COPY pyproject.toml .
COPY API/ ./API/
COPY src/ ./src/
# Use a separate stage to pull the tippecanoe image
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ see [Roadmap](https://github.com/orgs/hotosm/projects/29)

see [LICENSE](https://github.com/hotosm/raw-data-api/blob/develop/LICENSE)


## Version Control

For version control, We use commitizen, follow [docs](./docs/src/version_control.md)

## Authors

Created by [HOTOSM](https://hotosm.org) and [Friends](https://github.com/hotosm/raw-data-api/graphs/contributors)
Expand Down
60 changes: 60 additions & 0 deletions docs/src/version_control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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 develop 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.

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

[project]
name = "raw-data-api"
version = "1.0.17"
description = "Set of high-performant APIs for transforming and exporting OpenStreetMap (OSM) data in different GIS file formats."
readme = "README.md"
authors = [
{ name = "Hot Tech Team", email = "[email protected]" }
]
license = { file = "LICENSE" }
classifiers = [
"Programming Language :: Python :: 3",
]
keywords = [
"OSM", "rawdataapi",
]

[project.optional-dependencies]
dev = ["black", "bumpver", "isort"]

[project.urls]
repository = "https://github.com/hotosm/raw-data-api"

[tool.bumpver]
current_version = "1.0.17"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
tag = true
push = false

[tool.bumpver.file_patterns]
"pyproject.toml" = [
'current_version = "{version}"',
'version = "{version}"',
]

[tool.isort]
profile = "black"
import_heading_stdlib = "Standard library imports"
import_heading_thirdparty = "Third party imports"
import_heading_firstparty = "Reader imports"

[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "$version"
version_scheme = "semver"
version_provider = "pep621"
update_changelog_on_bump = true


[tool.setuptools]
packages = { find = { where = ["src","API"]} }

35 changes: 3 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
import setuptools
# Third party imports
from setuptools import setup

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="raw-data-api",
version="1.0.16",
description="The Raw Data API module makes it simple for you to get osm data stats provided by api in your own project",
packages=setuptools.find_packages(),
install_requires=[
"pytest==7.4.3",
"psycopg2",
"boto3==1.24.38",
"fastapi==0.105.0",
"geojson==3.1.0",
"area==1.1.1",
"orjson==3.9.10",
"slowapi==0.1.8",
],
classifiers=[
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.8",
long_description=long_description,
long_description_content_type="text/markdown",
author="Hot Tech Team",
author_email="[email protected]",
url="https://github.com/hotosm/export-tool-api",
)
setup()
2 changes: 0 additions & 2 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# 1100 13th Street NW Suite 800 Washington, D.C. 20005
# <[email protected]>

from json import dumps

from src.query_builder.builder import raw_currentdata_extraction_query
from src.validation.models import RawDataCurrentParams

Expand Down

0 comments on commit 3cbff8b

Please sign in to comment.