Initial commit

This commit is contained in:
Ethan Paul 2022-02-07 18:00:56 -05:00
commit c76628d97e
No known key found for this signature in database
GPG Key ID: 6A337337DF6B5B1A
14 changed files with 2354 additions and 0 deletions

7
.coveragerc Normal file
View File

@ -0,0 +1,7 @@
[run]
branch = True
[report]
exclude_lines =
\.\.\.
pass

109
.gitignore vendored Normal file
View File

@ -0,0 +1,109 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
requirements.txt
# 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/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
docs/awesome_template*.rst
docs/modules.rst
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# dotenv
.env
# virtualenv
.venv
venv/
ENV/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
# Pycharm
.idea/
.idea/vcs.xml

66
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,66 @@
---
repos:
- repo: local
hooks:
- id: end-of-file-fixer
name: end-of-file-fixer
entry: end-of-file-fixer
language: system
types:
- text
- id: fix-encoding-pragma
name: fix-encoding-pragma
entry: fix-encoding-pragma
language: system
args:
- "--remove"
types:
- python
- id: trailing-whitespace-fixer
name: trailing-whitespace-fixer
entry: trailing-whitespace-fixer
language: system
types:
- text
- id: check-merge-conflict
name: check-merge-conflict
entry: check-merge-conflict
language: system
types:
- text
- id: reorder-python-imports
name: reorder-python-imports
entry: reorder-python-imports
language: system
args:
- "--unclassifiable-application-module=section7"
types:
- python
- id: black
name: black
entry: black
language: system
types:
- python
- id: blacken-docs
name: blacken-docs
entry: blacken-docs
language: system
types:
- text
- id: mdformat
name: mdformat
entry: mdformat
language: system
args:
- "--number"
- "--wrap=90"
types:
- markdown

53
.pylintrc Normal file
View File

@ -0,0 +1,53 @@
[MESSAGES CONTROL]
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=logging-fstring-interpolation
,logging-format-interpolation
,bad-continuation
,line-too-long
,ungrouped-imports
,typecheck
,wrong-import-order
,wrong-import-position
,missing-module-docstring
,fixme
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio).You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=colorized
[BASIC]
# Good variable names which should always be accepted, separated by a comma
good-names=_,ip,T
[SIMILARITIES]
# Ignore imports when computing similarities.
ignore-imports=yes
# Ignore function signatures when computing similarities.
ignore-signatures=yes
# Minimum lines number of a similarity.
min-similarity-lines=10
[DESIGN]
# Maximum number of arguments for function / method
max-args=7

40
Makefile Normal file
View File

@ -0,0 +1,40 @@
# section7 makefile
.PHONY: help
# Put it first so that "make" without argument is like "make help"
# Adapted from:
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## List Makefile targets
$(info Makefile documentation)
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
clean-tox:
rm --recursive --force ./.mypy_cache
rm --recursive --force ./.tox
rm --recursive --force tests/__pycache__/
rm --recursive --force .pytest_cache/
rm --force .coverage
clean-py:
rm --recursive --force ./dist
rm --recursive --force ./build
rm --recursive --force ./*.egg-info
rm --recursive --force ./**/__pycache__/
clean: clean-tox clean-py; ## Clean temp build/cache files and directories
wheel: ## Build Python binary distribution wheel package
poetry build --format wheel
source: ## Build Python source distribution package
poetry build --format sdist
test: ## Run the project testsuite(s)
poetry run tox --recreate
dev: ## Create the local dev environment
poetry install --remove-untracked
poetry run pre-commit install
publish: test wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set)
@poetry publish --username __token__ --password $(PYPI_API_KEY)

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# disclosemypay.org
Website for privately sharing compensation details with coworkers

1905
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

43
pyproject.toml Normal file
View File

