Skip to content

Commit

Permalink
Merged PR 2555: Release 0.0.3
Browse files Browse the repository at this point in the history
**Breaking change**

- Removed the Projector.get_transformer() method and changed the method signature to Projector.transform(from_srid, to_srid, from_east, from_north).
- Update CHANGES.md.
- Bump version number to 0.0.3.

Related work items: #5558, #5559
  • Loading branch information
josteinl committed Mar 8, 2022
2 parents 1fe49bb + 0bc57eb commit 3d6ee46
Show file tree
Hide file tree
Showing 21 changed files with 791 additions and 722 deletions.
142 changes: 142 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
test-output.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

#Ides
.idea/
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# NGI Python Projector Package

_2022-03-08_

Version 0.0.3

- Breaking change: Removed the Projector.get_transformer() method and changed the
method signature to Projector.transform(from_srid, to_srid, from_east, from_north).
- Add two new methods ensure_tz() and datetime_to_json().

_2022-03-02_

Version 0.0.1
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ to_srid = "3857"
# Paris Lat(48.8589506) Lon(2.2768485) EPSG:4326
from_east, from_north = 2.2768485, 48.8589506

transformer = projector.get_transformer(f"{from_srid}-{to_srid}")
projected_east, projected_north = projector.transform(transformer, from_east, from_north)
projected_east, projected_north = projector.transform(from_srid, to_srid, from_east, from_north)

# Paris Lat(6250962.06) Lon(253457.62) EPSG:3857 is in metres - 2D projection
assert abs(projected_east - 253457.62) <= 0.01
Expand Down
26 changes: 25 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,27 @@ trigger:
- develop
- main

resources:
repositories:
- repository: ngi-shared-artifacts
type: git
name: ngi-shared-artifacts

pool:
vmImage: ubuntu-latest

steps:
- checkout: self
- checkout: ngi-shared-artifacts

- task: CopyFiles@2
displayName: copy projections.json from ngi-shared-artifacts
inputs:
Contents: "$(Build.SourcesDirectory)/ngi-shared-artifacts/gis/projections.json"
TargetFolder: "$(Build.SourcesDirectory)/ngi-projector/src/ngi_projector/"
OverWrite: true
flattenFolders: true

- task: UsePythonVersion@0
inputs:
versionSpec: "3.9"
Expand All @@ -22,26 +39,32 @@ steps:
pip install twine
poetry install
displayName: "Install dependencies"
workingDirectory: "$(Build.SourcesDirectory)/ngi-projector"
- script: |
poetry run bandit -r src
displayName: "bandit"
workingDirectory: "$(Build.SourcesDirectory)/ngi-projector"
- script: |
poetry run mypy src
poetry run mypy src tests
displayName: "mypy"
workingDirectory: "$(Build.SourcesDirectory)/ngi-projector"
- script: |
poetry run pytest . --cov tests --cov src --cov-report html
displayName: "pytest"
workingDirectory: "$(Build.SourcesDirectory)/ngi-projector"
- script: poetry version $(poetry version -s)-dev.$(Build.BuildId)
displayName: "Add pre-release version"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
workingDirectory: "$(Build.SourcesDirectory)/ngi-projector"

- script: |
poetry build
displayName: "Build package"
workingDirectory: "$(Build.SourcesDirectory)/ngi-projector"
- task: TwineAuthenticate@1
inputs:
Expand All @@ -50,3 +73,4 @@ steps:
- script: |
twine upload -r fieldmanager --config-file $(PYPIRC_PATH) dist/*.whl
displayName: Upload package to Azure Artifact
workingDirectory: "$(Build.SourcesDirectory)/ngi-projector"
6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[mypy]

[mypy-timezonefinder.*]
# The timezonefinder package has a merged PR that will enable typing, so next release
# of timezonefinder (version > 5.2.0) should allow for mypy type checking
ignore_missing_imports = True

0 comments on commit 3d6ee46

Please sign in to comment.