Skip to content

Commit b14deb0

Browse files
committed
Add github workflow actions.
Renamed package to kof-parser. Updated README.md
1 parent ac88380 commit b14deb0

File tree

16 files changed

+420
-135
lines changed

16 files changed

+420
-135
lines changed

.github/workflows/branch.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Push
2+
on: [push]
3+
4+
jobs:
5+
test:
6+
strategy:
7+
fail-fast: false
8+
matrix:
9+
python-version: ['3.9']
10+
poetry-version: ['1.1.14']
11+
os: [ubuntu-latest]
12+
runs-on: ${{ matrix.os }}
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v3
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Run image
19+
uses: abatilo/[email protected]
20+
with:
21+
poetry-version: ${{ matrix.poetry-version }}
22+
- name: Install dependencies
23+
run: poetry install
24+
- name: Run tests
25+
run: poetry run pytest --cov=./ --cov-report=xml
26+
- name: Upload coverage to Codecov
27+
uses: codecov/codecov-action@v2
28+
code-quality:
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
python-version: ['3.9']
33+
poetry-version: ['1.1.14']
34+
os: [ubuntu-latest]
35+
runs-on: ${{ matrix.os }}
36+
steps:
37+
- uses: actions/checkout@v3
38+
- uses: actions/setup-python@v3
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
- name: Run image
42+
uses: abatilo/[email protected]
43+
with:
44+
poetry-version: ${{ matrix.poetry-version }}
45+
- name: Install dependencies
46+
run: poetry install
47+
- name: Run black
48+
run: poetry run black . --check
49+
# - name: Run isort
50+
# run: poetry run isort . --check-only --profile black
51+
# - name: Run flake8
52+
# run: poetry run flake8 .
53+
- name: Run mypy
54+
run: poetry run mypy .
55+
- name: Run bandit
56+
run: poetry run bandit .
57+
- name: Run safety
58+
run: poetry run safety check
59+
- name: Check for acceptable licenses
60+
run: poetry run pip-licenses --allow-only="MIT License;BSD License;Python Software Foundation License;Apache Software License;Mozilla Public License 2.0 (MPL 2.0);GNU Library or Lesser General Public License (LGPL)"

.github/workflows/release.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
on:
3+
release:
4+
types:
5+
- created
6+
7+
jobs:
8+
publish:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: ['3.9']
13+
poetry-version: ['1.1.14']
14+
os: [ubuntu-latest]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-python@v3
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Run image
22+
uses: abatilo/[email protected]
23+
with:
24+
poetry-version: ${{ matrix.poetry-version }}
25+
- name: Publish
26+
env:
27+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
28+
run: |
29+
poetry config pypi-token.pypi $PYPI_TOKEN
30+
poetry publish --build

README.md

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# NGI KOF Parser
22

