diff --git a/.github/workflows/Unit-Test.yml b/.github/workflows/Unit-Test.yml index 85da43b9..db765798 100644 --- a/.github/workflows/Unit-Test.yml +++ b/.github/workflows/Unit-Test.yml @@ -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: | @@ -87,4 +87,4 @@ jobs: - name: Run Tests run: | - py.test -v -s + python -m pytest -v -s diff --git a/.github/workflows/docker-image-push.yml b/.github/workflows/docker-image-push.yml index 21458aa3..f8f4d78b 100644 --- a/.github/workflows/docker-image-push.yml +++ b/.github/workflows/docker-image-push.yml @@ -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 @@ -20,7 +18,7 @@ jobs: permissions: contents: read packages: write - # + # steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..7a6d6553 --- /dev/null +++ b/CHANGELOG.md @@ -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) diff --git a/Dockerfile b/Dockerfile index 07f6416e..ca79a03b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.10 +ARG PYTHON_VERSION=3.11 FROM docker.io/python:${PYTHON_VERSION}-slim-bookworm as base @@ -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 @@ -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 diff --git a/README.md b/README.md index 147b3e73..b97ae50e 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/src/version_control.md b/docs/src/version_control.md new file mode 100644 index 00000000..e5bcb06c --- /dev/null +++ b/docs/src/version_control.md @@ -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**: [optional scope]: + +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. + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..4c3dc651 --- /dev/null +++ b/pyproject.toml @@ -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 = "sysadmin@hotosm.org" } +] +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"]} } + diff --git a/setup.py b/setup.py index 76b48c2d..ddef158f 100644 --- a/setup.py +++ b/setup.py @@ -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="sysadmin@hotosm.org", - url="https://github.com/hotosm/export-tool-api", -) +setup() diff --git a/tests/test_app.py b/tests/test_app.py index 3ce2c796..087609f7 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -17,8 +17,6 @@ # 1100 13th Street NW Suite 800 Washington, D.C. 20005 # -from json import dumps - from src.query_builder.builder import raw_currentdata_extraction_query from src.validation.models import RawDataCurrentParams