Add project skeleton

This commit is contained in:
Corentin Sechet 2022-03-18 17:21:37 +01:00
commit 8baa92104b
6 changed files with 166 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
**/__pycache__/**
*.egg-info

54
.prospector.yaml Normal file
View File

@ -0,0 +1,54 @@
output-format: pylint
strictness: veryhigh
test-warnings: true
doc-warnings: true
ignore-paths:
- .env
- backup
- local-settings.py
- mobilidesk/migrations
pylint:
run: true
disable:
- line-too-long # Already checked by pep8
- missing-class-docstring # To tolerate meta classes, not nested classes missing docs are checked by pep8
- too-few-public-methods # Lot of objects can have no method (Graphene Queries...)
- unsubscriptable-object # https://github.com/PyCQA/pylint/issues/3882
- too-many-ancestors # Some type in graphene-django-plus have a big inheritance chain
- too-many-arguments # Some resolve functions have a big number of optional arguments.
mccabe:
run: true
pep257:
run: true
disable:
- D102 # Missing docstring in public method : Not detecting inheritance, already better checked by pylint
- D106 # Missing docstring in public nested class : ignore for meta classes.
- D203 # 1 blank line required before class docstring, we put 0
- D213 # Multi-line comments should start at the second line, we require one blank line after the summary.
- D407 # Missing dashed underline after section
pep8:
options:
max-line-length: 120
disable:
- E261 # At least two spaces before inline comment (we use 1)
pyflakes:
run: true
disable:
- F401 # Module imported but not used. It can be usefull to import all child stuff in packages __init__.py
pyroma:
run: true
mypy:
run: true
options:
ignore-missing-imports: true
strict: true
plugins:
- mypy_drf_plugin.main

0
README.md Normal file
View File

99
setup.py Normal file
View File

@ -0,0 +1,99 @@
#!python
"""Helpers for setuptools to build & install theme-check."""
from pathlib import Path
from re import compile as re_compile
from subprocess import CalledProcessError
from subprocess import DEVNULL
from subprocess import check_output
from typing import Iterable
from typing import Union
from setuptools import setup
def _get_child_directories(path: Path) -> Iterable[Path]:
for child in path.iterdir():
if child.is_dir():
yield child
def _find_packages(root: Union[str, Path]) -> Iterable[str]:
root = Path(root)
init_path = root / '__init__.py'
if init_path.is_file():
yield str(root)
for child in _get_child_directories(root):
for package in _find_packages(child):
yield package
def _get_git_version() -> str:
"""Get package version from git tags."""
pattern = re_compile(
r'^v(?P<version>\d*\.\d*\.\d*)(-\d*-g(?P<commit>\d*))?'
)
try:
command = [
'git', 'describe',
'--tags',
'--match', 'v[0-9]*.[0-9]*.[0-9]*'
]
version_bytes = check_output(command, stderr=DEVNULL)
git_version = version_bytes.decode('utf-8')
match = pattern.match(git_version)
if match is not None:
commit = match.group('commit')
git_version = match.group('version')
if commit is not None:
git_version = f'{git_version}.dev{commit}'
return git_version.rstrip()
except CalledProcessError:
pass
return '0.0.0'
def _get_long_description() -> str:
with open('README.md', encoding='utf-8') as readme:
return readme.read()
setup(
name='theme-check',
version=_get_git_version(),
description='Generate compiled css diff from scss files diff',
long_description=_get_long_description(),
long_description_content_type="text/markdown",
license='WTFPL',
url='https://git.entrouvert.org/theme-check.git',
author='Entr\'ouvert',
author_email='contact@entrouvert.org',
packages=list(_find_packages('theme_check')),
entry_points={
'console_scripts': [
'theme-check = theme_check.main:main'
],
},
# See list at https://pypi.python.org/pypi?:action=list_classifiers
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.9',
'Environment :: Web Environment',
],
keywords=['scss', 'Web'],
include_package_data=True,
install_requires=[
'click',
'playwright'
],
zip_safe=False,
)

0
theme_check/__init__.py Normal file
View File

11
theme_check/main.py Normal file
View File

@ -0,0 +1,11 @@
from click import command
from sys import exit
@command()
def cli():
print('main')
def main():
exit(cli())