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

Update documentation #9

Merged
merged 7 commits into from
Jan 24, 2024
Merged

Update documentation #9

merged 7 commits into from
Jan 24, 2024

Conversation

asmeurer
Copy link
Member

No description provided.

@asmeurer
Copy link
Member Author

@rgommers if you have a chance, can you review this?

In addition to the changes in this PR, can you also take a look at the repo as a whole. I think I have everything ready to do an initial release, but I don't know if I forgot anything.

I also opened some issues on this repo for ideas of things we can do in the future. But I want to keep the first release as close to the current numpy.array_api as possible.

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks quite good Aaron, I only have a few minor comments.

@@ -0,0 +1,30 @@
# array-api-strict Changelog

## 1.0 (????)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.0 SGTM

CHANGELOG.md Outdated
extracted from the git history of numpy/array_api/ (see the [README](README.md)).

Additionally, the following changes are new to `array_api_strict` from
`numpy.array_api` in NumPy 1.26 (the last major NumPy release to include
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`numpy.array_api` in NumPy 1.26 (the last major NumPy release to include
`numpy.array_api` in NumPy 1.26 (the last NumPy feature release to include

README.md Outdated
standard are included. All signatures in array-api-strict use
[positional-only
arguments](https://data-apis.org/array-api/latest/API_specification/function_and_method_signatures.html#function-and-method-signatures).
As noted above, only array_api_strict array objects are accepted by
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting: array_api_strict needs backticks

README.md Outdated
arguments](https://data-apis.org/array-api/latest/API_specification/function_and_method_signatures.html#function-and-method-signatures).
As noted above, only array_api_strict array objects are accepted by
functions, except in the places where the standard allows Python scalars
(i.e., functions to not automatically call `asarray` on their inputs).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence reads slightly awkward to me. maybe it's a typo (to not -> do not)?

README.md Outdated

- The
[indexing](https://data-apis.org/array-api/latest/API_specification/indexing.html)
semantics required by the standard are not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incomplete sentence here

README.md Outdated

- The array object type itself is private and should not be accessed.
Subclassing or otherwise trying to directly initialize this object is not
supported. Arrays should created with one of the [array creation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "should be created"


## Caveats

array-api-strict is a thin pure Python wrapper around NumPy. NumPy 2.0 fully
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest: "NumPy 2.0 has nearly full support for ....", since there are a few aspects that don't comply (e.g., returning scalars)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change this, but I was under the impression that scalars were not actually breaking compliance. As long as scalars duck-type as 0-D arrays, which they do, then it's just an implementation detail that numpy has a separate type for them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe, not sure if the duck-typing really is 100%. there's a few other reasons though, see the "not adopted part in the PR for NEP 56

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is NEP 56? Google comes up with nothing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to continue this discussion over there since this is closed, but that NEP seems to just state that scalars aren't in compliance without actually explaining why. numpy/numpy#25542 (comment)

- Complex number support in array API spec is planned but not yet finalized,
as are the fft extension and certain linear algebra functions such as eig
that require complex dtypes.
array_api_strict is a strict, minimal implementation of the Python array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need backticks here as well

array_api_strict/__init__.py Show resolved Hide resolved
@rgommers
Copy link
Member

In addition to the changes in this PR, can you also take a look at the repo as a whole. I think I have everything ready to do an initial release, but I don't know if I forgot anything.

I think it can be shipped as is, however you may want to do some of the following (can be done later):

  • Packaging: we may want to be good citizens and use pyproject.toml here, and get rid of all setup.* content
  • versioneer is pretty awful, and this package is really simple. I'd just use 1.0 and then 1.1-dev in pyproject.toml and leave it at that, rather than use thousands of lines of questionable-quality code to support a simple version string.

I also opened some issues on this repo for ideas of things we can do in the future. But I want to keep the first release as close to the current numpy.array_api as possible.

Good ideas, +1 to both the first release plan and all of those things as follow-ups.

@rgommers
Copy link
Member

I'll give this a try with SciPy

@rgommers
Copy link
Member

Looks like the switchover is easy and everything works as expected for SciPy.

@asmeurer
Copy link
Member Author

I've used versioneer on dozens of projects and never had any issues with it. All the code in versioneer is used for generating development version numbers and doing packaging. The actual resulting package has a very simple file generated in it. Here's what it creates for this branch

# This file was generated by 'versioneer.py' (0.29) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.

import json

version_json = '''
{
 "date": "2024-01-23T17:55:23-0700",
 "dirty": false,
 "error": null,
 "full-revisionid": "c2d570061e8434b58c4e6609e2a849cf75e6a390",
 "version": "0+untagged.193.gc2d5700"
}
'''  # END VERSION_JSON


def get_versions():
    return json.loads(version_json)

Admittedly, even that is more complicated than it could be. It could just generate a file with just `version = ''. But it's way simpler for runtime than, e.g., setuptools_scm, which grabs the version number from the package metadata. I don't like that at all. If you know of a simpler tool I'm open to using it, but I do like to have something that lets me write the version number just once (in the tag). Otherwise I forget to update it, like I recently did for array-api-compat (we can't use versioneer there because of the vendorability requirement). I don't actually care as much about the git hash version thing, although it is nice to have and it occasionally helps with debugging user issues.

@rgommers
Copy link
Member

If you know of a simpler tool I'm open to using it, but I do like to have something that lets me write the version number just once (in the tag).

Imho none of these tools are worth it, for a one-line change per release. versioneer specifically we've had problems with in NumPy, and since dropped - as did Matplotlib and others. If you've had to debug versioneer code just once, you notice it's 2000+ lines of bad code generating 500+ lines more code to then ship.

But okay, I don't have to make the updates here, so your call.

@asmeurer
Copy link
Member Author

OK, I'm going to try to do a release. Based on my experience with array-api-compat, getting the auto-deploy to work the first time around can be a little annoying, so I may end up pushing a 1.0 tag to this repo multiple times.

@asmeurer
Copy link
Member Author

OK, array-api-strict 1.0 has been released. Now I need to create a conda-forge package.

@asmeurer asmeurer merged commit 397713f into data-apis:main Jan 24, 2024
30 of 36 checks passed
@rgommers
Copy link
Member

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants