Skip to content

Commit

Permalink
MNT: switch to pyproject.toml, flake8 -> ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Dec 15, 2023
1 parent aef3668 commit 163d525
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 335 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install --upgrade build twine
# if this is a release, upload to PyPI
- name: Build and publish release
Expand All @@ -26,7 +26,7 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
# if this is a manual dispatch, upload to TestPyPI
Expand All @@ -36,5 +36,5 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN}}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload --repository testpypi dist/*
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run-lint-checks:
runs-on: ubuntu-latest
name: Flake8 lint checks
name: Linting Ruff
steps:
- name: Setup python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -91,10 +91,8 @@ jobs:
run: |
mkdir test_cache # make sure cache dir exists
git fetch origin --quiet
# flake8 with default config
flake8 fastf1 examples scripts
# flake8 check new shorter line length only on diff
git diff origin/master -U0 --relative | flake8 --max-line-length 79 --diff --select E501 fastf1 examples scripts
# ruff with default config
ruff check .
- name: Run tests (master push)
if: ${{ github.ref == 'refs/heads/master' && env.GITHUB_EVENT_NAME == 'push'}}
Expand Down
14 changes: 5 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.8
hooks:
- id: flake8
- repo: local
hooks:
- id: flake8-line-length
name: Flake8 line length
entry: python ./scripts/flake8_line_length.py
language: python
# Run the linter.
- id: ruff
54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[project]
dynamic = ["version"]

name = "fastf1"
authors = [
{email = "[email protected]"},
{name = "Philipp Schaefer"}
]
description = "Python package for accessing and analyzing Formula 1 results, schedules, timing data and telemetry."
readme = "README.md"

license = { file = "LICENSE" }

requires-python = ">=3.8"
dependencies = [
"matplotlib>=3.4.2,<4.0.0",
"numpy>=1.20.3,<2.0.0",
"pandas>=1.2.4,<2.1.0",
"python-dateutil",
"requests>=2.28.0",
"requests-cache>=0.8.0",
"scipy>=1.6.3,<2.0.0",
"thefuzz",
"timple>=0.1.6",
"websockets>=8.1",
]

[project.urls]
"Source Code" = "https://github.com/theOehrly/Fast-F1"
"Documentation" = "https://docs.fastf1.dev"

[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[tool.ruff]
line-length = 79
select = [
# "D", TODO: select and fix docstrings
"E",
"F",
"W",
]
exclude = [
"scripts",
"fastf1/tests",
"fastf1/testing",
"fastf1/signalr_aio",
]

[tool.ruff.per-file-ignores]
"fastf1/_api.py" = ["E501"]
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ sphinx-gallery>=0.10.0
autodocsumm>=0.2.10 # support for sphinx v6
sphinx-autodoc-typehints
wheel
flake8<5.0.0
readme-renderer[md]
xdoctest
pre-commit
Expand All @@ -16,4 +15,5 @@ websockets>=10.3
seaborn<0.13.0
plotly
seaborn
kaleido
kaleido
ruff
18 changes: 0 additions & 18 deletions scripts/flake8_line_length.py

This file was deleted.

234 changes: 0 additions & 234 deletions scripts/visualization.py

This file was deleted.

Loading

0 comments on commit 163d525

Please sign in to comment.