From 068d57c8cd805eb33f4a6fb9ae2dd6dabb71c706 Mon Sep 17 00:00:00 2001 From: Chris Elion Date: Fri, 15 May 2020 10:52:09 -0700 Subject: [PATCH 1/3] update versions for patch releae --- com.unity.ml-agents/Runtime/Academy.cs | 2 +- com.unity.ml-agents/package.json | 4 ++-- gym-unity/gym_unity/__init__.py | 4 ++-- ml-agents-envs/mlagents_envs/__init__.py | 4 ++-- ml-agents/mlagents/trainers/__init__.py | 4 ++-- utils/validate_versions.py | 28 ++++++++++++++++++++++++ 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/com.unity.ml-agents/Runtime/Academy.cs b/com.unity.ml-agents/Runtime/Academy.cs index e682a55ee0..846a4a1c2a 100644 --- a/com.unity.ml-agents/Runtime/Academy.cs +++ b/com.unity.ml-agents/Runtime/Academy.cs @@ -68,7 +68,7 @@ public class Academy : IDisposable /// Unity package version of com.unity.ml-agents. /// This must match the version string in package.json and is checked in a unit test. /// - internal const string k_PackageVersion = "1.0.0-preview"; + internal const string k_PackageVersion = "1.0.1-preview"; const int k_EditorTrainingPort = 5004; diff --git a/com.unity.ml-agents/package.json b/com.unity.ml-agents/package.json index 35a01ac4e1..777f578a71 100755 --- a/com.unity.ml-agents/package.json +++ b/com.unity.ml-agents/package.json @@ -1,10 +1,10 @@ { "name": "com.unity.ml-agents", "displayName": "ML Agents", - "version": "1.0.0-preview", + "version": "1.0.1-preview", "unity": "2018.4", "description": "Use state-of-the-art machine learning to create intelligent character behaviors in any Unity environment (games, robotics, film, etc.).", "dependencies": { "com.unity.barracuda": "0.7.0-preview" } -} +} \ No newline at end of file diff --git a/gym-unity/gym_unity/__init__.py b/gym-unity/gym_unity/__init__.py index 99bb5d289a..48f4e6c366 100644 --- a/gym-unity/gym_unity/__init__.py +++ b/gym-unity/gym_unity/__init__.py @@ -1,5 +1,5 @@ # Version of the library that will be used to upload to pypi -__version__ = "0.16.0" +__version__ = "0.16.1" # Git tag that will be checked to determine whether to trigger upload to pypi -__release_tag__ = "release_1" +__release_tag__ = "release_2" diff --git a/ml-agents-envs/mlagents_envs/__init__.py b/ml-agents-envs/mlagents_envs/__init__.py index 99bb5d289a..48f4e6c366 100644 --- a/ml-agents-envs/mlagents_envs/__init__.py +++ b/ml-agents-envs/mlagents_envs/__init__.py @@ -1,5 +1,5 @@ # Version of the library that will be used to upload to pypi -__version__ = "0.16.0" +__version__ = "0.16.1" # Git tag that will be checked to determine whether to trigger upload to pypi -__release_tag__ = "release_1" +__release_tag__ = "release_2" diff --git a/ml-agents/mlagents/trainers/__init__.py b/ml-agents/mlagents/trainers/__init__.py index 99bb5d289a..48f4e6c366 100644 --- a/ml-agents/mlagents/trainers/__init__.py +++ b/ml-agents/mlagents/trainers/__init__.py @@ -1,5 +1,5 @@ # Version of the library that will be used to upload to pypi -__version__ = "0.16.0" +__version__ = "0.16.1" # Git tag that will be checked to determine whether to trigger upload to pypi -__release_tag__ = "release_1" +__release_tag__ = "release_2" diff --git a/utils/validate_versions.py b/utils/validate_versions.py index 4833387402..c5a2243de5 100755 --- a/utils/validate_versions.py +++ b/utils/validate_versions.py @@ -117,6 +117,30 @@ def set_academy_version_string(new_version): f.writelines(lines) +def print_release_tag_commands( + python_version: str, csharp_version: str, release_tag: str +): + python_tag = f"python-packages_{python_version}" + csharp_tag = f"com.unity.ml-agents_{csharp_version}" + docs_tag = f"{release_tag}_docs" + print( + f""" +### +Use these commands to create the tags after the release: +### +git checkout {release_tag} +git tag -f latest_release +git push -f origin latest_release +git tag -f {docs_tag} +git push -f origin {docs_tag} +git tag {python_tag} +git push -f origin {python_tag} +git tag {csharp_tag} +git push -f origin {csharp_tag} +""" + ) + + if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--python-version", default=None) @@ -131,6 +155,10 @@ def set_academy_version_string(new_version): if args.csharp_version: print(f"Updating C# package to version {args.csharp_version}") set_version(args.python_version, args.csharp_version, args.release_tag) + if args.release_tag is not None: + print_release_tag_commands( + args.python_version, args.csharp_version, args.release_tag + ) else: ok = check_versions() return_code = 0 if ok else 1 From acd8b8d0cf9c148296dbe5b3304b05cff721d8bf Mon Sep 17 00:00:00 2001 From: Chris Elion Date: Wed, 13 May 2020 10:57:53 -0700 Subject: [PATCH 2/3] Update precommit flake8 (#3961) * fix flake8 errors * update flake8 hook * update flake8 plugins --- .pre-commit-config.yaml | 23 +++++++++++-------- ml-agents/mlagents/trainers/ppo/trainer.py | 4 ++-- .../trainers/subprocess_env_manager.py | 2 +- .../tests/yamato/check_coverage_percent.py | 6 ++--- ml-agents/tests/yamato/yamato_utils.py | 2 +- utils/validate_versions.py | 6 ++--- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7de2532f6d..47380e103d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,8 +27,20 @@ repos: files: "gym-unity/.*" args: [--ignore-missing-imports, --disallow-incomplete-defs] +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.1 + hooks: + - id: flake8 + exclude: > + (?x)^( + .*_pb2.py| + .*_pb2_grpc.py + )$ + # flake8-tidy-imports is used for banned-modules, not actually tidying + additional_dependencies: [flake8-comprehensions==3.2.2, flake8-tidy-imports==4.1.0, flake8-bugbear==20.1.4] + - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v2.5.0 hooks: - id: mixed-line-ending exclude: > @@ -38,14 +50,7 @@ repos: .*.meta )$ args: [--fix=lf] - - id: flake8 - exclude: > - (?x)^( - .*_pb2.py| - .*_pb2_grpc.py - )$ - # flake8-tidy-imports is used for banned-modules, not actually tidying - additional_dependencies: [flake8-comprehensions==3.1.4, flake8-tidy-imports==4.0.0, flake8-bugbear==20.1.2] + - id: trailing-whitespace name: trailing-whitespace-markdown types: [markdown] diff --git a/ml-agents/mlagents/trainers/ppo/trainer.py b/ml-agents/mlagents/trainers/ppo/trainer.py index 81ed6ffab7..c38e2b22be 100644 --- a/ml-agents/mlagents/trainers/ppo/trainer.py +++ b/ml-agents/mlagents/trainers/ppo/trainer.py @@ -204,9 +204,9 @@ def _update_policy(self): self.update_buffer.shuffle(sequence_length=self.policy.sequence_length) buffer = self.update_buffer max_num_batch = buffer_length // batch_size - for l in range(0, max_num_batch * batch_size, batch_size): + for i in range(0, max_num_batch * batch_size, batch_size): update_stats = self.optimizer.update( - buffer.make_mini_batch(l, l + batch_size), n_sequences + buffer.make_mini_batch(i, i + batch_size), n_sequences ) for stat_name, value in update_stats.items(): batch_update_stats[stat_name].append(value) diff --git a/ml-agents/mlagents/trainers/subprocess_env_manager.py b/ml-agents/mlagents/trainers/subprocess_env_manager.py index 77ec16b369..dad59fe5ad 100644 --- a/ml-agents/mlagents/trainers/subprocess_env_manager.py +++ b/ml-agents/mlagents/trainers/subprocess_env_manager.py @@ -301,7 +301,7 @@ def external_brains(self) -> Dict[BehaviorName, BrainParameters]: return self.env_workers[0].recv().payload def close(self) -> None: - logger.debug(f"SubprocessEnvManager closing.") + logger.debug("SubprocessEnvManager closing.") self.step_queue.close() self.step_queue.join_thread() for env_worker in self.env_workers: diff --git a/ml-agents/tests/yamato/check_coverage_percent.py b/ml-agents/tests/yamato/check_coverage_percent.py index a4b10105e7..e3f2f11f76 100644 --- a/ml-agents/tests/yamato/check_coverage_percent.py +++ b/ml-agents/tests/yamato/check_coverage_percent.py @@ -25,9 +25,9 @@ def check_coverage(root_dir, min_percentage): # Rather than try to parse the XML, just look for a line of the form # 73.9 lines = f.readlines() - for l in lines: - if "Linecoverage" in l: - pct = l.replace("", "").replace("", "") + for line in lines: + if "Linecoverage" in line: + pct = line.replace("", "").replace("", "") pct = float(pct) if pct < min_percentage: print( diff --git a/ml-agents/tests/yamato/yamato_utils.py b/ml-agents/tests/yamato/yamato_utils.py index 341783722d..c4be6532d3 100644 --- a/ml-agents/tests/yamato/yamato_utils.py +++ b/ml-agents/tests/yamato/yamato_utils.py @@ -150,7 +150,7 @@ def undo_git_checkout(): subprocess.check_call("git reset HEAD .", shell=True) subprocess.check_call("git checkout -- .", shell=True) # Ensure the cache isn't polluted with old compiled assemblies. - subprocess.check_call(f"rm -rf Project/Library", shell=True) + subprocess.check_call("rm -rf Project/Library", shell=True) def override_config_file(src_path, dest_path, **kwargs): diff --git a/utils/validate_versions.py b/utils/validate_versions.py index c5a2243de5..700949a382 100755 --- a/utils/validate_versions.py +++ b/utils/validate_versions.py @@ -39,9 +39,9 @@ def _escape_non_none(s: Optional[str]) -> str: def extract_version_string(filename): with open(filename) as f: - for l in f.readlines(): - if l.startswith(VERSION_LINE_START): - return l.replace(VERSION_LINE_START, "").strip() + for line in f.readlines(): + if line.startswith(VERSION_LINE_START): + return line.replace(VERSION_LINE_START, "").strip() return None From 4bf2093bf815efc4fe648b57064cbf085aac512b Mon Sep 17 00:00:00 2001 From: Chris Elion Date: Fri, 15 May 2020 11:12:45 -0700 Subject: [PATCH 3/3] fix changelog --- com.unity.ml-agents/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index 7b8bc296d8..c7664fad07 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.0.1-preview] - 2020-05-19 +### Bug Fixes +#### com.unity.ml-agents (C#) +#### ml-agents / ml-agents-envs / gym-unity (Python) + ## [1.0.0-preview] - 2020-05-06 ### Major Changes