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

Fix everything (everything was broken) #15

Merged
merged 10 commits into from
Dec 16, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/check_buildifier
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -e # Exit on error

find . -name "BUILD.bazel" \
| xargs buildifier --lint=warn --mode=check --warnings=all
buildifier --lint=warn --mode=check --warnings=all WORKSPACE
buildifier --lint=warn --mode=check --warnings=all MODULE.bazel
18 changes: 10 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,42 @@ jobs:
# Use a machine executor because it most easily supports multiple languages
machine:
# See https://circleci.com/docs/2.0/configuration-reference/#available-machine-images for the list of images
image: ubuntu-2004:202107-02
image: ubuntu-2204:2023.10.1
steps:
- checkout
# Use the latest version of python available as reported via "pyenv install -l"
- run: pyenv global 3.9.4
- run: pyenv install -l
- run: pyenv global 3.11.5
# Install bazelisk. See https://github.com/bazelbuild/bazelisk#requirements
- run: go get github.com/bazelbuild/bazelisk
- run: go version
- run: go install github.com/bazelbuild/bazelisk@latest
- run: bazelisk test --test_output=errors //...
check-buildifier:
docker:
# See https://circleci.com/developer/images/image/cimg/go for a list of images
- image: cimg/go:1.17.5@sha256:03bc021893b54e1f7c981dc3a391df868a01e24899044d382f068d2014b80348
- image: cimg/go:1.21.5@sha256:6783c5e6bd954c9de7292a70052ee42029c13918305dabfb6ec3f0eaf6e3233a
steps:
- checkout
- run: go get github.com/bazelbuild/buildtools/buildifier
- run: go install github.com/bazelbuild/buildtools/buildifier@latest
- run: bash .circleci/check_buildifier
- run:
command: echo "Run .circleci/fix_buildifier"
when: on_fail
check-python:
docker:
# See https://circleci.com/developer/images/image/cimg/python for a list of images
- image: cimg/python:3.10.1@sha256:fc682462c99327b5607503c533232d9447e334ba47e3eca0d8b772ae4ef6b0b8
- image: cimg/python:3.12.1@sha256:5af7aa5146fa64bf09637b2a81cebec98553df6feb95798ed72dfc80f580158c
steps:
- checkout
- run: pip install -r requirements.txt
- run: pip install -r requirements_lock.txt
- run: pip install pylint
# It would be nice to keep invalid-name but it is too convenient to use the oeis sequence and "n"
- run: find . -name "*.py" | xargs pylint --disable=missing-docstring --disable=too-many-public-methods --disable=invalid-name
# See https://github.com/google/yapf
check-yapf:
docker:
# See https://circleci.com/developer/images/image/cimg/python for a list of images
- image: cimg/python:3.10.1@sha256:fc682462c99327b5607503c533232d9447e334ba47e3eca0d8b772ae4ef6b0b8
- image: cimg/python:3.12.1@sha256:5af7aa5146fa64bf09637b2a81cebec98553df6feb95798ed72dfc80f580158c
steps:
- checkout
- run: pip install yapf
Expand Down
6 changes: 4 additions & 2 deletions .circleci/fix_buildifier
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e # Exit on error

# Install buildifier via
# go install github.com/bazelbuild/buildtools/buildifier@latest
find . -name "BUILD.bazel" -not -path "./node_modules/*" \
| xargs yarn buildifier --lint=fix --mode=fix --warnings=all
yarn buildifier --lint=fix --mode=fix --warnings=all WORKSPACE
| xargs buildifier --lint=fix --mode=fix --warnings=all
buildifier --lint=fix --mode=fix --warnings=all MODULE.bazel
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# pip install pre-commit
# pre-commit run --all-files
repos:
- repo: https://github.com/google/yapf
rev: v0.31.0
rev: v0.40.2
hooks:
- id: yapf
name: yapf
Expand Down
12 changes: 9 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
load("@pip//:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

compile_pip_requirements(
name = "requirements",
src = "requirements.in",
requirements_txt = "requirements_lock.txt",
)

py_library(
name = "A348301",
srcs = ["A348301.py"],
deps = [
requirement("sympy"),
"@pypi//sympy:pkg",
],
)

Expand All @@ -19,7 +25,7 @@ py_library(
name = "A059861",
srcs = ["A059861.py"],
deps = [
requirement("sympy"),
"@pypi//sympy:pkg",
],
)

Expand Down
19 changes: 19 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
The module for https://github.com/b0ri5/oeis
"""

# https://github.com/bazelbuild/rules_python/releases
bazel_dep(name = "rules_python", version = "0.27.1")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.12",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pypi",
python_version = "3.12",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pypi")
16 changes: 0 additions & 16 deletions WORKSPACE

This file was deleted.

1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sympy
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

14 changes: 14 additions & 0 deletions requirements_lock.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# bazel run //:requirements.update
#
mpmath==1.3.0 \
--hash=sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f \
--hash=sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c
# via sympy
sympy==1.12 \
--hash=sha256:c3588cd4295d0c0f603d0f2ae780587e64e2efeedb3521e46b9bb1d08d184fa5 \
--hash=sha256:ebf595c8dac3e0fdc4152c51878b498396ec7f30e7a914d6071e674d49420fb8
# via -r requirements.in