Skip to content

Commit

Permalink
Merge remote-tracking branch 'py_proto/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
shaldengeki committed Feb 26, 2024
2 parents 442fe74 + 5885c76 commit 9d17791
Show file tree
Hide file tree
Showing 76 changed files with 12,572 additions and 0 deletions.
9 changes: 9 additions & 0 deletions py_proto/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Bazel
bazel-bin
bazel-out
bazel-py_proto
bazel-rules
bazel-testlogs

# Github
.github
9 changes: 9 additions & 0 deletions py_proto/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test --test_output=errors

# Do NOT implicitly create empty __init__.py files in the runfiles tree.
# By default, these are created in every directory containing Python source code
# or shared libraries, and every parent directory of those directories,
# excluding the repo root directory. With this flag set, we are responsible for
# creating (possibly empty) __init__.py files and adding them to the srcs of
# Python targets as required.
build --incompatible_default_to_explicit_init_py
1 change: 1 addition & 0 deletions py_proto/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.2
10 changes: 10 additions & 0 deletions py_proto/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/src"
schedule:
interval: "weekly"
8 changes: 8 additions & 0 deletions py_proto/.github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Bazel settings to apply on CI only
# Included with a --bazelrc option in the call to bazel
build --announce_rc
test --test_output=errors
build --disk_cache=$HOME/.cache/bazel
build --repository_cache=$HOME/.cache/bazel-repo
# For bazel-in-bazel testing
test --test_env=XDG_CACHE_HOME
16 changes: 16 additions & 0 deletions py_proto/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Run tests on master and feature branches.
name: Test

on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: bazel test //...
env:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
136 changes: 136 additions & 0 deletions py_proto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Bazel
bazel-bin
bazel-out
bazel-py_proto
bazel-rules
bazel-testlogs
35 changes: 35 additions & 0 deletions py_proto/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
skip:
- buildifier
- buildifier-lint

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: no-commit-to-branch
args: [--branch, staging, --branch, main]
- id: requirements-txt-fixer
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/keith/pre-commit-buildifier
rev: 6.4.0
hooks:
- id: buildifier
- id: buildifier-lint
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
Empty file added py_proto/BUILD.bazel
Empty file.
21 changes: 21 additions & 0 deletions py_proto/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Charles OuGuo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions py_proto/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bazel_dep(name = "rules_python", version = "0.31.0")

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

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
python_version = "3.10",
requirements_lock = "//src:requirements.txt",
)
use_repo(pip, "py_proto_deps")

bazel_dep(name = "bazel_skylib", version = "1.5.0")
Loading

0 comments on commit 9d17791

Please sign in to comment.