Skip to content

Commit 84b05dc

Browse files
committed
Init commit.
0 parents  commit 84b05dc

File tree

8 files changed

+208
-0
lines changed

8 files changed

+208
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Pre-commit Hooks
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.12'
17+
cache: 'pip'
18+
19+
- name: Install dependencies
20+
run: pip install '.[dev]'
21+
22+
- uses: pre-commit/[email protected]

.github/workflows/wheels.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build wheels
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
name: Build distribution
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Build dist
16+
run: pipx run build
17+
18+
- uses: actions/upload-artifact@v4
19+
with:
20+
name: build-sdist
21+
path: dist/*.tar.gz
22+
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: build-wheel
26+
path: dist/*.whl
27+
28+
upload:
29+
name: Upload wheels to pypi
30+
runs-on: ubuntu-latest
31+
needs: [build]
32+
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/project/parity_tensor/
36+
permissions:
37+
id-token: write
38+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
39+
40+
steps:
41+
- uses: actions/download-artifact@v4
42+
with:
43+
pattern: build-*
44+
path: dist
45+
merge-multiple: true
46+
47+
- uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
env
2+
*.egg-info
3+
__pycache__
4+
parity_tensor/_version.py

.pre-commit-config.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.6.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: check-ast
9+
- id: check-byte-order-marker
10+
- id: check-builtin-literals
11+
- id: check-case-conflict
12+
- id: check-docstring-first
13+
- id: check-executables-have-shebangs
14+
- id: check-json
15+
- id: check-shebang-scripts-are-executable
16+
- id: pretty-format-json
17+
- id: check-merge-conflict
18+
- id: check-symlinks
19+
- id: check-toml
20+
- id: check-vcs-permalinks
21+
- id: check-xml
22+
- id: check-yaml
23+
- id: debug-statements
24+
- id: destroyed-symlinks
25+
# - id: detect-aws-credentials
26+
- id: detect-private-key
27+
# - id: double-quote-string-fixer
28+
- id: end-of-file-fixer
29+
- id: file-contents-sorter
30+
- id: fix-byte-order-marker
31+
# - id: fix-encoding-pragma
32+
- id: forbid-new-submodules
33+
- id: forbid-submodules
34+
- id: mixed-line-ending
35+
- id: name-tests-test
36+
# - id: no-commit-to-branch
37+
- id: requirements-txt-fixer
38+
- id: sort-simple-yaml
39+
- id: trailing-whitespace
40+
41+
- repo: https://github.com/google/yapf
42+
rev: v0.40.2
43+
hooks:
44+
- id: yapf
45+
language: system
46+
47+
- repo: https://github.com/pylint-dev/pylint
48+
rev: v3.3.1
49+
hooks:
50+
- id: pylint
51+
language: system
52+
53+
- repo: https://github.com/pre-commit/mirrors-mypy
54+
rev: v1.13.0
55+
hooks:
56+
- id: mypy
57+
language: system

parity_tensor/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
A parity tensor package.
3+
"""
4+
5+
__all__ = ["__version__"]
6+
7+
from .version import __version__

parity_tensor/_version.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# file generated by setuptools-scm
2+
# don't change, don't track in version control
3+
4+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
5+
6+
TYPE_CHECKING = False
7+
if TYPE_CHECKING:
8+
from typing import Tuple
9+
from typing import Union
10+
11+
VERSION_TUPLE = Tuple[Union[int, str], ...]
12+
else:
13+
VERSION_TUPLE = object
14+
15+
version: str
16+
__version__: str
17+
__version_tuple__: VERSION_TUPLE
18+
version_tuple: VERSION_TUPLE
19+
20+
__version__ = version = '0.0.post1.dev1+gd7053bd'
21+
__version_tuple__ = version_tuple = (0, 0, 'post1', 'dev1', 'gd7053bd')

parity_tensor/version.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Version information for the parity tensor package.
3+
"""
4+
5+
__all__ = [
6+
"__version__",
7+
]
8+
9+
try:
10+
from ._version import __version__
11+
except ModuleNotFoundError:
12+
try:
13+
import importlib.metadata
14+
__version__ = importlib.metadata.version("parity")
15+
except importlib.metadata.PackageNotFoundError:
16+
__version__ = "0.0.0"

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[build-system]
2+
requires = ["setuptools", "setuptools_scm"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "parity_tensor"
7+
dynamic = ["version"]
8+
dependencies = [
9+
"torch",
10+
]
11+
requires-python = ">=3"
12+
authors = [{ email = "[email protected]", name = "Hao Zhang" }]
13+
description = "A parity tensor package"
14+
readme = "README.md"
15+
license = "GPL-3.0-or-later"
16+
17+
[tool.setuptools_scm]
18+
version_file = "parity_tensor/_version.py"
19+
version_scheme = "no-guess-dev"
20+
fallback_version = "0.0.0"
21+
22+
23+
[tool.yapf]
24+
based_on_style = "google"
25+
column_limit = 200
26+
27+
[project.optional-dependencies]
28+
dev = [
29+
"yapf",
30+
"pylint",
31+
"mypy",
32+
"pytest",
33+
"pytest-cov",
34+
]

0 commit comments

Comments
 (0)