Skip to content

Commit

Permalink
Merge pull request #1 from norwegian-geotechnical-institute/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
josteinl committed Aug 27, 2022
2 parents 3d6ee46 + 9c5374a commit 6866af4
Show file tree
Hide file tree
Showing 17 changed files with 624 additions and 321 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Push
on: [push]

jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
poetry-version: ['1.1.14']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: poetry install
- name: Run tests
run: poetry run pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
code-quality:
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
poetry-version: ['1.1.14']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: poetry install
- name: Run black
run: poetry run black . --check
# - name: Run isort
# run: poetry run isort . --check-only --profile black
# - name: Run flake8
# run: poetry run flake8 .
- name: Run mypy
run: poetry run mypy .
- name: Run bandit
run: poetry run bandit .
- name: Run safety
run: poetry run safety check
- name: Check for acceptable licenses
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)"
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release
on:
release:
types:
- created

jobs:
publish:
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
poetry-version: ['1.1.14']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
8 changes: 7 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# NGI Python Projector Package
# NGI Python Coordinate Projector Package
_2022-08-27_

Version 0.0.4

- Remove timezonefinder version requirement.
- Add safety package.

_2022-03-08_

Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Norges Geotekniske Institutt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 12 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# NGI Projector
# Coordinate Projector

[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)

This is the NGI Python package for projecting koordinates.
This is the Norwegian Geotechnical Institute (NGI) Python package for projecting coordinates.
It is a small shim on top of the library [pyproj](https://github.com/pyproj4/pyproj) that again is an interface to
[PROJ](https://proj.org/).

References:



Latest releases see [CHANGES.md](CHANGES.md)

# Installation (end user)

```bash

pip install ngi-projector
pip install coordinate-projector

```

Expand All @@ -23,7 +23,7 @@ pip install ngi-projector
### Project a point

```python
from ngi_projector import Projector
from coordinate_projector import Projector

projector = Projector()

Expand Down Expand Up @@ -63,33 +63,20 @@ print(f"{projected_east=}, {projected_north=}")

Run in the project root folder:

poetry install pytest
poetry shell pytest

Build the package wheel:

poetry build



# Publish

To publish the package to NGI's private Azure Artifacts repository set the following configuration:

poetry config repositories.ngi https://pkgs.dev.azure.com/ngi001/277b2f77-691a-4d92-bd89-8e7cac121676/_packaging/fieldmanager/pypi/upload

To publish the package to Azure Artifacts, make sure you have set up your NGI credentials.

You need to generate Personal Access Token (PAT). Follow
[this guide](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate)
for how to get a PAT via the Azure DevOps GUI. `Packaging (Read, write, & manage)` access is sufficient.

If you want to publish your newly built package you need to set your NGI credentials:

poetry config pypi-token.ngi <PAT>

poetry publish -r ngi

# TODOs

- Handle lines
- Handle polygons

# Contribute

Please start by adding an issue before submitting any pull requests.

76 changes: 0 additions & 76 deletions azure-pipelines.yml

This file was deleted.

0 comments on commit 6866af4

Please sign in to comment.