33
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
4+
[![security: safety](https://img.shields.io/badge/security-safety-yellow.svg)](https://github.com/pyupio/safety)
5+
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
6+
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
7+
[![python](https://img.shields.io/badge/Python-3.9-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
48

5-
This is the NGI Python package for parsing kof files.
9+
10+
11+
Python package for parsing KOF files.
612

713
References:
814

@@ -11,21 +17,22 @@ NORWEGIAN GEOTECHNICAL SOCIETY
1117
SYMBOLER OG DEFINISJONER I GEOTEKNIKK](http://ngf.no/wp-content/uploads/2015/03/2_NGF-ny-melding-2-endelig-utgave-2011-12-04-med-topp-og-bunntekst-Alt-3.pdf)
1218
- [Norkart KOF specification](http://www.anleggsdata.no/wp-content/uploads/2018/04/KOF-BESKRIVELSE-Oppdatert2005.pdf)
1319

14-
Latest releases see [CHANGES.md](CHANGES.md)
20+
Latest releases see [CHANGES.md](https://github.com/norwegian-geotechnical-institute/kof-parser/blob/main/CHANGES.md)
1521

1622
# Installation (end user)
1723

1824
```bash
1925

20-
pip install ngi-kof-parser
26+
pip install kof-parser
2127

2228
```
2329

2430
## Basic usage
2531

2632
### Read a kof file
33+
2734
```python
28-
from ngi_kof_parser import KOFParser
35+
from kof_parser import KOFParser
2936

3037
parser = KOFParser()
3138

@@ -35,7 +42,7 @@ srid = 5110
3542
locations = parser.parse('tests/data/test.kof', result_srid=srid, file_srid=srid)
3643

3744
for location in locations:
38-
print(location)
45+
print(location)
3946

4047
# Output:
4148
# name='SMPLOC1' methods=[] point_easting=112892.81 point_northing=1217083.64 point_z=1.0 srid=5110
@@ -51,23 +58,23 @@ for location in locations:
5158
### Write a kof file
5259

5360
```python
54-
from ngi_kof_parser import KOFWriter
55-
from ngi_kof_parser import Location
61+
from kof_parser import KOFWriter
62+
from kof_parser import Location
5663

5764
kof_writer = KOFWriter()
5865

5966
srid = 5110
6067
locations = [Location(name='SMPLOC1', point_easting=112892.81, point_northing=1217083.64, point_z=1.0),
6168
Location(name='SMPLOC2', point_easting=112893.15, point_northing=1217079.46, point_z=2.0, methods=['TOT']),
62-
Location(name='SMPLOC3',point_easting=112891.88, point_northing=1217073.01, point_z=0.0, methods=['CPT'])]
63-
69+
Location(name='SMPLOC3', point_easting=112891.88, point_northing=1217073.01, point_z=0.0, methods=['CPT'])]
70+
6471
kof_string = kof_writer.writeKOF(
6572
project_id='project_id', project_name='cool-name', locations=locations, srid=srid
6673
)
6774

6875
print(kof_string)
6976
# Output:
70-
# 00 KOF Export from NGI Field Manager
77+
# 00 KOF Export from NGI's KOF parser
7178
# 00 Project: project_id. Name: cool-name
7279
# 00 Spatial Reference ID (SRID): 5110
7380
# 00 Export date (UTC): 2022-08-22 13:49:44.394607
@@ -104,53 +111,22 @@ There are several combinations of how to set up a local development environment.
104111

105112
We use Poetry for dependency management. See [Install poetry](https://python-poetry.org/docs/) if needed.
106113

107-
To set up a local development environment on you local machine, make sure you have set up your NGI credentials.
108-
You need to generate Personal Access Token (PAT). Follow
109-
[this guide](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate)
110-
for how to get a PAT via the Azure DevOps GUI. `Packaging (Read)` access is sufficient.
111-
112-
After generating the PAT, run this command:
113-
114-
poetry config http-basic.ngi-fm build <PAT>
115-
116114
Then, from the project root folder run:
117115

118116
poetry install
119117

120118

121-
122119
# Build and Test
123120

124121
Run in the project root folder:
125122

126123
poetry install
127-
pytest
124+
poetry run pytest
128125

129126
Build the package wheel:
130127

131128
poetry build
132129

130+
# Contribute
133131

134-
# Publish
135-
136-
To publish the package to NGI's private Azure Artifacts repository set the following configuration:
137-
138-
poetry config repositories.ngi https://pkgs.dev.azure.com/ngi001/277b2f77-691a-4d92-bd89-8e7cac121676/_packaging/fieldmanager/pypi/upload
139-
140-
To publish the package to Azure Artifacts, make sure you have set up your NGI credentials.
141-
142-
You need to generate Personal Access Token (PAT). Follow
143-
[this guide](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate)
144-
for how to get a PAT via the Azure DevOps GUI. `Packaging (Read, write, & manage)` access is sufficient.
145-
146-
If you want to publish your newly built package you need to set your NGI credentials:
147-
148-
poetry config pypi-token.ngi <PAT>
149-
150-
poetry publish -r ngi
151-
152-
# TODOs
153-
154-
- Add tests
155-
- Extend with position transformation from file data srid (input) to project srid (output)
156-
- Extend with position transformation from file srid (input) to new output fields in wgs84
132+
Please start by adding an issue before submitting any pull requests.

0 commit comments

Comments
 (0)