diff --git a/.copier-answers.yml b/.copier-answers.yml index ffb42e8..7083dd3 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,10 +1,10 @@ -# Changes here will be overwritten by Copier -_commit: 0.1.0 +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +_commit: 0.1.2 _src_path: https://github.com/Ingenjorsarbete-For-Klimatet/ifk-python-template.git author: Mladen Gibanica +badge_gistid: e2326bc24f74f346a118a97b09e852ec email: 11275336+mgcth@users.noreply.github.com module_name: lantmateriet package_name: geometry project_description: Parse data from Lantmäteriet. project_name: ifk-lantmateriet -badge_gistid: e2326bc24f74f346a118a97b09e852ec diff --git a/.github/workflows/github-action-pypi.yaml b/.github/workflows/github-action-pypi.yaml new file mode 100644 index 0000000..7e97cee --- /dev/null +++ b/.github/workflows/github-action-pypi.yaml @@ -0,0 +1,44 @@ +name: Build and publish to PyPi +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Build package + run: | + python -m pip install -U pip build + python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + pypi--build-publish: + environment: release + permissions: + id-token: write + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/github-action-build.yaml b/.github/workflows/github-action-test.yaml similarity index 80% rename from .github/workflows/github-action-build.yaml rename to .github/workflows/github-action-test.yaml index 3905ed9..c1644e8 100644 --- a/.github/workflows/github-action-build.yaml +++ b/.github/workflows/github-action-test.yaml @@ -1,10 +1,11 @@ -name: Build +name: Test on: [push] jobs: - build: - runs-on: ubuntu-latest + test: + runs-on: ${{ matrix.os }} strategy: matrix: + os: [ubuntu-latest, windows-latest, macos-latest] python-version: ["3.10", "3.11", "3.12"] steps: @@ -15,9 +16,6 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable - sudo apt-get update - sudo apt-get install gdal-bin libgdal-dev python -m pip install --upgrade pip pip install -e ".[test]" - name: Test with pytest @@ -25,10 +23,12 @@ jobs: python -m pytest --cov-report term-missing --cov=src tests coverage json - name: Export summary stats + if: runner.os != 'Windows' && matrix.python-version == '3.11' run: | export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") echo "total=$TOTAL" >> $GITHUB_ENV - name: Coverage badge + if: runner.os != 'Windows' && matrix.python-version == '3.11' uses: schneegans/dynamic-badges-action@v1.6.0 with: auth: ${{ secrets.BADGE_SECRET }} @@ -38,4 +38,4 @@ jobs: message: ${{ env.total }}% minColorRange: 50 maxColorRange: 90 - valColorRange: ${{ env.total }} + valColorRange: ${{ env.total }} \ No newline at end of file diff --git a/README.md b/README.md index c5c761f..8e99a68 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@
- - + + - - + + @@ -35,29 +35,5 @@ ## Description -Welcome to ifk-lantmateriet. +Welcome to ifk-lantmateriet. This repo contains code to parse data from Lantmäteriet. -## Configuration - -When you start a new project, apart from the obvious changes, -there are some details to consider. - -- Build workflow, follow the guide in [dynamic badges](https://github.com/Schneegans/dynamic-badges-action). -- To build docs, change `branch` in `github/workflows/github-action-docs.yaml` -from `["SET_TO_MAIN"]` to `["main"]`. You also need to activate Pages under repo -Settings/Pages. - -Install `copier` (install `pipx` through `pip`) as - -```bash -pipx install copier -``` - -and then do - -```bash -copier copy https://github.com/Ingenjorsarbete-For-Klimatet/ifk-python-template.git /path/to/project-name -``` - -Copier supports updating projects based on templates when the template updates. -See copier docs. diff --git a/pyproject.toml b/pyproject.toml index a0c3f4b..6e1b6f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,13 +12,13 @@ authors = [ { name = "Mladen Gibanica", email = "11275336+mgcth@users.noreply.github.com" }, ] requires-python = ">=3.9" -dependencies = ["geopandas ~= 0.14", "pyogrio ~= 0.6.0", "pyarrow ~= 14.0"] +dependencies = ["geopandas ~= 0.14", "pyogrio ~= 0.7.0", "pyarrow ~= 14.0"] [project.optional-dependencies] lint = [ "ruff ~= 0.1", ] -type = ["mypy ~= 0.990", "types-requests ~= 2.28", "pandas-stubs ~= 1.5"] +type = ["mypy ~= 1.7", "types-requests ~= 2.28", "pandas-stubs ~= 1.5"] test = ["pytest ~= 7.1", "coverage ~= 6.5", "pytest-cov ~= 4.0"] doc = [ "mkdocs ~= 1.4",