Skip to content

Commit

Permalink
feat: moved to new python package template
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed May 22, 2023
1 parent e528131 commit e7cc917
Show file tree
Hide file tree
Showing 36 changed files with 770 additions and 666 deletions.
11 changes: 0 additions & 11 deletions .bumpversion.cfg

This file was deleted.

6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Please don't file issues directly, use one of our available templates:

Bugs: https://github.com/martibosch/urban-footprinter/issues/new?template=bug.md
Feature Requests: https://github.com/martibosch/urban-footprinter/issues/new?template=feature.md

Thank you.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATES/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- urban-footprinter version:
- Python version:
- Operating System:

### Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

### What I Did

```
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
```
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATES/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Description

Describe your feature request
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Config for Dependabot updates. See Documentation here:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
# Update GitHub actions in workflows
- package-ecosystem: "github-actions"
directory: "/"
# Check for updates to GitHub Actions every weekday
schedule:
interval: "daily"
72 changes: 72 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: dev workflow

on:
push:
branches: [main, develop]

jobs:
test:
strategy:
matrix:
python-versions: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest]
include:
- miniforge-variant: Mambaforge
miniforge-version: 4.11.0-4
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: setup conda environment with mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
use-mamba: true
python-version: ${{ matrix.python-version }}
miniforge-variant: ${{ matrix.miniforge-variant }}
miniforge-version: ${{ matrix.miniforge-version }}

- name: install dependencies
run: pip install tox tox-gh-actions

- name: test with tox
run: tox
env:
CONDA_EXE: mamba

- name: upload coverage reports to Codecov
uses: codecov/codecov-action@v3

- name: list files
run: ls -l .

publish_dev_build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: list files
run: ls -l .

- name: build wheels and source tarball
run: |
python -m build
twine check --strict dist/*
- name: publish to test pypi
uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'push' # This step will only run on pushes
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: release

on:
push:
tags:
- "v*"

jobs:
release:
name: create release
runs-on: ubuntu-latest

strategy:
matrix:
python-versions: ["3.10"]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: generate change log
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
issues: true
issuesWoLabels: true
pullRequests: true
prWoLabels: true
unreleased: true
addSections: '{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}'
sinceTag: v0.1.0
output: RELEASE-CHANGELOG.md

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-versions }}

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: build wheels and source tarball
run: |
python -m build
twine check --strict dist/*
- name: show temporary files
run: ls -l

- name: create github release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ./RELEASE-CHANGELOG.md
files: dist/*.whl
draft: false
prerelease: false

- name: publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
72 changes: 72 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
ci:
autofix_commit_msg: "style(pre-commit.ci): auto fixes from pre-commit hooks"
autoupdate_commit_msg: "style(pre-commit.ci): pre-commit autoupdate"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/commitizen-tools/commitizen
rev: v2.42.1
hooks:
- id: commitizen

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.6
hooks:
- id: prettier
additional_dependencies: [prettier, prettier-plugin-toml, prettier-plugin-ini]
types: ["ini", "toml", "yaml"]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16 # Use the ref you want to point at
hooks:
- id: mdformat
# Optionally add plugins
additional_dependencies:
- mdformat-gfm
- mdformat-black

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.30.0
hooks:
- id: yamllint
args: ["-d relaxed"]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.22.0
hooks:
- id: check-github-workflows

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.260
hooks:
- id: ruff
args: ["--fix"]
- id: ruff

- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
args: ["--keep-output"]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-black
- id: nbqa-ruff
16 changes: 11 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: mambaforge-4.10

conda:
environment: docs/environment.yml

python:
install:
- requirements: requirements.txt
- requirements: requirements-dev.txt
- method: pip
path: .
install:
- method: pip
path: .
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## 0.2.0 (04/03/2020)

* `compute_footprint_mask_shp` returns shapely `GeometryCollection` instead of single geometry
* Changed `largest_patch_only` to more flexible `num_patches` argument
- `compute_footprint_mask_shp` returns shapely `GeometryCollection` instead of single geometry
- Changed `largest_patch_only` to more flexible `num_patches` argument

## 0.1.0 (22/11/2019)

* Added object-oriented approach
* Fix bug: ensure `np.uint8` data type for `urban_mask`
- Added object-oriented approach
- Fix bug: ensure `np.uint8` data type for `urban_mask`

## 0.0.1 (21/10/2019)

* First release
- First release
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing

Contributions are always greatly appreciated and credit will always be given.

## Types of contributions

### Report bugs

Report bugs at https://github.com/martibosch/urban-footprinter/issues.

If you are reporting a bug, please include:

- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.

### Fix bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it.

### Implement features

Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.

## Pull request guidelines

Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
1. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.md.
1. The pull request should work for Python 3.8, 3.9, 3.10 and 3.11. Check https://github.com/martibosch/urban-footprinter/actions and make sure that the tests pass for all supported Python versions.
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit e7cc917

Please sign in to comment.