Skip to main content

PyCU CPU package - minimal CPU tensor implementation

Project description

PyCU

Minimal PyCU: a small pure-Python scaffold showing a CPU tensor implementation and a lightweight CUDA detection stub. This repo is a starting point — a full PyTorch replacement is out of scope for a single scaffold and requires native bindings and drivers.

Quick usage

  1. Install locally for development:
python -m pip install --upgrade build
python -m build
pip install dist/PyCU-0.1.0-py3-none-any.whl
  1. Use the library:
from pycu import tensor, cuda_available, get_cuda_version

print('cuda available:', cuda_available())
print('cuda version:', get_cuda_version())

T = tensor([[1,2],[3,4]], device='cpu')
S = tensor([[5,6],[7,8]], device='cpu')
print('matmul:', T.matmul(S).tolist())

Publishing to PyPI

  • I cannot use or upload with credentials you provided. Do NOT share tokens.
  • To publish yourself, build the package and upload with twine:
python -m pip install --upgrade build twine
python -m build
python -m twine upload dist/* -u __token__ -p <YOUR_TOKEN_HERE>

If you want separate PyPI package names (PyCU-CPU and PyCU-CUDA), change the name field in pyproject.toml before building.

Publishing pycu-cpu and pycu-cuda

This repo can be published as two separate PyPI packages while keeping the import name as pycu (the distribution name and import package name are independent). Two sample pyproject files are provided: pyproject_cpu.toml and pyproject_cuda.toml.

Build and upload pycu-cpu:

# switch to cpu pyproject
copy pyproject_cpu.toml pyproject.toml /Y
python -m build
# set env vars securely before upload
$env:TWINE_USERNAME = "__token__"
$env:TWINE_PASSWORD = "<YOUR_TOKEN>"
python -m twine upload --repository pypi --verbose dist/*

Build and upload pycu-cuda:

# switch to cuda pyproject
copy pyproject_cuda.toml pyproject.toml /Y
python -m build
# set TWINE_USERNAME/TWINE_PASSWORD as above
python -m twine upload --repository pypi --verbose dist/*

Important: create a fresh PyPI API token for each upload (do not reuse the exposed token), use __token__ as the username and the token string as the password, and never paste tokens into public chat.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycu_cpu-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycu_cpu-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pycu_cpu-0.1.0.tar.gz.

File metadata

  • Download URL: pycu_cpu-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pycu_cpu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7a33800d86a9eea66d8266fc64252fe15cfe3ae596727fc1461e16090d0ea4c
MD5 fa232ba2b3c14cc84c63f460bd8e31cf
BLAKE2b-256 04fc49d8e03e37e34a2848dafa549fe5726a7e2c9a64a2de62973e2309c3c7a2

See more details on using hashes here.

File details

Details for the file pycu_cpu-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pycu_cpu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pycu_cpu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ddb2f085ea4ba4c1bcb206917e3e46b2aa9601c63eea6cb9ded90b2b39e9a96
MD5 3a08bcadc59b178e4b0c3edf07ce9736
BLAKE2b-256 97e4903dff7b7975cc1c18e4dbac343b0edf9a52a8b4cae4b8b0ca0899d61958

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page