Skip to content

Commit 3cb4ff6

Browse files
walkerbdevBrandon Duane Walker
andauthored
Combine mypy and setup.cfg into toml file (PolusAI#223)
Co-authored-by: Brandon Duane Walker <[email protected]>
1 parent d160bf6 commit 3cb4ff6

File tree

7 files changed

+190
-215
lines changed

7 files changed

+190
-215
lines changed

.codespellrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.pylintrc

Lines changed: 0 additions & 34 deletions
This file was deleted.

mypy.ini

Lines changed: 0 additions & 84 deletions
This file was deleted.

pyproject.toml

Lines changed: 190 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,197 @@
11
# Based on https://packaging.python.org/en/latest/tutorials/packaging-projects/
22
[build-system]
3-
requires = ["jupyter_packaging~=0.7.9", "setuptools>=42,<68", "wheel", "versioneer-518"]
3+
requires = ["jupyter_packaging~=0.7.9", "setuptools>=42,<68", "wheel", "versioneer[toml]==0.29"]
44
# NOTE: The above list mostly comes from https://github.com/nglviewer/nglview/pull/969/files
55
# NOTE: Use upper bound of <68 for setuptools due to 2to3 error.
66
# See https://stackoverflow.com/questions/72414481/error-in-anyjson-setup-command-use-2to3-is-invalid
77

88
build-backend = "setuptools.build_meta"
9+
10+
[project]
11+
name = "mm-workflows"
12+
dynamic = ["version"]
13+
authors = [{name = "Jake Fennick", email = "[email protected]"}]
14+
description = "Molecular modeling workflows"
15+
classifiers = [
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
]
20+
requires-python = ">=3.8"
21+
dependencies = [
22+
"requests",
23+
"beautifulsoup4", # Solely for parsing gromacs mdp options html
24+
]
25+
26+
[project.readme]
27+
file = "README.md"
28+
content-type = "text/markdown"
29+
30+
[project.urls]
31+
Homepage = "https://github.com/PolusAI/mm-workflows"
32+
"Bug Tracker" = "https://github.com/PolusAI/mm-workflows/issues"
33+
34+
[project.optional-dependencies]
35+
36+
test = [
37+
"pre-commit",
38+
"mypy",
39+
"pylint",
40+
"autopep8",
41+
]
42+
# NOTE: The following list was generated using the command
43+
# mypy --install-types
44+
# When updating this list, also update .pre-commit-config.yaml
45+
# Alternatively, the --non-interactive flag can be used install these automatically.
46+
# See https://mypy.readthedocs.io/en/stable/command_line.html#miscellaneous
47+
# toml language has problem with underscore in array name
48+
mypy-types = [
49+
"pandas-stubs",
50+
"types-beautifulsoup4",
51+
"types-requests",
52+
"types-openpyxl",
53+
"types-pyyaml",
54+
]
55+
# For pylint
56+
workflow-deps = [
57+
"matplotlib",
58+
"pandas",
59+
"numpy>=1.21.0",
60+
"mdanalysis",
61+
"nmrformd",
62+
]
63+
# See docs/requirements.txt
64+
doc = [
65+
"sphinx",
66+
"myst-parser",
67+
"sphinx-autodoc-typehints",
68+
"ipytree",
69+
]
70+
71+
all = ["mm-workflows[test,workflow-deps,doc,mypy-types]"]
72+
73+
[project.scripts]
74+
mm-workflows = "mm_workflows.main:main"
75+
76+
# Need the following defined in order to make versioneer work with git tags
77+
[tool.setuptools.dynamic]
78+
version = {attr = "mm_workflows.__version__"}
79+
80+
[tool.setuptools]
81+
package-dir = {"" = "src"}
82+
include-package-data = false
83+
84+
[tool.setuptools.packages.find]
85+
where = ["src"]
86+
namespaces = false
87+
88+
[tool.versioneer]
89+
VCS = "git"
90+
style = "pep440-pre"
91+
versionfile_source = "src/mm_workflows/_version.py"
92+
versionfile_build = "mm_workflows/_version.py"
93+
tag_prefix = "''"
94+
# Based on https://packaging.python.org/en/latest/tutorials/packaging-projects/
95+
96+
[tool.mypy]
97+
# See https://mypy.readthedocs.io/en/stable/running_mypy.html#follow-imports
98+
follow_imports = "normal"
99+
100+
# Specifies the paths to use, after trying the paths from MYPYPATH environment variable.
101+
# mypy_path = ''
102+
103+
# NOTE: mypy requires __init__.py files and/or namespace_packages = True. Otherwise, you will get
104+
# "error: Cannot find implementation or library stub for module named 'module'"
105+
namespace_packages = true
106+
107+
# Disallows defining functions without type annotations or with incomplete type annotations.
108+
disallow_untyped_defs = true
109+
# Disallows defining functions with incomplete type annotations.
110+
disallow_incomplete_defs = true
111+
# Type-checks the interior of functions without type annotations.
112+
check_untyped_defs = true
113+
114+
# Warns about casting an expression to its inferred type.
115+
warn_redundant_casts = true
116+
# Warns about unneeded `# type: ignore` comments.
117+
warn_unused_ignores = true
118+
# Shows a warning when returning a value with type Any from a function declared with a non-Any return type.
119+
warn_return_any = true
120+
121+
# A regular expression that matches file names, directory names and paths which
122+
# mypy should ignore while recursively discovering files to check.
123+
# Note that if you want to exclude multiple regexes, you have to concatenate
124+
# them with |, and sometimes it doesn't even work. It is much easier to
125+
# just use the [mypy-*] notation below with ignore_errors = True
126+
# exclude =
127+
128+
# Allows disabling one or multiple error codes globally.
129+
# disable_error_code = ["ignore-missing-imports"] # comma-separated list of strings
130+
131+
# Disallows usage of generic types that do not specify explicit type parameters.
132+
# disallow_any_generics = False # NOTE: This one tends to generate a medium number of warnings, so enable with caution.
133+
134+
# Disallows all expressions in the module that have type Any.
135+
# disallow_any_expr = False # NOTE: This one tends to generate a MASSIVE number of warnings, so enable with caution.
136+
137+
# Ignores all non-fatal errors.
138+
ignore_errors = false
139+
140+
# Probably because it is in the root directory, I was unable to add
141+
# versioneer to the exclude=regex above, but this works.
142+
143+
[[tool.mypy.overrides]]
144+
module = ["BioSimSpace.*", "MDAnalysis.*", "pymol.*", "rdkit.*", "nmrformd.*", "setuptools.*", "parmed.*", "pdbfixer.*", "openmm.*"]
145+
ignore_missing_imports = true
146+
147+
148+
[tool.pytest.ini_options]
149+
markers = [
150+
"fast: (i.e. for maximum speed, use 'pytest -m fast')",
151+
"slow: (i.e. for medium speed, use 'pytest -m \"not slow\"')",
152+
"serial: (These tests CANNOT be run in parallel with --workers n > 1)",
153+
]
154+
addopts = "--maxfail=2"
155+
# Exit after first num failures or errors
156+
157+
158+
[tool.codespell]
159+
skip = "*.svg,*.html"
160+
ignore-words = "codespellwords.txt"
161+
162+
# See https://pylint.pycqa.org/en/latest/user_guide/configuration/all-options.html
163+
164+
[tool.pylint.main]
165+
166+
# TODO: Add class and module docstrings.
167+
disable=[
168+
"missing-class-docstring",
169+
"missing-module-docstring",
170+
"dangerous-default-value",
171+
"pointless-string-statement",
172+
"unused-variable",
173+
"fixme",
174+
"invalid-name",
175+
]
176+
177+
# Specify a score threshold to be exceeded before program exits with error.
178+
# Try to keep the threshold near the default of a perfect 10/10.
179+
# However, for some reason, on github actions CI/CD the scores are slightly
180+
# lower and fails, so let's use 9.25 instead of 9.50 for now.
181+
fail-under=9.25
182+
183+
[tool.pylint.format]
184+
185+
# Regexp for a line that is allowed to be longer than the limit.
186+
ignore-long-lines='^\s*(# )?(See )?(and )?<?https?://\S+>?$'
187+
188+
# Maximum number of characters on a single line.
189+
max-line-length=120
190+
191+
# Maximum number of lines in a module.
192+
max-module-lines=750
193+
194+
[tool.pylint.miscellaneous]
195+
196+
# List of note tags to take in consideration, separated by a comma.
197+
notes="FIXME,XXX,TODO"

pytest.ini

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)