Skip to content

Commit 8f7267d

Browse files
authored
Merge pull request #144 from MerginMaps/infra
add some more CI
2 parents 809e3d3 + 2ffa94e commit 8f7267d

File tree

7 files changed

+103
-15
lines changed

7 files changed

+103
-15
lines changed

.github/workflows/code_style.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Code Style
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
code_style_python:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: psf/black@stable
11+
with:
12+
options: "--check --diff --verbose -l 120"
13+
src: "./mergin"

.github/workflows/python_packages.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and upload to PyPI
2+
3+
on: [push]
4+
jobs:
5+
build_sdist:
6+
name: Build source distribution
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- uses: actions/setup-python@v2
12+
name: Install Python
13+
with:
14+
python-version: '3.x'
15+
16+
- name: Install deps
17+
run: |
18+
pip install --upgrade pip
19+
pip install setuptools twine wheel
20+
21+
- name: Build sdist
22+
run: python setup.py sdist
23+
24+
- uses: actions/upload-artifact@v2
25+
with:
26+
path: dist/*.tar.gz
27+
28+
upload_pypi:
29+
needs: [build_sdist]
30+
runs-on: ubuntu-latest
31+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
32+
steps:
33+
- uses: actions/download-artifact@v2
34+
with:
35+
name: artifact
36+
path: dist
37+
38+
- uses: pypa/gh-action-pypi-publish@release/v1
39+
with:
40+
user: __token__
41+
password: ${{ secrets.PYPI_TOKEN }}

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
[![PyPI version](https://badge.fury.io/py/mergin-client.svg)](https://badge.fury.io/py/mergin-client)
2+
[![Build and upload to PyPI](https://github.com/MerginMaps/mergin-py-client/actions/workflows/python_packages.yml/badge.svg)](https://github.com/MerginMaps/mergin-py-client/actions/workflows/python_packages.yml)
3+
4+
[![Code Style](https://github.com/MerginMaps/mergin-py-client/actions/workflows/code_style.yml/badge.svg)](https://github.com/MerginMaps/mergin-py-client/actions/workflows/code_style.yml)
25
[![Auto Tests/Package](https://github.com/MerginMaps/mergin-py-client/workflows/Auto%20Tests/badge.svg)](https://github.com/MerginMaps/mergin-py-client/actions?query=workflow%3A%22Auto+Tests%22)
36
[![Coverage Status](https://img.shields.io/coveralls/MerginMaps/mergin-py-client.svg)](https://coveralls.io/github/MerginMaps/mergin-py-client)
47

58
# Mergin Maps Python Client
69

7-
This repository contains a Python client module for access to [Mergin Maps](https://merginmaps.com/)
8-
service and a command-line tool for easy access to data stored in Mergin Maps.
10+
This repository contains a Python client module for access to [Mergin Maps](https://merginmaps.com/) service and a command-line tool for easy access to data stored in Mergin Maps.
911

1012
<div><img align="left" width="45" height="45" src="https://github.com/MerginMaps/docs/main/src/.vuepress/public/slack.svg"><a href="https://merginmaps.com/community/join">Join our community chat</a><br/>and ask questions!</div><br />
1113

1214

1315
To install the module:
14-
16+
```bash
1517
pip3 install mergin-client
18+
```
1619

1720
Note: Check also [Mergin Maps Cpp Client](https://github.com/MerginMaps/mergin-cpp-client)
1821

@@ -149,17 +152,6 @@ it is possible to run other commands without specifying username/password.
149152

150153
## Development
151154

152-
### How to release
153-
154-
1. Update version in `setup.py` and `mergin/version.py`
155-
2. Tag git repository with the new version
156-
3. Create package and upload it
157-
158-
```
159-
python3 setup.py sdist
160-
python3 -m twine upload dist/mergin-client-x.y.z.tar.gz
161-
```
162-
163155
### Installing deps
164156

165157
Python 3.7+ required. Create `mergin/deps` folder where [geodiff](https://github.com/MerginMaps/geodiff) lib is supposed to be and install dependencies:

mergin/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# The version is also stored in ../setup.py
3-
__version__ = '0.7.2'
3+
__version__ = '1.0.0'
44

55
# There seems to be no single nice way to keep version info just in one place:
66
# https://packaging.python.org/guides/single-sourcing-package-version/

scripts/check_all.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2+
PWD=`pwd`
3+
cd $DIR
4+
black --verbose -l 120 $DIR/../mergin
5+
cd $PWD

scripts/update_version.bash

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
3+
VER=$1
4+
5+
python3 $DIR/update_version.py --version $VER
6+
7+
8+

scripts/update_version.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import os
2+
import re
3+
import argparse
4+
5+
6+
def replace_in_file(filepath, regex, sub):
7+
with open(filepath, 'r') as f:
8+
content = f.read()
9+
10+
content_new = re.sub(regex, sub, content, flags=re.M)
11+
12+
with open(filepath, "w") as f:
13+
f.write(content_new)
14+
15+
16+
dir_path = os.path.dirname(os.path.realpath(__file__))
17+
parser = argparse.ArgumentParser()
18+
parser.add_argument('--version', help='version to replace')
19+
args = parser.parse_args()
20+
ver = args.version
21+
print("using version " + ver)
22+
23+
about_file = os.path.join(dir_path, os.pardir, "mergin", "version.py")
24+
print("patching " + about_file)
25+
replace_in_file(about_file, "__version__\s=\s'.*", "__version__ = '" + ver + "'")
26+
27+
setup_file = os.path.join(dir_path, os.pardir, "setup.py")
28+
print("patching " + setup_file)
29+
replace_in_file(setup_file, "VERSION='.*", "VERSION='" + ver + "'")

0 commit comments

Comments
 (0)