-
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.
new: Update setup files and requirements.
- Loading branch information
Showing
6 changed files
with
201 additions
and
20 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 |
---|---|---|
|
@@ -59,4 +59,3 @@ dmypy.json | |
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
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,3 @@ | ||
include README.md | ||
include LICENSE | ||
include requirements*.txt |
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,10 @@ | ||
bandit>=1.7.5 | ||
black>=23.3.0 | ||
isort>=5.12.0 | ||
mypy>=1.4.1 | ||
pycodestyle>=2.10.0 | ||
pydocstyle>=6.3.0 | ||
pylint>=2.17.4 | ||
pytest>=7.3.2 | ||
pytest-cov>=4.1.0 | ||
pytest-xdist>=3.3.1 |
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,107 @@ | ||
[pycodestyle] | ||
exclude=.*,__pycache__,test,*venv,*virtualenv* | ||
# Ignore E402 import not at top of file, pylint will catch and we do not want double ignore lines in the code. | ||
# Ignore E501 line too long, up to maintainers/contributors to use best judgement. | ||
# Ignore E722 bare except, pylint will catch and we do not want double ignore lines in the code. | ||
# Ignore W503 break before binary operator, both W503 and W504 are enabled by default meaning no breaks could be made. | ||
ignore=E402,E501,E722,W503 | ||
|
||
[pydocstyle] | ||
convention=google | ||
match-dir=^(?!\.|__pycache__|test|venv|virtualenv).* | ||
# PEP257 "D204 1 blank line after class docstring" is inconsistent depending on pydocstyle version. Add for consistency. | ||
add-select=D204 | ||
|
||
[pylint] | ||
# Pylint requires a full list of disables, or a full list of includes, and cannot be partially overridden. | ||
# The following list starts with the pylint defaults, followed by project specifics. | ||
# Do not modify the pylint defaults without adding a comment as to why, and only comment out instead of remove. | ||
disable=raw-checker-failed, | ||
bad-inline-option, | ||
locally-disabled, | ||
file-ignored, | ||
suppressed-message, | ||
useless-suppression, | ||
deprecated-pragma, | ||
use-symbolic-message-instead, | ||
# PyAtop specific modifications. | ||
# W1203, allow f-strings to be used in logging messages. | ||
logging-fstring-interpolation, | ||
# C0301 line too long, up to maintainers/contributors to use best judgement. | ||
line-too-long, | ||
# R0801 duplicate code, up to maintainers/contributors to use best judgement. | ||
duplicate-code, | ||
# W0221 arguments-differ, disabled until pylint known is resolved to prevent flagging variadics such as kwargs. | ||
arguments-differ, | ||
# R0903 too-few-public-methods, custom classes are allowed to have low amount of public functions. | ||
too-few-public-methods, | ||
|
||
[pylint.MASTER] | ||
ignore=__pycache__,build,test | ||
# Use jobs 0 to autodetect CPUs on system for parallel performance. | ||
jobs=0 | ||
|
||
[pylint.DESIGN] | ||
max-args=6 | ||
max-attributes=10 | ||
|
||
[pylint.TYPECHECK] | ||
# Property setters and getters are dynamic attributes, allow these to be overridden in subclasses. | ||
generated-members=fset,fget | ||
|
||
[isort] | ||
profile=black | ||
force_single_line=True | ||
|
||
[tool:pytest] | ||
norecursedirs=.* __pycache__ site-packages venv virtualenv virtualenvs | ||
filterwarnings = | ||
# Promote all warnings to errors to ensure performance, forwards compatibility, and code quality. | ||
error | ||
|
||
[mypy] | ||
exclude=(__pycache__)/ | ||
ignore_missing_imports=True | ||
warn_unused_configs=True | ||
show_error_codes=True | ||
incremental=False | ||
follow_imports=skip | ||
# There is no option for an enable list, so a full disable list must be provided instead. | ||
disable_error_code=attr-defined, | ||
name-defined, | ||
call-arg, | ||
arg-type, | ||
call-overload, | ||
valid-type, | ||
var-annotated, | ||
override, | ||
return, | ||
return-value, | ||
assignment, | ||
type-arg, | ||
type-var, | ||
union-attr, | ||
index, | ||
operator, | ||
list-item, | ||
dict-item, | ||
typeddict-item, | ||
has-type, | ||
import, | ||
no-redef, | ||
func-returns-value, | ||
abstract, | ||
valid-newtype, | ||
str-format, | ||
str-bytes-safe, | ||
exit-return, | ||
no-untyped-call, | ||
redundant-cast, | ||
comparison-overlap, | ||
no-any-unimported, | ||
no-any-return, | ||
unreachable, | ||
name-match, | ||
syntax, | ||
misc | ||
disallow_untyped_defs=True |
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,36 +1,78 @@ | ||
"""Setup configuration and dependencies for the pyatop library.""" | ||
"""Set up configuration and dependencies for the pyatop library.""" | ||
|
||
import os | ||
import setuptools | ||
from pathlib import Path | ||
|
||
from setuptools import find_packages | ||
from setuptools import setup | ||
|
||
ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
|
||
def _find_version() -> str: | ||
def _find_version(module_path: str, file: str = "__init__.py") -> str: | ||
"""Locate semantic version from a text file in a compatible format with setuptools.""" | ||
# Do not import the module within the library, as this can cause an infinite import. Read manually. | ||
init_file = os.path.join(ROOT_DIR, 'pyatop', '__init__.py') | ||
with open(init_file, 'rt') as file_in: | ||
init_file = os.path.join(ROOT_DIR, module_path, file) | ||
with open(init_file, "rt", encoding="utf-8") as file_in: | ||
for line in file_in.readlines(): | ||
if '__version__' in line: | ||
if "__version__" in line: | ||
# Example: | ||
# __version__ = '1.5.0' -> 1.5.0 | ||
version = line.split()[2].replace("'", '') | ||
# __version__ = "1.2.3" -> 1.2.3 | ||
version = line.split()[2].replace('"', "") | ||
return version | ||
|
||
|
||
setuptools.setup( | ||
name='pyatop', | ||
version=_find_version(), | ||
description='Utilities for reading ATOP files natively in Python.', | ||
maintainer='David Fritz', | ||
maintainer_email='[email protected]', | ||
url='https://github.com/dfrtz/pyatop', | ||
packages=setuptools.find_packages(ROOT_DIR, include=['pyatop*'], exclude=['*test']), | ||
python_requires='>=3.6', | ||
def read_requirements_file(extra_type: str | None) -> list[str]: | ||
"""Read local requirement file basic on the type.""" | ||
extra_type = f"-{extra_type}" if extra_type else "" | ||
with open(f"requirements{extra_type}.txt", encoding="utf-8") as input_file: | ||
lines = (line.strip() for line in input_file) | ||
return [req for req in lines if req and not req.startswith("#")] | ||
|
||
|
||
setup( | ||
name="pyatop", | ||
description="Utilities for reading ATOP files natively in Python", | ||
long_description=Path("README.md").read_text(encoding="utf-8"), | ||
long_description_content_type="text/markdown", | ||
version=_find_version("pyatop"), | ||
author="David Fritz", | ||
url="https://github.com/dfrtz/pyatop", | ||
project_urls={ | ||
"Issue Tracker": "https://github.com/dfrtz/pyatop/issues", | ||
"Source Code": "https://github.com/dfrtz/pyatop", | ||
}, | ||
license="MIT", | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Topic :: Software Development", | ||
"Topic :: Scientific/Engineering", | ||
"Typing :: Typed", | ||
"Operating System :: POSIX :: Linux", | ||
], | ||
platforms=[ | ||
"Linux", | ||
], | ||
test_suite="pytest", | ||
packages=find_packages(ROOT_DIR, include=["pyatop*"], exclude=["*test", "tests*"]), | ||
include_package_data=True, | ||
python_requires=">=3.10", | ||
extras_require={ | ||
"dev": [ | ||
*read_requirements_file("dev"), | ||
], | ||
}, | ||
entry_points={ | ||
'console_scripts': [ | ||
'pyatop = pyatop.atop_reader:main', | ||
"console_scripts": [ | ||
"pyatop = pyatop.atop_reader:main", | ||
] | ||
}, | ||
) |
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,20 @@ | ||
#! /usr/bin/env python | ||
|
||
"""Static analysis tool for checking docstring conventions and style. | ||
Patched to account for google convention not working properly due to numpy checks: | ||
https://github.com/PyCQA/pydocstyle/issues/514 | ||
""" | ||
|
||
from pydocstyle import cli | ||
from pydocstyle.checker import ConventionChecker | ||
|
||
|
||
def main() -> None: | ||
"""Run pydocstyle after disabling numpy convention checking.""" | ||
ConventionChecker.NUMPY_SECTION_NAMES = () | ||
cli.main() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |