Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 642378086
  • Loading branch information
h-joo authored and copybara-github committed Jun 11, 2024
1 parent 6516ebd commit 2f7db32
Show file tree
Hide file tree
Showing 31 changed files with 2,536 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Tell GitHub to use Python syntax highlighting for `.pytd` files
*.pytd linguist-language=python
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Keep GitHub Actions up to date with GitHub's Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
version: 2
updates:
- package-ecosystem: github-actions
directory: /
groups:
github-actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---

# Outstanding TODOs:
# - manylinux{1,2010,2014}?
# - Auto PyPI upload?
# - Build sdist here too while we're at it?
# - Don't run this on every push ('on' param)

name: Build wheels
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
manylinux_wheels:
name: Python ${{ matrix.platform }} wheels(${{ matrix.pyver }})
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- manylinux2014_x86_64
- manylinux2014_aarch64
pyver: ['cp38-cp38', 'cp39-cp39', 'cp310-cp310', 'cp311-cp311']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
if: matrix.platform == 'manylinux2014_aarch64'
id: qemu
uses: docker/setup-qemu-action@v3
- name: Pull Docker image
run: |
DOCKER_IMAGE="quay.io/pypa/${{ matrix.platform }}"
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> $GITHUB_ENV
docker image pull "$DOCKER_IMAGE"
- name: Build manylinux wheels
run: |
docker container run \
--rm \
-e PLAT=${{ matrix.platform }} \
-e PYTHON_TAGS=${{ matrix.pyver }} \
-v "$(pwd):/io" \
"$DOCKER_IMAGE" \
/io/build_scripts/wheels/manylinux.sh
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
macosx_wheels:
name: Python ${{ matrix.python_version }} MacOS wheels
# Note: the container MacOS version may differ from the SDK
# used to build Python there. It is the latter that determines
# the wheel's platform tag.
# https://github.com/actions/virtual-environments/issues/696
runs-on: macos-13
strategy:
matrix:
python_version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Build MacOS wheels
run: './build_scripts/wheels/macos.sh'
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
50 changes: 50 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI (Windows)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [windows-latest]
python-url: ['https://www.python.org/ftp/python/3.10.5/python-3.10.5-amd64.exe']
experimental: [true]

runs-on: ${{ matrix.os }}

steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v4
with:
submodules: true

- name: Download Python
run: Invoke-WebRequest -Uri ${{ matrix.python-url }} -OutFile python-installer.exe

- name: Install Python
run: .\python-installer /quiet /passive Include_debug=1 PrependPath=1 TargetDir=C:\Python | more

- uses: ilammy/msvc-dev-cmd@v1

# We have to put continue-on-error at the step level rather than the job
# level because the UI is broken:
# https://github.com/github-community/community/discussions/15452.

- name: Test
run: |
set LIB=C:\Python\Libs;%LIB%
set TYPESHED_HOME=%cd%\typeshed
set PATH=C:\Python;C:\Python\Scripts;%PATH%
pip install -r requirements.txt
python build_scripts/ci_script.py
shell: cmd
continue-on-error: ${{ matrix.experimental }}
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8', '3.9', '3.10', '3.11']
experimental: [false]
include:
- os: ubuntu-20.04
python-version: '3.12'
experimental: true
steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v4
with:
submodules: true
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install system packages
run: |
sudo apt-get install bison cmake flex g++
- name: Install Dependencies
run: pip install -r requirements.txt

# We have to put continue-on-error at the step level rather than the job
# level because the UI is broken:
# https://github.com/github-community/community/discussions/15452.

- name: Run Tests
run: python build_scripts/ci_script.py
continue-on-error: ${{ matrix.experimental }}
137 changes: 137 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# 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/
!build_scripts/wheels
*wheelhouse/
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/

# Cmake and friends
CMakeFiles/

# IDEs
.vscode
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "typeshed"]
path = typeshed
url = https://github.com/python/typeshed.git
[submodule "googletest"]
path = googletest
url = https://github.com/google/googletest
[submodule "pybind11"]
path = pybind11
url = https://github.com/pybind/pybind11
12 changes: 12 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- id: pytype
name: Pytype
description: A static type analyzer for Python code.
entry: pytype
# needs to run in the same virtual environment as the code being checked, therefore
# language = system instead of python
language: system
types: [python]
args:
- '--jobs=auto'
- '--keep-going'
files: \.py$
21 changes: 21 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.7

# Tests try to create /nonexistent/path directory expecting it to fail.
# However, the directory can be created inside docker since running as root.
# File with same name makes the directory creation fail and serves as a
# workaround.
RUN touch /nonexistent

WORKDIR /app
RUN apt-get update && apt-get install -y bison flex cmake

COPY requirements.txt .
RUN pip3 install --no-cache -r requirements.txt

COPY . .
RUN python build_scripts/build.py

# Expected usage is to mount a local directory inside the container that
# contains python files that are going to be tested against pytype.
# Additionally the image is well suited for automated tests.
ENTRYPOINT ["/bin/bash"]
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include LICENSE
include pyproject.toml
include pytype/test_data/*
include pytype/typegraph/*
Empty file added build_scripts/__init__.py
Empty file.
Loading

0 comments on commit 2f7db32

Please sign in to comment.