-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from nick-solly/initial
Initial commits
- Loading branch information
Showing
40 changed files
with
1,171 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name-template: $RESOLVED_VERSION | ||
tag-template: v$RESOLVED_VERSION | ||
change-template: "- $TITLE @$AUTHOR (#$NUMBER)" | ||
version-resolver: | ||
major: | ||
labels: | ||
- major | ||
minor: | ||
labels: | ||
- minor | ||
patch: | ||
labels: | ||
- patch | ||
default: patch | ||
categories: | ||
- title: ':rocket: Features' | ||
label: feat | ||
- title: ':bug: Bug Fixes' | ||
label: fix | ||
- title: ':racehorse: Performance' | ||
label: perf | ||
- title: ':computer: Developer Changes' | ||
labels: | ||
- chore | ||
- refactor | ||
- style | ||
- test | ||
- title: ':pencil: Documentation' | ||
labels: | ||
- docs | ||
- title: ':wrench: DevOps' | ||
labels: | ||
- ci | ||
- build | ||
exclude-labels: | ||
- skip-changelog | ||
replacers: | ||
# Strip semantic PR title prefixes | ||
- search: /(build|ci|chore|docs|feat|fix|perf|refactor|style|test)\((\w+)\):\s?/g | ||
replace: "$2: " | ||
- search: /(build|ci|chore|docs|feat|fix|perf|refactor|style|test):\s?/g | ||
replace: "" | ||
autolabeler: | ||
- label: minor | ||
title: | ||
- /^feat/ | ||
- label: feat | ||
title: | ||
- /^feat/ | ||
- label: fix | ||
title: | ||
- /^fix/ | ||
- label: perf | ||
title: | ||
- /^perf/ | ||
- label: chore | ||
title: | ||
- /^chore/ | ||
- label: style | ||
title: | ||
- /^style/ | ||
- label: test | ||
title: | ||
- /^test/ | ||
- label: refactor | ||
title: | ||
- /^refactor/ | ||
- label: ci | ||
title: | ||
- /^ci/ | ||
- label: build | ||
title: | ||
- /^build/ | ||
- label: docs | ||
title: | ||
- /^docs/ | ||
template: $CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- uses: pre-commit/action@v3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Pycharm | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
repos: | ||
- repo: https://github.com/timothycrosley/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/ambv/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
args: [--target-version, py39] | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
[ | ||
flake8-bugbear==20.11.1, | ||
flake8-builtins==1.5.3, | ||
] | ||
- repo: local | ||
hooks: | ||
- id: unittest | ||
name: Run Python Tests | ||
entry: python -m unittest | ||
language: python | ||
types: [ python ] | ||
pass_filenames: false | ||
verbose: true | ||
additional_dependencies: ["django>=3.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
config { | ||
disabled_by_default = false | ||
module = false | ||
} | ||
|
||
rule "terraform_comment_syntax" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_deprecated_index" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_deprecated_interpolation" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_documented_outputs" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_documented_variables" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_module_pinned_source" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_module_version" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_naming_convention" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_required_providers" { | ||
enabled = false | ||
} | ||
|
||
rule "terraform_required_version" { | ||
enabled = false | ||
} | ||
|
||
rule "terraform_standard_module_structure" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_typed_variables" { | ||
enabled = false | ||
} | ||
|
||
rule "terraform_unused_declarations" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_unused_required_providers" { | ||
enabled = true | ||
} | ||
|
||
rule "terraform_workspace_remote" { | ||
enabled = true | ||
} | ||
|
||
plugin "aws" { | ||
enabled = true | ||
version = "0.21.0" | ||
source = "github.com/terraform-linters/tflint-ruleset-aws" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include LICENSE | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# django-erd | ||
Generate an Entity Relationship Diagram (ER Diagram) from Django Models | ||
# django-diagram | ||
Generate an Entity Relationship Diagram for a Django project in Mermaid format | ||
|
||
 | ||
|
||
## Installation | ||
|
||
You can install via pip: | ||
|
||
```bash | ||
pip install django-diagram | ||
``` | ||
|
||
## Usage | ||
|
||
Navigate to the directory containing your Django project (the folder containing manage.py) and run: | ||
|
||
```bash | ||
python -m django_diagram | ||
``` | ||
|
||
The following options are available: | ||
|
||
`--settings=project.settings.local` - The dotted path to the settings module | ||
(either this option must be provided or the `DJANGO_SETTINGS_MODULE` environment | ||
variable must be set) | ||
|
||
`--title="My Title"` - The title to use for the diagram | ||
|
||
`--app=app_name` - Restrict to only a particular Django app | ||
|
||
`--output=diagram.txt` - The output file to write the diagram, if this option | ||
is not provided the output will be written to stdout |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import argparse | ||
import os | ||
|
||
from django_diagram.app import App | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
description="Generate a Mermaid Entity Relationship Diagram for Django Models", | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter, | ||
) | ||
|
||
parser.add_argument( | ||
"-s", | ||
"--settings", | ||
type=str, | ||
required=False, | ||
default="", | ||
help="Override Django Settings Module", | ||
) | ||
parser.add_argument( | ||
"-t", | ||
"--title", | ||
type=str, | ||
required=False, | ||
default="", | ||
help="Diagram Title", | ||
) | ||
parser.add_argument( | ||
"-a", | ||
"--app", | ||
type=str, | ||
required=False, | ||
default="", | ||
help="Django app name", | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--output", | ||
type=str, | ||
required=False, | ||
default="", | ||
help="Output file name", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
django_settings_module = args.settings or os.environ.get("DJANGO_SETTINGS_MODULE") | ||
if not django_settings_module: | ||
raise Exception( | ||
"No Django Settings Module - either set the environment variable DJANGO_SETTINGS_MODULE or use the --settings argument." | ||
) | ||
|
||
app = App( | ||
django_settings_module=django_settings_module, | ||
title=args.title, | ||
app_name=args.app, | ||
output=args.output, | ||
) | ||
|
||
app.run() |
Oops, something went wrong.