diff --git a/.gitignore b/.gitignore index 68bc17f..ceffebb 100644 --- a/.gitignore +++ b/.gitignore @@ -94,13 +94,6 @@ ipython_config.py # install all needed dependencies. #Pipfile.lock -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock @@ -158,3 +151,9 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +# macOS +**/.DS_Store + +# Version file +finch/_version.py diff --git a/README.md b/README.md index b1e1d25..7f3e874 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,34 @@ -# Finch +# finch-tensor This is the beginnings of a sparse tensor library for Python, backed by the [Finch.jl](https://github.com/willow-ahrens/Finch.jl) tensor compiler. ## Installation -Finch is available on PyPi, and can be installed with pip: +`finch-tensor` is available on PyPi, and can be installed with pip: ```bash -pip install finch +pip install finch-tensor ``` ## Contributing -### Packaging +### Local setup -Finch uses [poetry](https://python-poetry.org/) for packaging. +`conda` can be used for creating a local development setup: + +```bash +git clone https://github.com/willow-ahrens/finch-tensor.git +cd finch-tensor/ +conda create --name finch-tensor-dev python=3.9 +conda activate finch-tensor-dev +pip install . +``` ### Testing -Finch uses [pytest](https://docs.pytest.org/en/latest/) for testing. To run the +`finch-tensor` uses [pytest](https://docs.pytest.org/en/latest/) for testing. To run the tests: ```bash -poetry run pytest +pytest tests ``` diff --git a/src/finch/__init__.py b/finch/__init__.py similarity index 100% rename from src/finch/__init__.py rename to finch/__init__.py diff --git a/src/finch/julia.py b/finch/julia.py similarity index 100% rename from src/finch/julia.py rename to finch/julia.py diff --git a/src/finch/tensor.py b/finch/tensor.py similarity index 100% rename from src/finch/tensor.py rename to finch/tensor.py diff --git a/tests/__init__.py b/finch/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to finch/tests/__init__.py diff --git a/tests/test_sparse.py b/finch/tests/test_sparse.py similarity index 91% rename from tests/test_sparse.py rename to finch/tests/test_sparse.py index de06c02..0400742 100644 --- a/tests/test_sparse.py +++ b/finch/tests/test_sparse.py @@ -1,5 +1,5 @@ import pytest -from src import finch +import finch @pytest.fixture def x(): diff --git a/poetry.lock b/poetry.lock deleted file mode 100644 index 02edcf9..0000000 --- a/poetry.lock +++ /dev/null @@ -1,144 +0,0 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - -[[package]] -name = "exceptiongroup" -version = "1.2.0" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -files = [ - {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, - {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, -] - -[package.extras] -test = ["pytest (>=6)"] - -[[package]] -name = "iniconfig" -version = "2.0.0" -description = "brain-dead simple config-ini parsing" -optional = false -python-versions = ">=3.7" -files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, -] - -[[package]] -name = "juliacall" -version = "0.9.15" -description = "Julia and Python in seamless harmony" -optional = false -python-versions = "~=3.7" -files = [ - {file = "juliacall-0.9.15-py3-none-any.whl", hash = "sha256:b60e1225755455b8f0eff572cc7509b7220478e8b5e55b938c07321b8b0a7704"}, - {file = "juliacall-0.9.15.tar.gz", hash = "sha256:08163ae1290dda155cdabdccc4035a4cf0c8e361522a5b3f8e6532401b4f29cc"}, -] - -[package.dependencies] -juliapkg = ">=0.1.8,<0.2.0" - -[[package]] -name = "juliapkg" -version = "0.1.10" -description = "Julia version manager and package manager" -optional = false -python-versions = "*" -files = [ - {file = "juliapkg-0.1.10-py3-none-any.whl", hash = "sha256:716a4e665bd3c9cc9321d45712d60ba624c50d64ec73b04a7f0ee962649c8f1b"}, - {file = "juliapkg-0.1.10.tar.gz", hash = "sha256:70507318d51ac8663e856f56048764e49f5a0c4c90d81a3712d039a316369505"}, -] - -[package.dependencies] -semantic-version = ">=2.9,<3.0" - -[[package]] -name = "packaging" -version = "23.2" -description = "Core utilities for Python packages" -optional = false -python-versions = ">=3.7" -files = [ - {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, - {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, -] - -[[package]] -name = "pluggy" -version = "1.3.0" -description = "plugin and hook calling mechanisms for python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, - {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, -] - -[package.extras] -dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] - -[[package]] -name = "pytest" -version = "7.4.4" -description = "pytest: simple powerful testing with Python" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, - {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -iniconfig = "*" -packaging = "*" -pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} - -[package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] - -[[package]] -name = "semantic-version" -version = "2.10.0" -description = "A library implementing the 'SemVer' scheme." -optional = false -python-versions = ">=2.7" -files = [ - {file = "semantic_version-2.10.0-py2.py3-none-any.whl", hash = "sha256:de78a3b8e0feda74cabc54aab2da702113e33ac9d9eb9d2389bcf1f58b7d9177"}, - {file = "semantic_version-2.10.0.tar.gz", hash = "sha256:bdabb6d336998cbb378d4b9db3a4b56a1e3235701dc05ea2690d9a997ed5041c"}, -] - -[package.extras] -dev = ["Django (>=1.11)", "check-manifest", "colorama (<=0.4.1)", "coverage", "flake8", "nose2", "readme-renderer (<25.0)", "tox", "wheel", "zest.releaser[recommended]"] -doc = ["Sphinx", "sphinx-rtd-theme"] - -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] - -[metadata] -lock-version = "2.0" -python-versions = "^3.8" -content-hash = "233d6fdbe7506d032323e774fc0639d9ae0dc9fbbbc7fd2fcab9ed909a80549c" diff --git a/pyproject.toml b/pyproject.toml index 6c42f21..da7d82f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,21 +1,46 @@ -[tool.poetry] +[build-system] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" + +[project] name = "finch-tensor" -version = "0.1.3" +dynamic = ["version"] description = "" -authors = ["Willow Ahrens "] +maintainers = [{ name = "Willow Ahrens", email = "willow.marie.ahrens@gmail.com" }] readme = "README.md" -packages = [{include = "finch", from = "src"}] +license = { file = "LICENSE" } +requires-python = ">=3.8" +dependencies = ["juliapkg>=0.1.10", "juliacall>=0.9.15"] -[tool.poetry.dependencies] -python = "^3.8" -juliapkg = "^0.1.10" -juliacall = "^0.9.15" +[project.optional-dependencies] +tests = ["pytest>=3.5", "sparse>=0.15.1"] +[project.urls] +Source = "https://github.com/willow-ahrens/finch-tensor" +Repository = "https://github.com/willow-ahrens/finch-tensor.git" -[tool.poetry.group.test.dependencies] -pytest = "^7.4.4" -pre-commit = "^3.6.0" +[tool.setuptools.packages.find] +where = ["."] +include = ["finch", "finch.*"] -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +[tool.setuptools_scm] +version_file = "finch/_version.py" + +[tool.ruff] +select = ["F", "E", "W", "I", "B", "UP", "YTT", "BLE", "C4", "T10", "ISC", "ICN", "PIE", "PYI", "RSE", "RET", "SIM", "PGH", "FLY", "NPY", "PERF"] +exclude = ["finch/_version.py"] +line-length = 120 + +[tool.ruff.format] +quote-style = "double" +docstring-code-format = true + +[tool.ruff.lint.isort] +section-order = [ + "future", + "standard-library", + "first-party", + "third-party", + "numpy", + "local-folder", +] diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..a56960f --- /dev/null +++ b/pytest.ini @@ -0,0 +1,7 @@ +[pytest] +addopts = --cov-report term-missing --cov-report html --cov-report=xml --cov-report=term --cov sparse --cov-config .coveragerc --junitxml=junit/test-results.xml +filterwarnings = + ignore::PendingDeprecationWarning +testpaths = + finch +junit_family=xunit2 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 26f1390..0000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -juliacall==0.9.15 ; python_version >= "3.8" and python_version < "4.0" \ - --hash=sha256:08163ae1290dda155cdabdccc4035a4cf0c8e361522a5b3f8e6532401b4f29cc \ - --hash=sha256:b60e1225755455b8f0eff572cc7509b7220478e8b5e55b938c07321b8b0a7704 -juliapkg==0.1.10 ; python_version >= "3.8" and python_version < "4.0" \ - --hash=sha256:70507318d51ac8663e856f56048764e49f5a0c4c90d81a3712d039a316369505 \ - --hash=sha256:716a4e665bd3c9cc9321d45712d60ba624c50d64ec73b04a7f0ee962649c8f1b -semantic-version==2.10.0 ; python_version >= "3.8" and python_version < "4.0" \ - --hash=sha256:bdabb6d336998cbb378d4b9db3a4b56a1e3235701dc05ea2690d9a997ed5041c \ - --hash=sha256:de78a3b8e0feda74cabc54aab2da702113e33ac9d9eb9d2389bcf1f58b7d9177