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

Replace several linters and fixers (flake8, isort etc.) with ruff #1526

Merged
merged 2 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ repos:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/pycqa/flake8
rev: '6.0.0'
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.247'
hooks:
- id: flake8
- id: ruff
args: [--fix]

- repo: local
hooks:
Expand All @@ -50,9 +51,3 @@ repos:
- id: mypy
name: "MyPy"
additional_dependencies: ["types-all", "pydantic~=1.10"]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: "isort"
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ ENV PYTHONUNBUFFERED 1
WORKDIR /app

# Copy repo contents
COPY setup.py setup.cfg requirements.txt LICENSE MANIFEST.in README.md .docker/run.sh ./
COPY setup.py pyproject.toml requirements.txt requirements-server.txt LICENSE MANIFEST.in README.md .docker/run.sh ./
COPY optimade ./optimade
COPY providers/src/links/v1/providers.json ./optimade/server/data/
RUN apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir --trusted-host pypi.org --trusted-host files.pythonhosted.org -U pip setuptools wheel flit \
&& pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt \
&& pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt -r requirements-server.txt \
&& pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org .[server]

# Setup server configuration
Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[tool.ruff]
select = ["E", "F", "I", "W", "Q"]
ignore = ["E501", "E402"]
fixable = ["A", "B", "C", "D", "E", "F", "I"]
unfixable = []
extend-exclude = [
"providers",
]
target-version = "py310"
per-file-ignores = {}
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.mypy]
plugins = "pydantic.mypy"
ignore_missing_imports = true
follow_imports = "skip"

[tool.pytest.ini_options]
filterwarnings = [
"error",
"ignore:.*parameter is deprecated for the.*:DeprecationWarning",
"ignore:.*read_text is deprecated.*:DeprecationWarning",
"ignore:.*open_text is deprecated.*:DeprecationWarning",
"ignore:.*SixMetaPathImporter.*:ImportWarning",
"ignore:.*PY_SSIZE_T_CLEAN will be required for.*:DeprecationWarning",
"ignore:.*not found, cannot convert structure.*:",
"ignore:.*will default to setting mass to 1.0.:",
"ignore:.*is missing fields.*which are required if.*:",
"ignore:.*the imp module is deprecated in favour of importlib.*:DeprecationWarning",
"ignore:.*has an unrecognised prefix.*:",
]
testpaths = "tests"
addopts = "-rs"

[tool.isort]
known_first_party = "optimade"
profile = "black"
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pre-commit==3.0.4
pylint==2.16.2
pytest==7.2.1
pytest-cov==4.0.0
ruff==0.0.247
types-all==1.0.0
30 changes: 0 additions & 30 deletions setup.cfg

This file was deleted.

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"pre-commit~=3.0",
"invoke~=2.0",
"types-all==1.0.0",
"ruff==0.0.247",
]
+ docs_deps
+ testing_deps
Expand Down