Skip to content

Commit a83b5fa

Browse files
author
Kenneth Nordum
committed
Merged PR 2405: Test new main release
2 parents 9e88a42 + 0a7fe26 commit a83b5fa

File tree

13 files changed

+849
-15
lines changed

13 files changed

+849
-15
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,6 @@ dmypy.json
136136

137137
# Cython debug symbols
138138
cython_debug/
139+
140+
#Ides
141+
.idea/

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# NGI Python KOF Parser
2+
3+
## Version 0.0.1
4+
5+
6+

README.md

Lines changed: 92 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,97 @@
1-
# Introduction
2-
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
1+
# NGI KOF Parser
2+
3+
This is the NGI Python package for parsing kof files.
4+
5+
References:
6+
7+
NORWEGIAN GEOTECHNICAL SOCIETY
8+
- [NGF - VEILEDNING FOR
9+
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)
10+
- [Norkart KOF specification](http://www.anleggsdata.no/wp-content/uploads/2018/04/KOF-BESKRIVELSE-Oppdatert2005.pdf)
11+
12+
Latest releases see [CHANGES.md](CHANGES.md)
13+
14+
# Installation (end user)
15+
16+
```bash
17+
18+
pip install ngi-kof-parser
19+
20+
```
21+
22+
## Basic usage
23+
24+
```python
25+
from ngi_kof_parser import KOFParser
26+
27+
parser = KOFParser()
28+
29+
# ETRS89/NTM10:
30+
srid = 5110
31+
locations = parser.parse('tests/data/test.kof', srid)
32+
33+
for location in locations:
34+
print(location)
35+
36+
# Output:
37+
# name='SMPLOC1' point_easting=112892.81 point_northing=1217083.64 point_z=1.0 srid=5110 methods=[]
38+
# name='SMPLOC2' point_easting=112893.15 point_northing=1217079.46 point_z=2.0 srid=5110 methods=['TOT']
39+
# name='SMPLOC3' point_easting=112891.88 point_northing=1217073.01 point_z=0.0 srid=5110 methods=['CPT']
40+
# name='SMPLOC4' point_easting=112891.9 point_northing=1217067.54 point_z=0.0 srid=5110 methods=['RP']
41+
# name='SMPLOC5' point_easting=112902.92 point_northing=1217074.73 point_z=0.0 srid=5110 methods=['SA']
42+
# name='SMPLOC6' point_easting=112901.11 point_northing=1217069.56 point_z=0.0 srid=5110 methods=['PZ']
43+
# name='SMPLOC7' point_easting=1217069.56 point_northing=112901.11 point_z=0.0 srid=5110 methods=['PZ']
44+
45+
```
46+
47+
# Getting Started developing
48+
49+
1. Software dependencies
50+
51+
- Python 3.9 or higher
52+
- Poetry
53+
- black code formatter
54+
55+
2. Clone this repository
56+
57+
3. Install
58+
59+
`poetry install`
60+
361

4-
# Getting Started
5-
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
6-
1. Installation process
7-
2. Software dependencies
8-
3. Latest releases
9-
4. API references
1062

1163
# Build and Test
12-
TODO: Describe and show how to build your code and run the tests.
1364

14-
# Contribute
15-
TODO: Explain how other users and developers can contribute to make your code better.
65+
Run in the project root folder:
66+
67+
poetry install
68+
pytest
69+
70+
Build the package wheel:
71+
72+
poetry build
73+
74+
75+
# Publish
76+
77+
To publish the package to NGI's private Azure Artifacts repository set the following configuration:
78+
79+
poetry config repositories.ngi https://pkgs.dev.azure.com/ngi001/277b2f77-691a-4d92-bd89-8e7cac121676/_packaging/fieldmanager/pypi/upload
80+
81+
To publish the package to Azure Artifacts, make sure you have set up your NGI credentials.
82+
83+
You need to generate Personal Access Token (PAT). Follow
84+
[this guide](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate)
85+
for how to get a PAT via the Azure DevOps GUI. `Packaging (Read, write, & manage)` access is sufficient.
86+
87+
If you want to publish your newly built package you need to set your NGI credentials:
88+
89+
poetry config pypi-token.ngi <PAT>
90+
91+
poetry publish -r ngi
92+
93+
# TODOs
1694

17-
If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files:
18-
- [ASP.NET Core](https://github.com/aspnet/Home)
19-
- [Visual Studio Code](https://github.com/Microsoft/vscode)
20-
- [Chakra Core](https://github.com/Microsoft/ChakraCore)
95+
- Add tests
96+
- Extend with position transformation from file data srid (input) to project srid (output)
97+
- Extend with position transformation from file srid (input) to new output fields in wgs84

azure-pipelines.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Python package
2+
# Create and test a Python package on multiple Python versions.
3+
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5+
6+
trigger:
7+
- develop
8+
- main
9+
10+
pool:
11+
vmImage: ubuntu-latest
12+
13+
steps:
14+
- task: UsePythonVersion@0
15+
inputs:
16+
versionSpec: "3.9"
17+
displayName: "Use Python 3.9"
18+
19+
- script: |
20+
python -m pip install --upgrade pip
21+
pip install poetry
22+
pip install twine
23+
poetry install
24+
# poetry install --no-dev
25+
displayName: "Install dependencies"
26+
27+
- script: |
28+
poetry run pytest tests/ --cov ngi_kof_parser --cov-report html
29+
displayName: "pytest"
30+
31+
- script: poetry version $(poetry version -s)-dev.$(Build.BuildId)
32+
displayName: "Add pre-release version"
33+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
34+
35+
- script: |
36+
poetry build
37+
displayName: "Build package"
38+
39+
- task: TwineAuthenticate@1
40+
inputs:
41+
artifactFeed: "NGI Digital/fieldmanager"
42+
43+
- script: |
44+
twine upload -r fieldmanager --config-file $(PYPIRC_PATH) dist/*.whl
45+
displayName: Upload package to Azure Artifact

0 commit comments

Comments
 (0)