Skip to content

Commit 93af95a

Browse files
author
Chris Elion
authored
Add verified package info to table (#4889)
1 parent 82fb259 commit 93af95a

File tree

2 files changed

+115
-59
lines changed

2 files changed

+115
-59
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ under active development and may be unstable. A few helpful guidelines:
6363
- The **Documentation** links in the table below include installation and usage
6464
instructions specific to each release. Remember to always use the
6565
documentation that corresponds to the release version you're using.
66-
67-
| **Version** | **Release Date** | **Source** | **Documentation** | **Download** |
68-
|:-------:|:------:|:-------------:|:-------:|:------------:|
69-
| **master (unstable)** | -- | [source](https://github.com/Unity-Technologies/ml-agents/tree/master) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/master/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/master.zip) |
70-
| **Release 12** | **December 22, 2020** | **[source](https://github.com/Unity-Technologies/ml-agents/tree/release_12)** | **[docs](https://github.com/Unity-Technologies/ml-agents/tree/release_12_docs/docs/Readme.md)** | **[download](https://github.com/Unity-Technologies/ml-agents/archive/release_12.zip)** |
71-
| **Release 11** | December 21, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_11) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_11_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_11.zip) |
72-
| **Release 10** | November 18, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_10) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_10_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_10.zip) |
73-
| **Release 9** | November 4, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_9) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_9_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_9.zip) |
74-
| **Release 8** | October 14, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_8) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_8_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_8.zip) |
75-
| **Release 7** | September 16, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_7) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_7_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_7.zip) |
76-
| **Release 6** | August 12, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_6) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_6_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_6.zip) |
77-
| **Release 5** | July 31, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_5) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_5_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_5.zip) |
78-
79-
## Citation
66+
- The `com.unity.ml-agents` package is [verified](https://docs.unity3d.com/2020.1/Documentation/Manual/pack-safe.html)
67+
for Unity 2020.1 and later. Verified packages releases are numbered 1.0.x.
68+
69+
| **Version** | **Release Date** | **Source** | **Documentation** | **Download** | **Python Package** | **Unity Package** |
70+
|:-------:|:------:|:-------------:|:-------:|:------------:|:------------:|:------------:|
71+
| **master (unstable)** | -- | [source](https://github.com/Unity-Technologies/ml-agents/tree/master) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/master/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/master.zip) | -- | -- |
72+
| **Release 12** | **December 22, 2020** | **[source](https://github.com/Unity-Technologies/ml-agents/tree/release_12)** | **[docs](https://github.com/Unity-Technologies/ml-agents/tree/release_12_docs/docs/Readme.md)** | **[download](https://github.com/Unity-Technologies/ml-agents/archive/release_12.zip)** | **[0.23.0](https://pypi.org/project/mlagents/0.23.0/)** | **[1.7.2](https://docs.unity3d.com/Packages/[email protected]/manual/index.html)** |
73+
| **Release 11** | December 21, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_11) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_11_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_11.zip) | [0.23.0](https://pypi.org/project/mlagents/0.23.0/) | [1.7.0](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) |
74+
| **Release 10** | November 18, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_10) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_10_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_10.zip) | [0.22.0](https://pypi.org/project/mlagents/0.22.0/) | [1.6.0](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) |
75+
| **Verified Package 1.0.6** | **November 16, 2020** | **[source](https://github.com/Unity-Technologies/ml-agents/tree/com.unity.ml-agents_1.0.6)** | **[docs](https://github.com/Unity-Technologies/ml-agents/blob/release_2_verified_docs/docs/Readme.md)** | **[download](https://github.com/Unity-Technologies/ml-agents/archive/.zip)** | **[0.16.1](https://pypi.org/project/mlagents/0.16.1/)** | **[1.0.6](https://docs.unity3d.com/Packages/[email protected]/manual/index.html)** |
76+
| **Release 9** | November 4, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_9) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_9_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_9.zip) | [0.21.1](https://pypi.org/project/mlagents/0.21.1/) | [1.5.0](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) |
77+
| **Release 8** | October 14, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_8) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_8_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_8.zip) | [0.21.0](https://pypi.org/project/mlagents/0.21.0/) | [1.5.0](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) |
78+
| **Verified Package 1.0.5** | September 23, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/com.unity.ml-agents_1.0.5) | [docs](https://github.com/Unity-Technologies/ml-agents/blob/release_2_verified_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/.zip) | [0.16.1](https://pypi.org/project/mlagents/0.16.1/) | [1.0.5](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) |
79+
| **Release 7** | September 16, 2020 | [source](https://github.com/Unity-Technologies/ml-agents/tree/release_7) | [docs](https://github.com/Unity-Technologies/ml-agents/tree/release_7_docs/docs/Readme.md) | [download](https://github.com/Unity-Technologies/ml-agents/archive/release_7.zip) | [0.20.0](https://pypi.org/project/mlagents/0.20.0/) | [1.4.0](https://docs.unity3d.com/Packages/[email protected]/manual/index.html) |
8080

8181
If you are a researcher interested in a discussion of Unity as an AI platform,
8282
see a pre-print of our

utils/make_readme_table.py

Lines changed: 101 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,118 @@
22
Generate the "Releases" table on the main readme. Update the versions lists, run this script, and copy the output
33
into the markdown file.
44
"""
5-
from distutils.version import LooseVersion
5+
from distutils.version import LooseVersion, StrictVersion
66
from datetime import datetime
77
from typing import NamedTuple
8+
from collections import Counter
9+
10+
MAX_DAYS = 150 # do not print releases older than this many days
811

912

10-
def table_line(display_name, name, date, bold=False):
13+
def table_line(version_info, bold=False):
1114
bold_str = "**" if bold else ""
12-
# For release_X branches, docs are on a separate tag.
13-
if name.startswith("release"):
14-
docs_name = name + "_docs"
15+
16+
cells = [
17+
f"**{version_info.display_name}**",
18+
f"{bold_str}{version_info.release_date}{bold_str}",
19+
f"{bold_str}[source]({version_info.source_link}){bold_str}",
20+
f"{bold_str}[docs]({version_info.doc_link}){bold_str}",
21+
f"{bold_str}[download]({version_info.download_link}){bold_str}",
22+
]
23+
if version_info.is_master:
24+
cells.append("--") # python
25+
cells.append("--") # Unity
1526
else:
16-
docs_name = name
17-
return f"| **{display_name}** | {bold_str}{date}{bold_str} | {bold_str}[source](https://github.com/Unity-Technologies/ml-agents/tree/{name}){bold_str} | {bold_str}[docs](https://github.com/Unity-Technologies/ml-agents/tree/{docs_name}/docs/Readme.md){bold_str} | {bold_str}[download](https://github.com/Unity-Technologies/ml-agents/archive/{name}.zip){bold_str} |" # noqa
27+
cells.append(
28+
f"{bold_str}[{version_info.python_verion}]({version_info.pypi_link}){bold_str}"
29+
)
30+
cells.append(
31+
f"{bold_str}[{version_info.csharp_version}]({version_info.package_link}){bold_str}"
32+
)
33+
joined_cells = " | ".join(cells)
34+
return f"| {joined_cells} |"
1835

1936

2037
class ReleaseInfo(NamedTuple):
2138
release_tag: str
2239
csharp_version: str
2340
python_verion: str
2441
release_date: str
25-
26-
@staticmethod
27-
def from_simple_tag(release_tag: str, release_date: str) -> "ReleaseInfo":
28-
"""
29-
Generate the ReleaseInfo for "old style" releases, where the tag and versions
30-
were all the same.
31-
"""
32-
return ReleaseInfo(release_tag, release_tag, release_tag, release_date)
42+
is_verified: bool = False
3343

3444
@property
3545
def loose_version(self) -> LooseVersion:
3646
return LooseVersion(self.python_verion)
3747

48+
@property
49+
def is_master(self) -> bool:
50+
return self.release_tag == "master"
51+
52+
@property
53+
def release_datetime(self) -> datetime:
54+
if self.is_master:
55+
return datetime.today()
56+
return datetime.strptime(self.release_date, "%B %d, %Y")
57+
3858
@property
3959
def elapsed_days(self) -> int:
4060
"""
4161
Days since this version was released.
4262
:return:
4363
"""
44-
return (
45-
datetime.today() - datetime.strptime(self.release_date, "%B %d, %Y")
46-
).days
64+
return (datetime.today() - self.release_datetime).days
4765

4866
@property
4967
def display_name(self) -> str:
5068
"""
5169
Clean up the tag name for display, e.g. "release_1" -> "Release 1"
5270
:return:
5371
"""
54-
return self.release_tag.replace("_", " ").title()
72+
if self.is_verified:
73+
return f"Verified Package {self.csharp_version}"
74+
elif self.is_master:
75+
return "master (unstable)"
76+
else:
77+
return self.release_tag.replace("_", " ").title()
78+
79+
@property
80+
def source_link(self):
81+
if self.is_verified:
82+
return f"https://github.com/Unity-Technologies/ml-agents/tree/com.unity.ml-agents_{self.csharp_version}"
83+
else:
84+
return f"https://github.com/Unity-Technologies/ml-agents/tree/{self.release_tag}"
85+
86+
@property
87+
def download_link(self):
88+
return f"https://github.com/Unity-Technologies/ml-agents/archive/{self.release_tag}.zip"
89+
90+
@property
91+
def doc_link(self):
92+
if self.is_verified:
93+
return "https://github.com/Unity-Technologies/ml-agents/blob/release_2_verified_docs/docs/Readme.md"
94+
95+
# For release_X branches, docs are on a separate tag.
96+
if self.release_tag.startswith("release"):
97+
docs_name = self.release_tag + "_docs"
98+
else:
99+
docs_name = self.release_tag
100+
return f"https://github.com/Unity-Technologies/ml-agents/tree/{docs_name}/docs/Readme.md"
101+
102+
@property
103+
def package_link(self):
104+
try:
105+
v = StrictVersion(self.csharp_version).version
106+
return f"https://docs.unity3d.com/Packages/com.unity.ml-agents@{v[0]}.{v[1]}/manual/index.html"
107+
except ValueError:
108+
return "--"
109+
110+
@property
111+
def pypi_link(self):
112+
return f"https://pypi.org/project/mlagents/{self.python_verion}/"
55113

56114

57115
versions = [
58-
ReleaseInfo.from_simple_tag("0.10.0", "September 30, 2019"),
59-
ReleaseInfo.from_simple_tag("0.10.1", "October 9, 2019"),
60-
ReleaseInfo.from_simple_tag("0.11.0", "November 4, 2019"),
61-
ReleaseInfo.from_simple_tag("0.12.0", "December 2, 2019"),
62-
ReleaseInfo.from_simple_tag("0.12.1", "December 11, 2019"),
63-
ReleaseInfo.from_simple_tag("0.13.0", "January 8, 2020"),
64-
ReleaseInfo.from_simple_tag("0.13.1", "January 21, 2020"),
65-
ReleaseInfo.from_simple_tag("0.14.0", "February 13, 2020"),
66-
ReleaseInfo.from_simple_tag("0.14.1", "February 26, 2020"),
67-
ReleaseInfo.from_simple_tag("0.15.0", "March 18, 2020"),
68-
ReleaseInfo.from_simple_tag("0.15.1", "March 30, 2020"),
116+
ReleaseInfo("master", "master", "master", "--"),
69117
ReleaseInfo("release_1", "1.0.0", "0.16.0", "April 30, 2020"),
70118
ReleaseInfo("release_2", "1.0.2", "0.16.1", "May 20, 2020"),
71119
ReleaseInfo("release_3", "1.1.0", "0.17.0", "June 10, 2020"),
@@ -78,23 +126,31 @@ def display_name(self) -> str:
78126
ReleaseInfo("release_10", "1.6.0", "0.22.0", "November 18, 2020"),
79127
ReleaseInfo("release_11", "1.7.0", "0.23.0", "December 21, 2020"),
80128
ReleaseInfo("release_12", "1.7.2", "0.23.0", "December 22, 2020"),
129+
# Verified releases
130+
ReleaseInfo("", "1.0.6", "0.16.1", "November 16, 2020", is_verified=True),
131+
ReleaseInfo("", "1.0.5", "0.16.1", "September 23, 2020", is_verified=True),
132+
ReleaseInfo("", "1.0.4", "0.16.1", "August 20, 2020", is_verified=True),
81133
]
82134

83-
MAX_DAYS = 150 # do not print releases older than this many days
84-
sorted_versions = sorted(
85-
versions, key=lambda x: (x.loose_version, x.csharp_version), reverse=True
135+
sorted_versions = sorted(versions, key=lambda x: x.release_datetime, reverse=True)
136+
137+
highlight_versions = set()
138+
# Highlight the most recent verified version
139+
highlight_versions.add([v for v in sorted_versions if v.is_verified][0])
140+
# Highlight the most recent regular version
141+
highlight_versions.add(
142+
[v for v in sorted_versions if (not v.is_verified and not v.is_master)][0]
86143
)
87144

88-
print(table_line("master (unstable)", "master", "--"))
89-
highlight = True # whether to bold the line or not
145+
count_by_verified = Counter()
146+
90147
for version_info in sorted_versions:
91-
if version_info.elapsed_days <= MAX_DAYS:
92-
print(
93-
table_line(
94-
version_info.display_name,
95-
version_info.release_tag,
96-
version_info.release_date,
97-
highlight,
98-
)
99-
)
100-
highlight = False # only bold the first stable release
148+
highlight = version_info in highlight_versions
149+
if version_info.elapsed_days > MAX_DAYS:
150+
# Make sure we always have at least regular and one verified entry
151+
if count_by_verified[version_info.is_verified] > 0:
152+
continue
153+
print(table_line(version_info, highlight))
154+
count_by_verified[version_info.is_verified] += 1
155+
156+
print("\n\n")

0 commit comments

Comments
 (0)