Skip to content

Commit

Permalink
Add a packaged project skeleton
Browse files Browse the repository at this point in the history
The setup includes:

    * a yamllint config

    * an RTD config

    * a gitignore

    * lock files in the `requirements/` dir

    * basic Sphinx config

    * a tox workflow config having environments for

        * building docs

        * running tests

        * pip-compile

        * making lock files

        * integrating per-platform lock files

    * basic linting configs

    * pytest config with coverage

        * Coverage.py is configured to exclude tests marked with
          `xfail` due to their non-deterministic nature

    * CI/CD setup

        * publishing to PyPI is limited to the upstream repo ID

        * continuous publishing to TestPyPI is disabled

        * tox environments are configured to surface exported outcomes
          into GitHub Actions job summaries

        * tox environments set outputs that integrate with GitHub
          Actions

        * refreshing lock files periodically
  • Loading branch information
webknjaz committed Aug 27, 2024
1 parent 49c08a4 commit 1979a7b
Show file tree
Hide file tree
Showing 72 changed files with 4,932 additions and 6 deletions.
45 changes: 45 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---

codecov:
notify:
# after_n_builds: 24 # Number of test matrix+lint jobs uploading coverage
wait_for_ci: false

require_ci_to_pass: false

token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # repo-scoped

comment:
require_changes: true

coverage:
range: 100..100
status:
project:
default:
target: 100%
lib:
flags:
- pytest
paths:
- src/awx/plugins/credentials/**/*.py
target: 100%
tests:
flags:
- pytest
paths:
- tests/
target: 100%
typing:
flags:
- MyPy
target: 100%
typing-stubs:
flags:
- MyPy
paths:
- >-
**/*.pyi
target: 100%

...
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
ignore-words = docs/spelling_wordlist.txt
ignore-words-list = THIRDPARTY
34 changes: 34 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[html]
directory = .test-results/pytest/cov/
show_contexts = true
skip_covered = false

[paths]
source =
src
*/src
*\src
*/lib/python*/site-packages
*/pypy*/site-packages
*\Lib\site-packages

[report]
skip_covered = true
skip_empty = true
show_missing = true
exclude_also =
^\s*@pytest\.mark\.xfail

[run]
branch = true
cover_pylib = false
# https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts
# dynamic_context = test_function # conflicts with `pytest-cov` if set here
parallel = true
plugins =
covdefaults
relative_files = true
source =
tests
source_pkgs =
awx_plugins.credentials.x.api
9 changes: 9 additions & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[darglint]
# NOTE: All `darglint` styles except for `sphinx` hit ridiculously low
# NOTE: performance on some of the in-project Python modules.
# Refs:
# * https://github.com/terrencepreilly/darglint/issues/186
# * https://github.com/wemake-services/wemake-python-styleguide/issues/2287
docstring_style = sphinx
enable = DAR104
strictness = full
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = True

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = True
trim_trailing_whitespace = True

[*.{bat,cmd,ps1}]
end_of_line = crlf

[*.{js,json,json5,yml,yaml,md,rb}]
indent_size = 2

[Makefile]
indent_style = tab
134 changes: 134 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
[flake8]

# Print the total number of errors:
count = true

# Don't even try to analyze these:
extend-exclude =
# Circle CI configs
.circleci,
# No need to traverse egg info dir
*.egg-info,
# GitHub configs
.github,
# Cache files of MyPy
.mypy_cache,
# Cache files of pytest
.pytest_cache,
# Temp dir of pytest-testmon
.tmontmp,
# Countless third-party libs in venvs
.tox,
# Occasional virtualenv dir
.venv,
# VS Code
.vscode,
# Temporary build dir
build,
# This contains sdists and wheels that we don't want to check
dist,
# Metadata of `pip wheel` cmd is autogenerated
pip-wheel-metadata,

# IMPORTANT: avoid using ignore option, always use extend-ignore instead
# Completely and unconditionally ignore the following errors:
extend-ignore =
# Legitimate cases, no need to "fix" these violations:
# E501: "line too long", its function is replaced by `flake8-length`
E501,
# W505: "doc line too long", its function is replaced by `flake8-length`
W505,
# S101: MyPy requires `asserts`, plus they're not bad if cooked well
S101,
# WPS300: "Found local folder import" -- nothing bad about this
WPS300,
# WPS305: "Found f string" -- nothing bad about this
WPS305,
# An opposite consistency expectation is currently enforced
# by pylint via: useless-object-inheritance (R0205):
# WPS306: "Found class without a base class: *" -- nothing bad about this
WPS306,
# WPS317 enforces weird indents
WPS317,
# WPS318 enforces weird indents too
WPS318,
# WPS326: "Found implicit string concatenation" -- nothing bad about this
WPS326,
# WPS422: "Found future import: *" -- we need these for multipython
WPS422,

# IMPORTANT: avoid using select option, always use extend-select instead
# Enable the following errors:
extend-select =
# B950: "line too long", longer than `max-line-length` + 10%
B950,

# https://wemake-python-stylegui.de/en/latest/pages/usage/formatter.html
format = wemake

# Let's not overcomplicate the code:
max-complexity = 10

# Accessibility/large fonts and PEP8 friendly.
# This is being flexibly extended through the `flake8-length`:
max-line-length = 79

# Allow certain violations in certain files:
# Please keep both sections of this list sorted, as it will be easier for others to find and add entries in the future
per-file-ignores =
# The following ignores have been researched and should be considered permanent
# each should be preceded with an explanation of each of the error codes
# If other ignores are added for a specific file in the section following this,
# these will need to be added to that line as well.

# There are multiple `assert`s (S101)
# and subprocesses (import – S404; call – S603) in tests;
# also, using fixtures looks like shadowing the outer scope (WPS442);
# furthermore, we should be able to import and test private attributes
# (WPS450) and modules (WPS436), and finally it's impossible to
# have <= members in tests (WPS202), including many local vars (WPS210),
# additionally test docstrings don't need param lists (DAR, DCO020):
tests/**.py: DAR, DCO020, S101, S404, S603, WPS202, WPS210, WPS436, WPS442, WPS450

# Count the number of occurrences of each error/warning code and print a report:
statistics = true

# ## Plugin-provided settings: ##

# flake8-eradicate
# E800:
eradicate-whitelist-extend = isort:\s+\w+|Ref:\s+https?:\/\/

# flake8-pytest-style
# PT001:
pytest-fixture-no-parentheses = true
# PT006:
pytest-parametrize-names-type = tuple
# PT007:
pytest-parametrize-values-type = tuple
pytest-parametrize-values-row-type = tuple
# PT023:
pytest-mark-no-parentheses = true

# flake8-rst-docstrings
rst-directives =
spelling
rst-roles =
# Built-in Sphinx roles:
class,
data,
file,
exc,
meth,
mod,
term,
py:class,
py:data,
py:exc,
py:meth,
py:term,
# Sphinx's internal role:
event,

# wemake-python-styleguide
show-source = true
3 changes: 3 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=v[0-9]*)$
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Force LF line endings for text files
* text=auto eol=lf

# Needed for setuptools-scm to work with `git archive`-produced sources from GitHub's tar.gz URLs
.git_archival.txt export-subst

# Blame ignore list entries are expected to always be appended, never edited
.git-blame-ignore-revs merge=union
Loading

0 comments on commit 1979a7b

Please sign in to comment.