Skip to content

Commit

Permalink
Rename has_alpha_spec to publishes_prereleases (#10)
Browse files Browse the repository at this point in the history
Requiring an alpha spec is not an inherent property of a package, but
publishing prereleases is. Rename the field to more accurately reflect
the nature of the underlying property.

Also move `test_json.py` to its proper directory.
  • Loading branch information
KyleFromNVIDIA authored Jun 12, 2024
1 parent 30e732c commit e4cd66e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/rapids_metadata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

@dataclass
class RAPIDSPackage:
has_alpha_spec: bool = field(default=True)
publishes_prereleases: bool = field(default=True)
has_cuda_suffix: bool = field(default=True)


Expand All @@ -50,12 +50,12 @@ def all_packages(self) -> set[str]:
}

@property
def alpha_spec_packages(self) -> set[str]:
def prerelease_packages(self) -> set[str]:
return {
package
for repository_data in self.repositories.values()
for package, package_data in repository_data.packages.items()
if package_data.has_alpha_spec
if package_data.publishes_prereleases
}

@property
Expand Down
12 changes: 6 additions & 6 deletions tests/metadata/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ def metadata():
"repo1": md.RAPIDSRepository(
packages={
"package1": md.RAPIDSPackage(
has_alpha_spec=True, has_cuda_suffix=True
publishes_prereleases=True, has_cuda_suffix=True
),
"package2": md.RAPIDSPackage(
has_alpha_spec=True, has_cuda_suffix=False
publishes_prereleases=True, has_cuda_suffix=False
),
}
),
"repo2": md.RAPIDSRepository(
packages={
"package3": md.RAPIDSPackage(
has_alpha_spec=False, has_cuda_suffix=True
publishes_prereleases=False, has_cuda_suffix=True
),
"package4": md.RAPIDSPackage(
has_alpha_spec=False, has_cuda_suffix=False
publishes_prereleases=False, has_cuda_suffix=False
),
}
),
Expand All @@ -48,8 +48,8 @@ def test_all_packages(metadata):
assert metadata.all_packages == {"package1", "package2", "package3", "package4"}


def test_alpha_spec_packages(metadata):
assert metadata.alpha_spec_packages == {"package1", "package2"}
def test_prerelease_packages(metadata):
assert metadata.prerelease_packages == {"package1", "package2"}


def test_cuda_suffixed_packages(metadata):
Expand Down
22 changes: 11 additions & 11 deletions tests/metadata/test_json.py → tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ def set_cwd(cwd: os.PathLike) -> Generator:
@pytest.mark.parametrize(
["unencoded", "encoded"],
[
(RAPIDSPackage(), {"has_alpha_spec": True, "has_cuda_suffix": True}),
(RAPIDSPackage(), {"publishes_prereleases": True, "has_cuda_suffix": True}),
(
RAPIDSRepository(
packages={
"package1": RAPIDSPackage(),
"package2": RAPIDSPackage(
has_alpha_spec=False, has_cuda_suffix=False
publishes_prereleases=False, has_cuda_suffix=False
),
}
),
{
"packages": {
"package1": {
"has_alpha_spec": True,
"publishes_prereleases": True,
"has_cuda_suffix": True,
},
"package2": {
"has_alpha_spec": False,
"publishes_prereleases": False,
"has_cuda_suffix": False,
},
},
Expand Down Expand Up @@ -88,15 +88,15 @@ def set_cwd(cwd: os.PathLike) -> Generator:
"repo2": {
"packages": {
"package": {
"has_alpha_spec": True,
"publishes_prereleases": True,
"has_cuda_suffix": True,
},
},
},
"_nvidia": {
"packages": {
"proprietary-package": {
"has_alpha_spec": True,
"publishes_prereleases": True,
"has_cuda_suffix": True,
},
},
Expand Down Expand Up @@ -150,7 +150,7 @@ def test_metadata_encoder(unencoded, encoded):
"packages": {
"package": {
"has_cuda_suffix": True,
"has_alpha_spec": True,
"publishes_prereleases": True,
},
},
},
Expand All @@ -170,7 +170,7 @@ def test_metadata_encoder(unencoded, encoded):
"packages": {
"package": {
"has_cuda_suffix": True,
"has_alpha_spec": True,
"publishes_prereleases": True,
},
},
},
Expand All @@ -190,7 +190,7 @@ def test_metadata_encoder(unencoded, encoded):
"packages": {
"package": {
"has_cuda_suffix": True,
"has_alpha_spec": True,
"publishes_prereleases": True,
},
},
},
Expand All @@ -210,7 +210,7 @@ def test_metadata_encoder(unencoded, encoded):
"packages": {
"package": {
"has_cuda_suffix": True,
"has_alpha_spec": True,
"publishes_prereleases": True,
},
},
},
Expand All @@ -222,7 +222,7 @@ def test_metadata_encoder(unencoded, encoded):
"packages": {
"package": {
"has_cuda_suffix": True,
"has_alpha_spec": True,
"publishes_prereleases": True,
},
},
},
Expand Down

0 comments on commit e4cd66e

Please sign in to comment.