Skip to content

Commit

Permalink
Merge pull request #10 from SEED-platform/task/ruff
Browse files Browse the repository at this point in the history
Added ruff, updated python compatibility
  • Loading branch information
kflemin authored Sep 26, 2024
2 parents 050e29d + 37a9c0a commit ae43dfb
Show file tree
Hide file tree
Showing 11 changed files with 926 additions and 723 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,28 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# - name: Set up Python 3.8
# uses: actions/setup-python@v4
# with:
# python-version: 3.8
# - name: Install and configure Poetry
# uses: abatilo/actions-poetry@v2
# with:
# poetry-version: 1.3.1
# - name: Install dependencies with Poetry
# run: |
# poetry --version
# poetry install
# poetry update
- uses: actions/checkout@v4
- name: Run pre-commit
uses: pre-commit/[email protected].0
uses: pre-commit/[email protected].1
with:
extra_args: --all-files
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.11"]
python-version: ["3.9", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install and configure Poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.3.1
poetry-version: 1.8.3
- name: Install dependencies with Poetry
run: |
poetry --version
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ instance/
# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/_autosummary/

# PyBuilder
target/

Expand Down
39 changes: 9 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
exclude: |
(?x)(
^docs/conf.py|
^docs/license.rst
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -21,31 +15,16 @@ repos:
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ["--fix=auto"]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
hooks:
- id: autopep8
args:
[
"--in-place",
"--aggressive",
"--aggressive",
"--recursive",
"--max-line-length=100",
"--ignore=E501,E402,W503,W504,E731",
]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--ignore=E501,E402,W503,W504,E731,F401"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [css, yaml, markdown, html, scss, javascript]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
- id: isort
args: ["-m=VERTICAL_HANGING_INDENT"] # vertical hanging
# Run the linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --output-format=full]
# Run the formatter
- id: ruff-format
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log

## Version 0.1.0 (unreleased)
## Version 0.1.1

Updated Python compatibility for v3.9-v3.12, and reformatted with Ruff

## Version 0.1.0

Develop a wrapper around the simple-salesforce Python module for
communicating between SEED and Salesforce.
1,208 changes: 684 additions & 524 deletions poetry.lock

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "seed-salesforce"
version = "0.1.0"
version = "0.1.1"
description = "Package for connecting SEED data to Salesforce"
authors = ["Nicholas Long <[email protected]>", "Katherine Fleming <[email protected]>"]
license = "BSD-3-Clause"
Expand All @@ -14,27 +14,26 @@ keywords = ["SEED Platform", "Building Benchmarking", "Salesforce", "Building Pe
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
packages = [
{ include = "seed_salesforce"}
{ include = "seed_salesforce" }
]

[tool.poetry.dependencies]
python = ">=3.8.1, <3.11"
python-dateutil = "> 0"

simple-salesforce = "^1.11.6"
python = ">=3.9, <3.13"
python-dateutil = "*"
simple-salesforce = "^1.12.6"

[tool.poetry.dev-dependencies]
autopep8 = "2.0.1"
flake8 = "6.0.0"
mypy = "^1.0.1"
pre-commit = "3.0.4"
mypy = "^1.11.2"
pre-commit = "^3.8.0"
pytest = "^7.1.2"
pytest-cov = "^4.0.0"
ruff = "^0.6.7"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
64 changes: 64 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
fix = true
line-length = 120

[format]
# preview = true
docstring-code-format = true

# https://docs.astral.sh/ruff/linter/#rule-selection
[lint]
# preview = true
# Enable these rules
extend-select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
# "BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"COM", # flake8-commas
# "DTZ", # flake8-datetimez
"E", # Error
"EXE", # flake8-executable
"F", # Pyflakes
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PD", # pandas-vet
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLC", # Pylint Convention
"PLE", # Pylint Error
"PLR", # Pylint Refactor
"PLW", # Pylint Warning
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"T10", # flake8-debugger
"TID", # flake8-tidy-imports
"UP", # pyupgrade
]
# except for these specific errors
ignore = [
"E402", # module-import-not-at-top-of-file
"E501", # line-too-long
"E731", # lambda-assignment
]

[lint.per-file-ignores]
"tests/test_*" = [
"S101", # assert
"S311", # suspicious-non-cryptographic-random-usage
]

#exclude =
# .tox
# .eggs
# build
# dist

[lint.pylint]
# Raise the allowed limits the least possible amount https://docs.astral.sh/ruff/settings/#pylint-max-branches
max-statements = 58
max-branches = 24
Loading

0 comments on commit ae43dfb

Please sign in to comment.