Skip to main content

PyCU CUDA package - minimal CUDA detection and stubs

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_cuda-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_cuda-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycu_cuda-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_cuda-0.1.0.tar.gz
Algorithm Hash digest
SHA256 141c5cc5b3159037300e3185d63aaed456effdfa6b196bbafc3cffc0ee7a7d57
MD5 45ced25fc12ca118abb154e0f6e5d4fb
BLAKE2b-256 6cd0f6ac5783b19e60e0a33caf1e4769d6e2e92644c643c698eedf5f042f385a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycu_cuda-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_cuda-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7a8ade9fd9eae385ff7236f52bb4deade9f74865ab65b40421b5ae09d60013a
MD5 2088c9f9763cb6a805946037dfd9f89b
BLAKE2b-256 19c7163c10d3fbfc552c21f7ad53541b4f499d205544f4b66b293c88438e1a7b

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