Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Big refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmdln committed Feb 24, 2022
1 parent da9fca8 commit e76e8eb
Show file tree
Hide file tree
Showing 29 changed files with 1,538 additions and 2,220 deletions.
4 changes: 4 additions & 0 deletions .bandit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: AGPL-3.0-or-later

assert_used:
skips: ["**/tests/**/*.py"]
166 changes: 18 additions & 148 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,150 +1,20 @@
# SPDX-License-Identifier: AGPL-3.0-or-later

.github/
.vscode/
docs/
tests/
.gitlab-ci.yml

#
# https://github.com/github/gitignore/blob/14f8a8b4c51ecc00b18905a95c117954e6c77b9d/Python.gitignore
#

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
# Ignore everything
*

# Include these specific files
!LICENSE.md
!README.md
!poetry.lock
!poetry.toml
!pyproject.toml

# Allow searching in and traversing specific directories
!snagctl/
!snagctl/**
!snagd/
!snagd/**

# Include these files from any included directory.
!**/*.py
20 changes: 8 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,31 @@
# Ignore everything
*

# Allow traversing directories
!**/

# Include these specific files
!.bandit.yml
!.dockerignore
!.editorconfig
!.gitignore
!alembic.ini
!Dockerfile
!LICENSE.md
!README.md
!poetry.lock
!poetry.toml
!pyproject.toml
!README.md

# Include GitHub Actions pipeline configuration
!.github/
!.github/workflows/
!.github/workflows/*.yml

# Include our VS Code configuration
!.vscode/
!.vscode/extensions.json
!.vscode/settings.json

# Allow searching in and traversing specific directories
!docs/
!docs/**
!snagctl/
!snagctl/**
!snagd/
!snagd/**

# Include these files from any included directory.
!**/README
!**/*.py
!**/*.mako
!**/*.md
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
{
// Associate files with languages when VSCode gets it wrong
"files.associations": {
// Ensure .dockerignore files in any subdir use .gitignore style
"**/.dockerignore": "ignore",
},
// Hide these directories in the Explorer, and exclude from search
"files.exclude": {
"**/__pycache__/**": true,
Expand Down Expand Up @@ -34,7 +39,7 @@
// flake8 already provides pycodestyle and pydocstyle warnings/errors
"python.linting.pycodestyleEnabled": false,
"python.linting.pydocstyleEnabled": false,
// Sort python imports on save
// Sort python imports on save using isort
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ENV PYTHONDONTWRITEBYTECODE="true" \
VIRTUALENV="/opt/.venv"
RUN dnf --refresh upgrade -y && \
dnf install -y openssl postgresql python3 tzdata && \
dnf autoremove -y && \
dnf clean all
RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime

Expand Down
102 changes: 102 additions & 0 deletions alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = snagd/alembic

# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s

# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory.
prepend_sys_path = .

# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python-dateutil library that can be
# installed by adding `alembic[tz]` to the pip requirements
# string value is passed to dateutil.tz.gettz()
# leave blank for localtime
# timezone =

# max length of characters to apply to the
# "slug" field
# truncate_slug_length = 40

# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false

# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false

# version location specification; This defaults
# to alembic/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "version_path_separator" below.
# version_locations = %(here)s/bar:%(here)s/bat:alembic/versions

# version path separator; As mentioned above, this is the character used to split
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
# Valid values for version_path_separator are:
#
# version_path_separator = :
# version_path_separator = ;
# version_path_separator = space
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.

# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8

sqlalchemy.url = driver://user:pass@localhost/dbname


[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples

# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME

# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

0 comments on commit e76e8eb

Please sign in to comment.