Skip to content

Commit

Permalink
chore: update project structure to 201e2aa0
Browse files Browse the repository at this point in the history
  • Loading branch information
escaped committed Feb 19, 2021
1 parent 33893d0 commit 8b175ac
Show file tree
Hide file tree
Showing 12 changed files with 377 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/escaped/cookiecutter-pypackage.git",
"commit": "b58e99ccf10eede92dee5810738871726199ecbb",
"commit": "201e2aa005db39b8b3ab854658dc5d8da0822e3a",
"context": {
"cookiecutter": {
"author": "Alexander Frenzel",
Expand Down
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Description

Please include a summary of the proposed changes.

Fixes #(issue)

## Checklist

- [ ] Tests covering the new functionality have been added
- [ ] Code builds clean without any errors or warnings
- [ ] Documentation has been updated
- [ ] Changes have been added to the `CHANGELOG.md`
- [ ] You added yourself to the `CONTRIBUTORS.md`
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}

publish:
needs: [release]
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
steps:
Expand Down
49 changes: 31 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@ on:
push:
branches:
- master
- main

jobs:
lint_cruft:
name: Check if automatic project update was successful
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Fail if .rej files exist as structure update was not successful
run: test -z "$(find . -iname '*.rej')"

lint:
name: Lint
needs: [lint_cruft]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -27,14 +42,17 @@ jobs:

test:
name: Test
needs: [lint_cruft]
runs-on: ${{ matrix.platform }}
strategy:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand All @@ -47,24 +65,19 @@ jobs:
run: tox
env:
PLATFORM: ${{ matrix.platform }}
- name: coveralls
run: coveralls
env:
COVERALLS_PARALLEL: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true

coveralls:
coveralls_finish:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coveralls
- name: coveralls
run: coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

51 changes: 51 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Update project structure
on:
schedule:
- cron: "0 0 * * *" # at the end of every day

jobs:
autoUpdateProject:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8.5

- name: Install dependencies
run: pip install cruft poetry jello

- name: Update project structure
run: |
cruft update -y
- name: Check if there are changes
id: changes
uses: UnicornGlobal/has-changes-action@v1.0.11

- name: apply additional changes and fixes
if: steps.changes.outputs.changed == 1
run: |
poetry lock --no-update # add new dependencies
poetry install
poetry run pre-commit run -a || true # we have to fix other issue manually
- name: Get new template version
if: steps.changes.outputs.changed == 1
# extract new cooiecutter template version
run: |
echo "TEMPLATE_COMMIT=$(cat .cruft.json | jello -r "_['commit'][:8]")" >> $GITHUB_ENV
# behaviour if PR already exists: https://github.com/marketplace/actions/create-pull-request#action-behaviour
- name: Create Pull Request
if: steps.changes.outputs.changed == 1
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.AUTO_UPDATE_GITHUB_TOKEN }}
commit-message: >-
chore: update project structure to ${{ env.TEMPLATE_COMMIT }}
title: "[Actions] Auto-Sync cookiecutter template"
body: ""
branch: chore/cookiecutter-pypackage
delete-branch: true
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ repos:
language: system
entry: poetry run black
types: [python]

- repo: local
hooks:
- id: autoflake
name: autoflake
language: system
entry: poetry run autoflake --expand-star-imports --remove-all-unused-imports --remove-unused-variables --in-place --recursive tests/ django_admin_display/
types: [python]

- repo: local
hooks:
- id: isort
name: isort
language: system
entry: poetry run isort -profile black
entry: poetry run isort
types: [python]

- repo: local
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) Alexander Frenzel.
Copyright (c) Alexander Frenzel <alex@relatedworks.com>.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Simplifies the use of function attributes (eg. `short_description`) for the djan
* Python 3.6.1 or newer
* Django >= 1.11

## Installation

```sh
pip install django-admin-display
```

## Usage

If you want to change the behaviour of how Django displays a read-only value in the admin interface,
Expand All @@ -22,16 +28,16 @@ Supported values are

`short_description`
Customize the column’s title of the callable.

`empty_value_display`
Show this value instead, if the value of a field is `None`, an empty string, or an iterable without elements.

`admin_order_field`
Indicate that the value is represented by a certain database field.

`boolean`
Display a pretty “on” or “off” icon if the method returns a boolean.

`allow_tags` (deprecated since Django 1.9)
Disable auto-escaping.

Expand Down Expand Up @@ -141,6 +147,9 @@ managing all dependencies and [pre-commit](https://pre-commit.com/) to run
[flake8](http://flake8.pycqa.org/), [isort](https://pycqa.github.io/isort/),
[mypy](http://mypy-lang.org/) and [black](https://github.com/python/black).

Additionally, [pdbpp](https://github.com/pdbpp/pdbpp) and [better-exceptions](https://github.com/qix-/better-exceptions) are installed to provide a better debugging experience.
To enable `better-exceptions` you have to run `export BETTER_EXCEPTIONS=1` in your current session/terminal.

Clone this repository and run

```bash
Expand Down

0 comments on commit 8b175ac

Please sign in to comment.