@ -0,0 +1,43 @@
[tool.poetry]
name = "section7"
version = "0.1.0"
license = "MIT"
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
description = "Website for privately disclosing compensation details with coworkers"
repository = "https://github.com/enpaul/disclosemypay.org/"
packages = [
{include = "section7"},
{include = "tests/*.py", format = "sdist"}
]
include = [
"section7/py.typed"
]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
[tool.poetry.dev-dependencies]
bandit = "^1.6.2"
black = "^22.1.0"
blacken-docs = "^1.8.0"
ipython = "^7.18.1"
mdformat = "^0.6"
mdformat-gfm = "^0.2"
mypy = "^0.930"
poetry = "^1.1.0"
pre-commit = "^2.7.1"
pre-commit-hooks = "^3.3.0"
pylint = "^2.4.4"
pytest = "^6.0.2"
pytest-cov = "^2.10.1"
reorder-python-imports = "^2.3.5"
safety = "^1.9.0"
toml = "^0.10.1"
tox = "^3.20.0"
tox-poetry-installer = {version = "^0.8.3", extras = ["poetry"]}
types-toml = "^0.10.1"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

7
section7/__about__.py Normal file
View File

@ -0,0 +1,7 @@
# pylint: disable=missing-docstring
__title__ = "section7"
__summary__ = "Website for privately disclosing compensation details with coworkers"
__version__ = "0.1.0"
__url__ = "https://github.com/enpaul/disclosemypay.org/"
__license__ = "MIT"
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]

0
section7/__init__.py Normal file
View File

0
section7/py.typed Normal file
View File

0
tests/__init__.py Normal file
View File

37
tests/test_metadata.py Normal file
View File

@ -0,0 +1,37 @@
"""Ensure that the pyproject and module metadata never drift out of sync
The next best thing to having one source of truth is having a way to ensure all of your
sources of truth agree with each other.
"""
from pathlib import Path
import toml
from section7 import __about__
def test_metadata():
"""Test that module metadata matches pyproject poetry metadata"""
with (Path(__file__).resolve().parent / ".." / "pyproject.toml").open() as infile:
pyproject = toml.load(infile, _dict=dict)
assert pyproject["tool"]["poetry"]["name"] == __about__.__title__
assert pyproject["tool"]["poetry"]["version"] == __about__.__version__
assert pyproject["tool"]["poetry"]["license"] == __about__.__license__
assert pyproject["tool"]["poetry"]["description"] == __about__.__summary__
assert pyproject["tool"]["poetry"]["repository"] == __about__.__url__
assert (
all(
item in __about__.__authors__
for item in pyproject["tool"]["poetry"]["authors"]
)
is True
)
assert (
all(
item in pyproject["tool"]["poetry"]["authors"]
for item in __about__.__authors__
)
is True
)

84
tox.ini Normal file
View File

@ -0,0 +1,84 @@
[tox]
envlist = py310, static, static-tests, security
isolated_build = true
skip_missing_interpreters = true
[testenv]
description = Run the tests
require_locked_deps = true
require_poetry = true
locked_deps =
pytest
pytest-cov
toml
commands =
pytest {toxinidir}/tests/ \
--cov {toxinidir}/section7 \
--cov-config {toxinidir}/.coveragerc \
--cov-report term-missing
[testenv:static]
description = Static formatting and quality enforcement
platform = linux
ignore_errors = true
locked_deps =
black
blacken-docs
mdformat
mdformat-gfm
mypy
reorder-python-imports
pre-commit
pre-commit-hooks
pylint
types-toml
commands =
pre-commit run \
--all-files
pylint {toxinidir}/section7/ \
--rcfile {toxinidir}/.pylintrc
mypy {toxinidir}/section7/ \
--ignore-missing-imports \
--no-strict-optional
[testenv:static-tests]
description = Static formatting and quality enforcement for the tests
platform = linux
ignore_errors = true
locked_deps =
pylint
pytest
mypy
types-toml
commands =
pylint {toxinidir}/tests/ \
--rcfile {toxinidir}/.pylintrc
mypy {toxinidir}/tests/ \
--ignore-missing-imports \
--no-strict-optional
[testenv:security]
description = Security checks
platform = linux
ignore_errors = true
skip_install = true
locked_deps =
bandit
safety
poetry
commands =
bandit {toxinidir}/section7/ \
--recursive \
--quiet
bandit {toxinidir}/tests/ \
--recursive \
--quiet \
--skip B101
poetry export \
--format requirements.txt \
--output {envtmpdir}/requirements.txt \
--without-hashes \
--dev
safety check \
--file {envtmpdir}/requirements.txt \
--json