Skip to content

Commit

Permalink
bump py3.8 + lints + more (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Feb 28, 2024
1 parent 11cc547 commit 0aa059c
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 114 deletions.
4 changes: 2 additions & 2 deletions .azure/testing-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ jobs:
- bash: |
bash prepare_env.sh
# pip list
tree .
pip install -q py-tree
py-tree .
displayName: "Prepare env."
- script: |
Expand Down
5 changes: 2 additions & 3 deletions .github/actions/pytester/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ runs:
shell: bash

- name: Show dir tree
if: runner.os == 'Linux'
run: |
sudo apt install -q -y tree
tree .
pip install -q py-tree
py-tree .
shell: bash

- name: Testing
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_compatible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"

- name: Get PR diff
id: diff-files
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_test-acts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, macOS-11, windows-2022]
python: ["3.9"]
python: ["3.10"]
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 10
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pytorch_version: ["1.8.1", "1.9.1"]
pytorch_version: ["1.13.1", "2.0.1", "2.2.1"]

steps:
- name: Checkout
Expand Down
34 changes: 11 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ repos:
- id: check-docstring-first
- id: detect-private-key

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
- id: pyupgrade
args: ["--py38-plus"]
name: Upgrade code

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
Expand All @@ -41,11 +34,6 @@ repos:
additional_dependencies: [tomli]
#args: ["--write-changes"]

- repo: https://github.com/omnilib/ufmt
rev: v2.3.0
hooks:
- id: ufmt

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
Expand All @@ -55,19 +43,19 @@ repos:
- mdformat-black
- mdformat_frontmatter

- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
additional_dependencies:
- pep8-naming
- flake8-pytest-style
- flake8-bandit
- flake8-builtins
- flake8-bugbear

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
hooks:
- id: ruff-format
args: ["--preview"]
- id: ruff
args: ["--fix"]

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
hooks:
- id: validate-pyproject
4 changes: 2 additions & 2 deletions _actions/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG PYTORCH_VERSION=1.8.1
ARG CUDA_VERSION=11.1
ARG PYTORCH_VERSION=1.13.1
ARG CUDA_VERSION=11.8

# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
#FROM nvcr.io/nvidia/pytorch:${PYTORCH_VERSION}-py3
Expand Down
18 changes: 8 additions & 10 deletions _actions/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,14 @@ def slack_payload(fpath_results: str = "projects.json", dpath_configs: str = "co
}
for _, r in dfg.iterrows()
]
blocks.append(
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"*{cfg}*: compatibility outcomes {':interrobang:' if failed else ':zap:'}: {cc}",
},
"fields": fields,
}
)
blocks.append({
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"*{cfg}*: compatibility outcomes {':interrobang:' if failed else ':zap:'}: {cc}",
},
"fields": fields,
})
now_str = datetime.now().strftime("%Y-%m-%d")
return json.dumps({"text": f"GitHub Action: compatibility result from {now_str}", "blocks": blocks})

Expand Down
2 changes: 1 addition & 1 deletion configs/Lightning-AI/metrics_pl-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ dependencies:

runtimes:
- { os: "ubuntu-20.04", python: "3.8" }
- { os: "macOS-11", python: "3.8" }
- { os: "macOS-12", python: "3.8" }
- { os: "windows-2022", python: "3.8" }
2 changes: 1 addition & 1 deletion configs/manujosephv/pytorch-tabular_lit-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ dependencies:

runtimes:
- { os: "ubuntu-20.04", python: "3.9" }
- { os: "macOS-12", python: "3.7" }
- { os: "macOS-12", python: "3.8" }
- { os: "windows-2019", python: "3.8" }
2 changes: 1 addition & 1 deletion configs/vturrisi/solo-learn_lit-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ testing:

runtimes:
- { os: "ubuntu-20.04", python: "3.9" }
- { os: "macOS-12", python: "3.7" }
- { os: "macOS-12", python: "3.8" }
- { os: "windows-2019", python: "3.8" }
116 changes: 53 additions & 63 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,20 @@
line-length = 120
exclude = "(.eggs|.git|.hg|.mypy_cache|.venv|_build|buck-out|build|dist)"


[tool.isort]
profile = "black"
line_length = 120
force_sort_within_sections = "False"
order_by_type = "False"


[tool.pytest.ini_options]
norecursedirs = [
".git",
".github",
"dist",
"build",
"docs",
]
addopts = [
"--strict-markers",
"--doctest-modules",
# "--doctest-plus",
"--color=yes",
"--disable-pytest-warnings",
]
# ToDo
#filterwarnings = ["error::FutureWarning"]
xfail_strict = true
junit_duration_report = "call"

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"pass",
]


[tool.codespell]
#skip = '*.py'
quiet-level = 3
# comma separated list of words; waiting for:
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
# also adding links until they ignored by its: nature
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
#ignore-words-list = ""


[tool.ruff]
target-version = "py38"
line-length = 120
# Enable Pyflakes `E` and `F` codes by default.
select = [
lint.select = [
"E", "W", # see: https://pypi.org/project/pycodestyle
"F", # see: https://pypi.org/project/pyflakes
"I", #see: https://pypi.org/project/isort/
"D", # see: https://pypi.org/project/pydocstyle
"N", # see: https://pypi.org/project/pep8-naming
"S", # see: https://pypi.org/project/flake8-bandit
"UP", # see: https://docs.astral.sh/ruff/rules/#pyupgrade-up
]
extend-select = [
lint.extend-select = [
"A", # see: https://pypi.org/project/flake8-builtins
"B", # see: https://pypi.org/project/flake8-bugbear
"C4", # see: https://pypi.org/project/flake8-comprehensions
Expand All @@ -77,34 +34,67 @@ extend-select = [
"PLE", # see: https://pypi.org/project/pylint/
"PERF", # see: https://pypi.org/project/perflint/
"PYI", # see: https://pypi.org/project/flake8-pyi/
"RUF", # see: https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
]
# Exclude a variety of commonly ignored directories.
exclude = [
".eggs",
".git",
".mypy_cache",
".ruff_cache",
"__pypackages__",
"_build",
"build",
"dist",
"docs"
lint.ignore-init-module-imports = true
lint.unfixable = ["F401"]
lint.ignore = [
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]
ignore-init-module-imports = true
unfixable = ["F401"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"setup.py" = ["D100", "SIM115"]
"__about__.py" = ["D100"]
"__init__.py" = ["D100"]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"

#[tool.ruff.pycodestyle]
#ignore-overlong-task-comments = true

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.isort]
profile = "black"
line_length = 120
force_sort_within_sections = "False"
order_by_type = "False"

[tool.codespell]
#skip = '*.py'
quiet-level = 3
# comma separated list of words; waiting for:
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
# also adding links until they ignored by its: nature
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
#ignore-words-list = ""

[tool.pytest.ini_options]
norecursedirs = [
".git",
".github",
"dist",
"build",
"docs",
]
addopts = [
"--strict-markers",
"--doctest-modules",
# "--doctest-plus",
"--color=yes",
"--disable-pytest-warnings",
]
# ToDo
#filterwarnings = ["error::FutureWarning"]
xfail_strict = true
junit_duration_report = "call"

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"pass",
]
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Cython # some projects need it for compiling
fire>=0.4
PyYAML>=5.3
coverage>=6.0
pytest>=7.0
fire >=0.4
PyYAML >=5.3
coverage >=6.0
pytest >=7.0,<8.0
requests
pandas>1.0
pandas >1.0

0 comments on commit 0aa059c

Please sign in to comment.