Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move project metadata and remove setup.py #267

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ include doc/*.rst
include doc/conf.py
include doc/make.bat
include doc/Makefile
prune doc/_*

include examples/*.py
prune .github
exclude .gitignore
exclude .gitlab-ci.yml
exclude .test-conda-env-py3.yml
3 changes: 2 additions & 1 deletion arraycontext/impl/jax/fake_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
"""
from functools import partial, reduce

import jax.numpy as jnp
import numpy as np

import jax.numpy as jnp

from arraycontext.container import NotAnArrayContainerError, serialize_container
from arraycontext.container.traversal import (
rec_map_array_container,
Expand Down
3 changes: 0 additions & 3 deletions arraycontext/impl/pytato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ def __init__(self,
unstable.
"""
import jax.numpy as jnp

import pytato as pt
super().__init__(compile_trace_callback=compile_trace_callback)
self.array_types = (pt.Array, jnp.ndarray)
Expand Down Expand Up @@ -766,7 +765,6 @@ def zeros_like(self, ary):

def from_numpy(self, array):
import jax

import pytato as pt

def _from_numpy(ary):
Expand All @@ -791,7 +789,6 @@ def freeze(self, array):
return array

import jax.numpy as jnp

import pytato as pt

from arraycontext.container.traversal import rec_keyed_map_array_container
Expand Down
1 change: 0 additions & 1 deletion arraycontext/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ def __init__(self, *args, **kwargs):
def is_available(cls) -> bool:
try:
import jax # noqa: F401

import pytato # noqa: F401
return True
except ImportError:
Expand Down
17 changes: 15 additions & 2 deletions arraycontext/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
VERSION = (2021, 1)
VERSION_TEXT = ".".join(str(i) for i in VERSION)
from importlib import metadata
from typing import Tuple


def _parse_version(version: str) -> Tuple[Tuple[int, ...], str]:
import re

m = re.match("^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT)
assert m is not None

return tuple([int(nr) for nr in m.group(1).split(".")]), m.group(2)


VERSION_TEXT = metadata.version("arraycontext")
VERSION, VERSION_STATUS = _parse_version(VERSION_TEXT)
9 changes: 3 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from importlib import metadata
from urllib.request import urlopen


Expand All @@ -8,12 +9,8 @@

copyright = "2021, University of Illinois Board of Trustees"
author = "Arraycontext Contributors"

ver_dic = {}
exec(compile(open("../arraycontext/version.py").read(), "../arraycontext/version.py",
"exec"), ver_dic)
version = ".".join(str(x) for x in ver_dic["VERSION"])
release = ver_dic["VERSION_TEXT"]
release = metadata.version("arraycontext")
version = ".".join(release.split(".")[:2])

intersphinx_mapping = {
"jax": ("https://jax.readthedocs.io/en/latest/", None),
Expand Down
114 changes: 93 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=63",
]

[project]
name = "arraycontext"
version = "2021.1"
description = "Choose your favorite numpy-workalike"
readme = "README.rst"
license = { text = "MIT" }
authors = [
{ name = "Andreas Kloeckner", email = "[email protected]" },
]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Other Audience",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
]
dependencies = [
"immutabledict>=4.1",
"numpy",
"pytools>=2024.1.3",
]

[project.optional-dependencies]
jax = [
"jax>=0.4",
]
pyopencl = [
"islpy>=2024.1",
"loopy>=2024.1",
"pyopencl>=2024.1",
]
pytato = [
"pytato>=2021.1",
]
inducer marked this conversation as resolved.
Show resolved Hide resolved
test = [
"mypy",
"pytest",
"ruff",
]

[project.urls]
Documentation = "https://documen.tician.de/arraycontext"
Homepage = "https://github.com/inducer/arraycontext"

[tool.setuptools.packages.find]
include = [
"arraycontext*",
]

[tool.setuptools.package-dir]
# https://github.com/Infleqtion/client-superstaq/pull/715
"" = "."

[tool.setuptools.package-data]
pytools = [
"py.typed",
]

[tool.ruff]
target-version = "py38"
preview = true

[tool.ruff.lint]
Expand All @@ -13,15 +85,15 @@ extend-select = [
"N", # pep8-naming
"NPY", # numpy
"Q", # flake8-quotes
"UP", # pyupgrade
"RUF", # ruff
"UP", # pyupgrade
"W", # pycodestyle
]
extend-ignore = [
"C90", # McCabe complexity
"E221", # multiple spaces before operator
"E226", # missing whitespace around arithmetic operator
"E402", # module-level import not at top of file
"C90", # McCabe complexity
"E221", # multiple spaces before operator
"E226", # missing whitespace around arithmetic operator
"E402", # module-level import not at top of file
"UP006", # updated annotations due to __future__ import
"UP007", # updated annotations due to __future__ import
]
Expand All @@ -33,15 +105,17 @@ multiline-quotes = "double"

[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = [
"jax",
"loopy",
"pymbolic",
"pyopencl",
"pytato",
"pytools",
]
known-local-folder = [
"arraycontext",
]
known-first-party = [
"pytools",
"pyopencl",
"pytato",
"loopy",
]
lines-after-imports = 2

[tool.mypy]
Expand All @@ -51,15 +125,13 @@ warn_unused_ignores = true
# check_untyped_defs = true

[[tool.mypy.overrides]]

module = [
"islpy",
"loopy.*",
"meshmode.*",
"pymbolic",
"pymbolic.*",
"pyopencl.*",
"jax.*",
"islpy.*",
"loopy.*",
"meshmode.*",
"pymbolic",
"pymbolic.*",
"pyopencl.*",
"jax.*",
]

ignore_missing_imports = true
53 changes: 0 additions & 53 deletions setup.py

This file was deleted.

Loading