Skip to content

Commit

Permalink
restructure for pip install
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-barfoot committed Aug 2, 2023
1 parent 2f019b7 commit 4bbddbb
Show file tree
Hide file tree
Showing 22 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include torchsparsegradutils/tests *.yaml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Things that are missing may be listed as [issues](https://github.com/cai4cai/tor
## Installation
The provided package can be installed using:

`pip install torchsparsegradutils` (TODO)
`pip install torchsparsegradutils`

or

Expand Down
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ def readme():

setuptools.setup(
name="torchsparsegradutils",
version="0.0.3",
version="0.1.0",
description="A collection of utility functions to work with PyTorch sparse tensors",
long_description=readme(),
long_description_content_type="text/markdown",
classifiers=[
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
python_requires=">=3.8, <3.11",
keywords="sparse torch utility",
url="https://github.com/cai4cai/torchsparsegradutils",
author="CAI4CAI research group",
Expand All @@ -26,8 +29,12 @@ def readme():
install_requires=[
"torch>=1.13",
],
setup_requires=["pytest-runner"],
tests_require=["pytest"],
test_suite="tests",
extras_require={
"extras": ["jax", "cupy"],
},
zip_safe=False,
include_package_data=True,
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import yaml
import os
from pathlib import Path
from ast import literal_eval

from functools import reduce
Expand Down Expand Up @@ -152,7 +153,13 @@ def test_trim(tensor_nd, offsets, expected_output_slice):

# Test neighbourgood coordinate generation:

with open("tests/test_params/xyz_coords.yaml") as f: # load test cases from file
# Get the absolute path to the directory of the current module:
current_dir = Path(os.path.abspath(os.path.dirname(__file__)))

# Construct the path to the yaml file:
yaml_file = current_dir / "test_params" / "xyz_coords.yaml"

with open(yaml_file) as f: # load test cases from file
coord_test_cases = yaml.safe_load(f)

params = [tuple(tc.values())[1:] for tc in coord_test_cases] # Skip the first value, which is 'id'
Expand All @@ -172,7 +179,9 @@ def test_gen_coords(radius, expected_coords):

# Test neighbourgood offset generation:

with open("tests/test_params/czyx_shifts.yaml") as f: # load test cases from file
yaml_file = current_dir / "test_params" / "czyx_shifts.yaml"

with open(yaml_file) as f: # load test cases from file
shift_test_cases = yaml.safe_load(f)

params = [tuple(tc.values())[1:] for tc in shift_test_cases] # Skip the first value, which is 'id'
Expand Down Expand Up @@ -252,7 +261,9 @@ def test_pairwise_coo_indices_unique(radius, volume_shape, diag, upper, channel_

# Test the indices generated are as expected for a simple (3, 2, 2, 2) volume:

with open("tests/test_params/pairwise_coo_indices.yaml") as f: # load test cases from file to avoid a massive mess
yaml_file = current_dir / "test_params" / "pairwise_coo_indices.yaml"

with open(yaml_file) as f: # load test cases from file to avoid a massive mess
data = yaml.safe_load(f)

test_cases = data["test_cases"]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4bbddbb

Please sign in to comment.