-
Notifications
You must be signed in to change notification settings - Fork 1
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 #55 from CrumpetDev/setup/tooling-and-env
Setup project tooling (improved DX)
- Loading branch information
Showing
16 changed files
with
158 additions
and
40 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 |
---|---|---|
|
@@ -104,3 +104,5 @@ ZIZW | |
zustand | ||
ifneq | ||
psql | ||
pathspec | ||
pyproject |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,22 +1,24 @@ | ||
from django.db import models | ||
|
||
import uuid | ||
|
||
from django.db import models | ||
|
||
|
||
class Environment(models.Model): | ||
name = models.CharField(max_length=100, blank=False, null=False) | ||
identifier = models.SlugField(max_length=100, blank=False, null=False) | ||
identifier = models.SlugField(max_length=100, blank=False, null=False) | ||
project = models.ForeignKey("Project", on_delete=models.CASCADE, related_name="environments") | ||
is_default = models.BooleanField(default=False, blank=False, null=False) | ||
|
||
class Meta: | ||
unique_together = ["identifier", "project"] | ||
verbose_name = "Environment" | ||
verbose_name_plural = "Environments" | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
def save(self, *args, **kwargs): | ||
if not self.identifier: | ||
# If identifier is not provided, assign a GUID. | ||
self.identifier = str(uuid.uuid4()) | ||
super(Environment, self).save(*args, **kwargs) | ||
|
||
def __str__(self): | ||
return self.name |
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
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
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
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
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,6 +1,6 @@ | ||
# TODO | ||
# Segments are groups of people who share similar characteristics. | ||
# - They can define grouping conditions that use the underlying data (schema) and potentially | ||
# use something like JSON Path https://www.postgresql.org/docs/current/functions-json.html | ||
# - They can define a name and description | ||
# - They can be used to trigger flows => when person enters a segment, trigger a flow | ||
# - They can define grouping conditions that use the underlying data (schema) and potentially | ||
# use something like JSON Path https://www.postgresql.org/docs/current/functions-json.html | ||
# - They can define a name and description | ||
# - They can be used to trigger flows => when person enters a segment, trigger a flow |
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
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,36 @@ | ||
# A Python code formatter | ||
[tool.black] | ||
exclude = ''' | ||
/( | ||
| .git | ||
| .venv | ||
| __pycache__ | ||
)/ | ||
''' | ||
include = '\.pyi?$' # Include .py and .pyi files | ||
line-length = 120 # Set max line length to 120 characters | ||
target-version = ['py310'] # Target Python version (adjust as necessary) | ||
|
||
# A static type checker that helps to catch type errors | ||
[tool.mypy] | ||
disallow_untyped_defs = true # Disallow defining functions without type annotations | ||
ignore_missing_imports = true # Ignore errors for missing imports | ||
plugins = [ | ||
"mypy_django_plugin.main", # Enable Django plugin for MyPy | ||
] | ||
python_version = 3.10 # Target Python version | ||
|
||
# A linting tool that helps find syntax errors, and enforces coding style. | ||
[mypy.plugins.django-stubs] | ||
django_settings_module = "backend.settings" # Point to the project's settings module | ||
|
||
# A tool for sorting imports alphabetically, and automatically separated into sections. | ||
[tool.isort] | ||
ensure_newline_before_comments = true # Ensure a newline before comments | ||
force_grid_wrap = 0 # Don't force grid wrap | ||
include_trailing_comma = true # Include a trailing comma on multi-line | ||
line_length = 120 # Set max line length to 120 characters | ||
multi_line_output = 3 # Use vertical hanging indent format | ||
profile = "black" # Make isort compatible with black | ||
skip = [".venv", "__pycache__", ".git"] # Directories to skip | ||
use_parentheses = true # Use parentheses for line continuation |
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
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
[flake8] | ||
# Set the maximum allowed line length in your Python code | ||
max-line-length = 120 | ||
|
||
# List of patterns to exclude from checks (mostly to speed up linting) | ||
exclude = | ||
.git, # Ignore all files in the .git directory | ||
__pycache__, # Ignore compiled Python files in __pycache__ directories | ||
.venv, # Exclude files in the .venv virtual environment directory | ||
migrations, # Ignore all Django migration files | ||
settings.py, # Ignore Django settings file | ||
|
||
# List of error codes to ignore | ||
ignore = | ||
E203 | ||
E266 | ||
W503 | ||
E501 | ||
F403 | ||
F401 | ||
DJ10 | ||
DJ11 | ||
|
||
# E203 Whitespace before ':' (conflicts with black) | ||
# E266 Too many leading '#' for block comment | ||
# E501 Line too long (handled by max-line-length) | ||
# W503 Line break occurred before a binary operator (conflicts with PEP 8 recommendation) | ||
# F403 ‘from module import *’ used; unable to detect undefined names | ||
# F401 Module imported but unused | ||
# DJ10 Model should define verbose_name on its Meta inner class (flake8-django) | ||
# DJ11 Model should define verbose_name_plural on its Meta inner class (flake8-django) | ||
|
||
# Special rules for specific files | ||
# Ignore "imported but unused" in __init__.py files | ||
per-file-ignores = | ||
__init__.py:F401 |
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 |
---|---|---|
|
@@ -7,3 +7,4 @@ dictionaries: | |
ignorePaths: | ||
- "**/migrations/**" | ||
- "**/node_modules/**" | ||
- "**/.vscode/**" |