From 036630e08b744df0c75ee22188c04649818f3b1c Mon Sep 17 00:00:00 2001 From: Stu Hood Date: Mon, 6 Jan 2020 10:48:31 -0800 Subject: [PATCH] Prepare 1.25.0.dev0. (#8902) --- pants.ini | 4 - src/python/pants/VERSION | 2 +- .../python/py_thrift_namespace_clash_check.py | 17 +-- src/python/pants/notes/master.rst | 125 ++++++++++++++++++ .../pants/task/target_restriction_mixins.py | 1 + .../test_py_thrift_namespace_clash_check.py | 21 ++- 6 files changed, 147 insertions(+), 23 deletions(-) diff --git a/pants.ini b/pants.ini index 82e7cca6f19..19e0f05998d 100644 --- a/pants.ini +++ b/pants.ini @@ -166,10 +166,6 @@ deps: ["3rdparty:thrift"] deps: ["examples/3rdparty/python:thrift"] -[gen.py-thrift-namespace-clash-check] -strict: True - - [gen.thrifty] allow_dups: True diff --git a/src/python/pants/VERSION b/src/python/pants/VERSION index 38c080ab337..72d14b2d8eb 100644 --- a/src/python/pants/VERSION +++ b/src/python/pants/VERSION @@ -1 +1 @@ -1.24.0rc0 +1.25.0.dev0 diff --git a/src/python/pants/backend/codegen/thrift/python/py_thrift_namespace_clash_check.py b/src/python/pants/backend/codegen/thrift/python/py_thrift_namespace_clash_check.py index ec6b86097f6..860ac41f6db 100644 --- a/src/python/pants/backend/codegen/thrift/python/py_thrift_namespace_clash_check.py +++ b/src/python/pants/backend/codegen/thrift/python/py_thrift_namespace_clash_check.py @@ -6,7 +6,6 @@ from collections import OrderedDict, defaultdict from pants.backend.codegen.thrift.python.python_thrift_library import PythonThriftLibrary -from pants.base.deprecated import deprecated_conditional from pants.base.exceptions import TaskError from pants.engine.fs import FilesContent from pants.task.task import Task @@ -27,8 +26,10 @@ class PyThriftNamespaceClashCheck(Task): @classmethod def register_options(cls, register): super().register_options(register) - # TODO: deprecate the --strict option in a future release, and strict should be always true. register('--strict', type=bool, default=False, fingerprint=True, + removal_version="1.27.0.dev0", + removal_hint='This option is now a noop: use either `--strict-clashing-py-namespace` ' + 'or --strict-missing-py-namespace', help='Whether to fail the build if any namespace issue is found') register('--strict-clashing-py-namespace', type=bool, default=False, fingerprint=True, help='Whether to fail the build if thrift sources have clashing py namespaces.') @@ -141,18 +142,10 @@ def _determine_clashing_namespaces(self, py_namespaces_by_target, is_strict): return namespaces_by_files def execute(self): - deprecated_conditional( - lambda: self.get_options().strict, - removal_version='1.25.0.dev0', - entity_description=self.options_scope, - hint_message='--strict will be removed. ' - 'Please use --strict-clashing-py-namespace or --strict-missing-py-namespace ' - 'to be more explicit on which error type should fail the build.') - py_thrift_targets = self.get_targets(lambda tgt: isinstance(tgt, PythonThriftLibrary)) thrift_file_sources_by_target = self._get_python_thrift_library_sources(py_thrift_targets) py_namespaces_by_target = self._extract_all_python_namespaces(thrift_file_sources_by_target, - self.get_options().strict or self.get_options().strict_missing_py_namespace) + self.get_options().strict_missing_py_namespace) namespaces_by_files = self._determine_clashing_namespaces(py_namespaces_by_target, - self.get_options().strict or self.get_options().strict_clashing_py_namespace) + self.get_options().strict_clashing_py_namespace) self.context.products.register_data('_py_thrift_namespaces_by_files', namespaces_by_files) diff --git a/src/python/pants/notes/master.rst b/src/python/pants/notes/master.rst index 723960db24a..cd3b3299de6 100644 --- a/src/python/pants/notes/master.rst +++ b/src/python/pants/notes/master.rst @@ -4,6 +4,131 @@ Master Pre-Releases This document describes development releases which occur weekly from master, and which have not undergone the vetting associated with ``stable`` releases. +1.25.0.dev0 (01/06/2020) +------------------------ + +API Changes +~~~~~~~~~~~ + +* Deprecate `--fmt-skip` and `--lint-skip` (#8900) + `Issue #8346 `_ + `PR #8900 `_ + +* Add `--skip` option to every linter/formatter subsystem (#8898) + `PR #8898 `_ + +* Add ESLint subsystem and deprecate `node-distribution` ESLint options (#8891) + `PR #8891 `_ + +* Add `--black-skip`, `--isort-skip`, and `--flake8-skip` (#8888) + `PR #8888 `_ + +* Deprecate running `python-eval` by default (#8889) + `PR #8889 `_ + +* Add `scrooge-linter` subsystem and deprecate `lint-thrift` options (#8894) + `PR #8894 `_ + +* Add `checkstyle` subsystem and deprecate `--lint-checkstyle-configuration` (#8896) + `PR #8896 `_ + +* Deprecate `option.custom_types.dict_option` and `list_option` (#8885) + `PR #8885 `_ + +* Add `scalafix`, `scalafmt`, and `scalastyle` subsystems and deprecate task-level config options (#8886) + `PR #8886 `_ + +* Stop using Java 6 and 7 internally (#8657) + `PR #8657 `_ + +* Bump default MyPy from 0.740 to 0.761 (#8866) + `PR #8866 `_ + +Bugfixes +~~~~~~~~ + +* Use absolute path when running interactive process in tempdir (#8895) + `PR #8895 `_ + +* Fix `./pants lint2` for Black and isort (#8877) + `PR #8877 `_ + `PR #8823 `_ + +* Provide input_files Digest to InteractiveRunner (#8855) + `PR #8855 `_ + +* Support enums when displaying option help choices (#8853) + `PR #8853 `_ + +* Hotfix MyPy not working on macOS due to type alias (#8887) + `PR #8887 `_ + +* Fix isort, Pytest, and MyPy options to be fingerprinted (#8871) + `PR #8871 `_ + +* Report a deprecation for the option name rather than for the dest. (#8856) + `PR #8856 `_ + +Refactoring, Improvements, and Tooling +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Use V2 isort internally (#8756) + `PR #8756 `_ + +* Refactor `python_test_runner` to use the new pex creation rule (#8852) + `PR #8852 `_ + +* Add type hints to `option/` and `subsystem/` (#8878) + `PR #8878 `_ + +* Replace deprecated `assertRaisesRegexp` with `assertRaisesRegex` (#8879) + `PR #8879 `_ + +* Remove deprecated `--pytest-requirements`, `--pytest-timeout-requirements`, `--pytest-cov-requirements`, and `--pytest-unittest2-requirements` (#8876) + `PR #8876 `_ + +* Partially type check remaining 250 files (#8875) + `PR #8875 `_ + +* Stop referencing Python 4 in Python interpreter constraints (#8867) + `PR #8867 `_ + +* Partially type check `TestBase` and 235 test files (#8874) + `PR #8874 `_ + +* Finish partially type checking all `src` code (#8865) + `PR #8865 `_ + +* Refactor `option` and `subsystem` tests (#8872) + `PR #8872 `_ + +* Type check `build-support/bin/generate_travis_yml.py` (#8868) + `PR #8868 `_ + +* Move `option` and `subsystem` tests from `tests/python` to `src/python` (#8870) + `PR #8870 `_ + +* make match() on Enum into a top-level function in meta.py (#8504) + `PR #8504 `_ + +* add SingleFileExecutable to make it easier to consume Snapshots of executables (#8860) + `PR #8860 `_ + +* improve ergonomics of checking for @union types with new @decorated_type_checkable decorator (#8496) + `PR #8496 `_ + +* Partially type check `backend/native` and 100 more files (#8864) + `PR #8864 `_ + +* Fix type hints for decorators in `memo.py` and `meta.py` (#8863) + `PR #8863 `_ + +* [IntelliJ] Export only modulizable targets when in `export-dep-as-jar` (#8812) + `PR #8812 `_ + +* Use raw strings to fix regex deprecation warnings (#8880) + `PR #8880 `_ + 1.24.0rc0 (12/19/2019) ---------------------- diff --git a/src/python/pants/task/target_restriction_mixins.py b/src/python/pants/task/target_restriction_mixins.py index 261f6cf79fb..563eaaf9a12 100644 --- a/src/python/pants/task/target_restriction_mixins.py +++ b/src/python/pants/task/target_restriction_mixins.py @@ -125,6 +125,7 @@ def register_options(cls, register): 'lint-google-java-format': 'google-java-format', 'fmt-isort': 'isort', 'lint-mypy': 'mypy', + 'lint-pythonstyle': 'pycheck', 'lint-python-eval': 'python-eval', 'fmt-scalafix': 'scalafix', 'lint-scalafix': 'scalafix', diff --git a/tests/python/pants_test/backend/codegen/thrift/python/test_py_thrift_namespace_clash_check.py b/tests/python/pants_test/backend/codegen/thrift/python/test_py_thrift_namespace_clash_check.py index 1e5f0e70910..13e20f536a8 100644 --- a/tests/python/pants_test/backend/codegen/thrift/python/test_py_thrift_namespace_clash_check.py +++ b/tests/python/pants_test/backend/codegen/thrift/python/test_py_thrift_namespace_clash_check.py @@ -91,8 +91,11 @@ def task_type(cls): def _target_dict(self): return self.populate_target_dict(self._target_specs) - def _run_tasks(self, target_roots): - self.set_options(strict=True) + def _run_tasks(self, target_roots, strict_missing_py_namespace=False, strict_clashing_py_namespace=False): + self.set_options( + strict_missing_py_namespace=strict_missing_py_namespace, + strict_clashing_py_namespace=strict_clashing_py_namespace, + ) return self.invoke_tasks(target_roots=target_roots) _exception_prelude = """\ @@ -105,7 +108,7 @@ def _run_tasks(self, target_roots): def test_no_py_namespace(self): no_py_namespace_target = self._target_dict()['no-py-namespace'] with self.assertRaises(PyThriftNamespaceClashCheck.NamespaceExtractionError) as cm: - self._run_tasks(target_roots=[no_py_namespace_target]) + self._run_tasks(target_roots=[no_py_namespace_target], strict_missing_py_namespace=True) self.assertEqual(str(cm.exception), """\ Python namespaces could not be extracted from some thrift sources. Declaring a `namespace py` in thrift sources for python thrift library targets will soon become required. @@ -123,7 +126,8 @@ def test_clashing_namespace_same_target(self): with self.assertRaisesWithMessage(PyThriftNamespaceClashCheck.ClashingNamespaceError, """{} org.pantsbuild.namespace: [(src/py-thrift:clashing-namespace, src/py-thrift/a.thrift), (src/py-thrift:clashing-namespace, src/py-thrift/b.thrift)] """.format(self._exception_prelude)): - self._run_tasks(target_roots=[clashing_same_target]) + self._run_tasks(target_roots=[clashing_same_target], strict_clashing_py_namespace=True) + self._run_tasks(target_roots=[clashing_same_target], strict_clashing_py_namespace=False) def test_clashing_namespace_multiple_targets(self): target_dict = self._target_dict() @@ -131,11 +135,16 @@ def test_clashing_namespace_multiple_targets(self): with self.assertRaisesWithMessage(PyThriftNamespaceClashCheck.ClashingNamespaceError, """{} org.pantsbuild.namespace: [(src/py-thrift-clashing:clashingA, src/py-thrift-clashing/a.thrift), (src/py-thrift-clashing:clashingB, src/py-thrift-clashing/b.thrift)] """.format(self._exception_prelude)): - self._run_tasks(target_roots=clashing_targets) + self._run_tasks(target_roots=clashing_targets, strict_clashing_py_namespace=True) + self._run_tasks(target_roots=clashing_targets, strict_clashing_py_namespace=False) def test_accepts_py_namespace_with_comments_above(self): commented_thrift_source_target = self._target_dict()['with-comments-and-other-namespaces'] - result = self._run_tasks(target_roots=[commented_thrift_source_target]) + result = self._run_tasks( + target_roots=[commented_thrift_source_target], + strict_missing_py_namespace=True, + strict_clashing_py_namespace=True, + ) # Check that the file was correctly mapped to the namespace parsed out of its file content. namespaces_by_files = result.context.products.get_data('_py_thrift_namespaces_by_files') self.assertEqual(