Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting with ruff - the PR that nobody asked for! #503

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
21 changes: 4 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.10
hooks:
- id: black
language_version: python3.7
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: flake8
files: ^vortexasdk/
- repo: https://github.com/PyCQA/pydocstyle
rev: 4.0.1
hooks:
- id: pydocstyle
args:
- --ignore=D107,D203,D212,D100
files: ^vortexasdk/
^docs/examples/
- id: ruff
- id: ruff-format
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
},
"cSpell.words": [
"dataframe",
Expand All @@ -13,4 +14,4 @@
"timeseries",
"vortexasdk"
]
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VortexaSDK

[![CircleCI](https://circleci.com/gh/VorTECHsa/python-sdk.svg?style=svg)](https://circleci.com/gh/VorTECHsa/python-sdk)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors)

Welcome to Vortexa's Python Software Development Kit (SDK)! We built the SDK to
Expand Down
8 changes: 4 additions & 4 deletions docs/autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

import six


# From https://github.com/keras-team/keras/blob/0a0ac3fa5462cf4a72636ca4498a0a82ac91fc32/docs/autogen.py


def get_module_docstring(filepath):
"""Extract the module docstring.
"""
Extract the module docstring.
Also finds the line at which the docstring ends.
"""
co = compile(open(filepath, encoding="utf-8").read(), filepath, "exec")
Expand All @@ -21,7 +21,8 @@ def get_module_docstring(filepath):


def copy_examples(examples_dir, destination_dir):
"""Copy the examples directory in the documentation.
"""
Copy the examples directory in the documentation.
Prettify files by extracting the docstrings written in Markdown.
"""
pathlib.Path(destination_dir).mkdir(exist_ok=True)
Expand All @@ -34,7 +35,6 @@ def copy_examples(examples_dir, destination_dir):
with open(destination_file, "w+", encoding="utf-8") as f_out, open(
os.path.join(examples_dir, file), "r+", encoding="utf-8"
) as f_in:

f_out.write(docstring + "\n\n")

# skip docstring
Expand Down
1 change: 1 addition & 0 deletions docs/examples/0_sample_load_cargo_movements.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""

from datetime import datetime

from vortexasdk import CargoMovements
Expand Down
1 change: 1 addition & 0 deletions docs/examples/1_china.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""

from datetime import datetime

from vortexasdk import CargoMovements, Geographies, Vessels
Expand Down
1 change: 1 addition & 0 deletions docs/examples/2_crude_from_saudi_arabia_to_india.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
filtering on `Products: Crude` with `Origin: Saudi Arabia`, `Destination: India` and `Date Range: Departures in the last Month`.
"""

from datetime import datetime

from dateutil.relativedelta import relativedelta
Expand Down
1 change: 1 addition & 0 deletions docs/examples/3_chinese_daily_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
...
"""

from datetime import datetime

from vortexasdk import CargoTimeSeries, Geographies, Products
Expand Down
1 change: 1 addition & 0 deletions docs/examples/4_medium_sour_floating_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
...
"""

from datetime import datetime

from docs.utils import to_markdown
Expand Down
Loading