Skip to content

Commit

Permalink
Migrating repository
Browse files Browse the repository at this point in the history
  • Loading branch information
idavis committed Nov 16, 2021
0 parents commit c68d735
Show file tree
Hide file tree
Showing 80 changed files with 11,742 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .cargo/config.toml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.x86_64-pc-windows-msvc]
rustflags = [
"-C", "target-feature=+crt-static",
"-C", "control-flow-guard",
]

19 changes: 19 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.191.0/containers/codespaces-linux/.devcontainer/base.Dockerfile

FROM mcr.microsoft.com/vscode/devcontainers/universal:1-linux

USER root

# Install CMake 3.20 (required since apt-get uses 3.16 and repo requires 3.20)
RUN curl -SsL https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-linux-x86_64.sh -o cmakeinstall.sh \
&& echo "f582e02696ceee81818dc3378531804b2213ed41c2a8bc566253d16d894cefab cmakeinstall.sh" | sha256sum -c --strict - \
&& chmod +x cmakeinstall.sh \
&& ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \
&& rm cmakeinstall.sh

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends ninja-build clang-11 clang-tidy-11 build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/

USER codespace
69 changes: 69 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "pyqir",
"build": {
"dockerfile": "Dockerfile",
},
"settings": {
"python.pythonPath": "/opt/python/latest/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"lldb.executable": "/usr/bin/lldb",
"files.watcherExclude": {
"**/target/**": true
},
"terminal.integrated.defaultProfile.linux": "pwsh",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash"
},
"zsh": {
"path": "zsh"
},
"fish": {
"path": "fish"
},
"pwsh": {
"path": "pwsh",
"icon": "terminal-powershell"
}
}
},
"remoteUser": "codespace",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/pyqir,type=bind,consistency=cached",
"workspaceFolder": "/home/pyqir",
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
"--init"
],
"containerEnv": {
"IN_DEV_CONTAINER": "true"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"GitHub.vscode-pull-request-github",
"matklad.rust-analyzer",
"ms-vscode.powershell",
"ms-python.python",
"ms-vscode.cpptools",
"MS-vsliveshare.vsliveshare",
"VisualStudioExptTeam.vscodeintellicode"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// "oryx build" will automatically install your dependencies and attempt to build your project
"postCreateCommand": "oryx build -p virtualenv_name=.venv --log-file /tmp/oryx-build.log --manifest-dir /tmp || echo 'Could not auto-build. Skipping.'"
}
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI
on:
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ${{ matrix.config.os }}
env: ${{ matrix.config.env }}
strategy:
fail-fast: false
matrix:
config:
- {
os: "ubuntu-20.04",
arch: "amd64",
env: {},
}
- {
os: "windows-2019",
arch: "amd64",
env: {},
}
- {
os: "macOS-10.15",
arch: "amd64",
env: {},
}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Linux - Install build dependencies, ccache, and update PATH to use linked versions of gcc, cc, etc
run: sudo apt-get install -y ccache ninja-build
if: ${{ matrix.config.os == 'ubuntu-20.04' }}
- name: Windows - Install build dependencies, ccache, and update PATH to use linked versions of gcc, cc, etc
run: choco install --accept-license -y sccache ninja
if: ${{ matrix.config.os == 'windows-2019' }}
- name: MacOS - Install build dependencies, ccache, and update PATH to use linked versions of gcc, cc, etc
run: brew install ccache ninja
if: ${{ matrix.config.os == 'macOS-10.15' }}
- name: Windows - Install LLVM 11.1.0
run: choco install llvm --version=11.1.0 --allow-downgrade
if: ${{ matrix.config.os == 'windows-2019' }}
- name: "Build all"
run: ./build.ps1
shell: pwsh
- name: Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: target/wheels/*
151 changes: 151 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Generated by Cargo
# will have compiled files and executables
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# 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/
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/
cover/

# 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
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

/.cargo/config.toml
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[submodule "external/llvm-project"]
path = external/llvm-project
url = https://github.com/llvm/llvm-project.git
branch = release/11.x
shallow = true
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[workspace]
members = [
"pyqir-generator",
"pyqir-jit",
"pyqir-parser",
"qirlib",
]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 QIR Alliance

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.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# PyQIR: Python APIs for QIR

14 changes: 14 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

@echo off

if '%1'=='/?' goto help
if '%1'=='-help' goto help
if '%1'=='-h' goto help

pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& '%~dp0\eng\build.ps1' %*"
exit /B %errorlevel%

:help
pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& '%~dp0\eng\build.ps1' -help"
7 changes: 7 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env pwsh

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& '$(Join-Path $pwd eng build.ps1)' $args"
exit $LASTEXITCODE
15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env sh

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Use greadlink on macOS.
if [ "$(uname)" = "Darwin" ]; then
which greadlink > /dev/null || {
printf 'GNU readlink not found\n'
exit 1
}
alias readlink="greadlink"
fi

pwsh -NoProfile -NonInteractive -Command "& $(dirname "$(readlink -f -- "$0")")/eng/build.ps1 $@"
Loading

0 comments on commit c68d735

Please sign in to comment.