Skip to content

Commit

Permalink
Prepare 1.25.0.dev0. (#8902)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuhood authored Jan 6, 2020
1 parent efa5971 commit 036630e
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 23 deletions.
4 changes: 0 additions & 4 deletions pants.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.24.0rc0
1.25.0.dev0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.')
Expand Down Expand Up @@ -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)
125 changes: 125 additions & 0 deletions src/python/pants/notes/master.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/pantsbuild/pants/issues/8346>`_
`PR #8900 <https://github.com/pantsbuild/pants/pull/8900>`_

* Add `--skip` option to every linter/formatter subsystem (#8898)
`PR #8898 <https://github.com/pantsbuild/pants/pull/8898>`_

* Add ESLint subsystem and deprecate `node-distribution` ESLint options (#8891)
`PR #8891 <https://github.com/pantsbuild/pants/pull/8891>`_

* Add `--black-skip`, `--isort-skip`, and `--flake8-skip` (#8888)
`PR #8888 <https://github.com/pantsbuild/pants/pull/8888>`_

* Deprecate running `python-eval` by default (#8889)
`PR #8889 <https://github.com/pantsbuild/pants/pull/8889>`_

* Add `scrooge-linter` subsystem and deprecate `lint-thrift` options (#8894)
`PR #8894 <https://github.com/pantsbuild/pants/pull/8894>`_

* Add `checkstyle` subsystem and deprecate `--lint-checkstyle-configuration` (#8896)
`PR #8896 <https://github.com/pantsbuild/pants/pull/8896>`_

* Deprecate `option.custom_types.dict_option` and `list_option` (#8885)
`PR #8885 <https://github.com/pantsbuild/pants/pull/8885>`_

* Add `scalafix`, `scalafmt`, and `scalastyle` subsystems and deprecate task-level config options (#8886)
`PR #8886 <https://github.com/pantsbuild/pants/pull/8886>`_

* Stop using Java 6 and 7 internally (#8657)
`PR #8657 <https://github.com/pantsbuild/pants/pull/8657>`_

* Bump default MyPy from 0.740 to 0.761 (#8866)
`PR #8866 <https://github.com/pantsbuild/pants/pull/8866>`_

Bugfixes
~~~~~~~~

* Use absolute path when running interactive process in tempdir (#8895)
`PR #8895 <https://github.com/pantsbuild/pants/pull/8895>`_

* Fix `./pants lint2` for Black and isort (#8877)
`PR #8877 <https://github.com/pantsbuild/pants/pull/8877>`_
`PR #8823 <https://github.com/pantsbuild/pants/pull/8823>`_

* Provide input_files Digest to InteractiveRunner (#8855)
`PR #8855 <https://github.com/pantsbuild/pants/pull/8855>`_

* Support enums when displaying option help choices (#8853)
`PR #8853 <https://github.com/pantsbuild/pants/pull/8853>`_

* Hotfix MyPy not working on macOS due to type alias (#8887)
`PR #8887 <https://github.com/pantsbuild/pants/pull/8887>`_

* Fix isort, Pytest, and MyPy options to be fingerprinted (#8871)
`PR #8871 <https://github.com/pantsbuild/pants/pull/8871>`_

* Report a deprecation for the option name rather than for the dest. (#8856)
`PR #8856 <https://github.com/pantsbuild/pants/pull/8856>`_

Refactoring, Improvements, and Tooling
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Use V2 isort internally (#8756)
`PR #8756 <https://github.com/pantsbuild/pants/pull/8756>`_

* Refactor `python_test_runner` to use the new pex creation rule (#8852)
`PR #8852 <https://github.com/pantsbuild/pants/pull/8852>`_

* Add type hints to `option/` and `subsystem/` (#8878)
`PR #8878 <https://github.com/pantsbuild/pants/pull/8878>`_

* Replace deprecated `assertRaisesRegexp` with `assertRaisesRegex` (#8879)
`PR #8879 <https://github.com/pantsbuild/pants/pull/8879>`_

* Remove deprecated `--pytest-requirements`, `--pytest-timeout-requirements`, `--pytest-cov-requirements`, and `--pytest-unittest2-requirements` (#8876)
`PR #8876 <https://github.com/pantsbuild/pants/pull/8876>`_

* Partially type check remaining 250 files (#8875)
`PR #8875 <https://github.com/pantsbuild/pants/pull/8875>`_

* Stop referencing Python 4 in Python interpreter constraints (#8867)
`PR #8867 <https://github.com/pantsbuild/pants/pull/8867>`_

* Partially type check `TestBase` and 235 test files (#8874)
`PR #8874 <https://github.com/pantsbuild/pants/pull/8874>`_

* Finish partially type checking all `src` code (#8865)
`PR #8865 <https://github.com/pantsbuild/pants/pull/8865>`_

* Refactor `option` and `subsystem` tests (#8872)
`PR #8872 <https://github.com/pantsbuild/pants/pull/8872>`_

* Type check `build-support/bin/generate_travis_yml.py` (#8868)
`PR #8868 <https://github.com/pantsbuild/pants/pull/8868>`_

* Move `option` and `subsystem` tests from `tests/python` to `src/python` (#8870)
`PR #8870 <https://github.com/pantsbuild/pants/pull/8870>`_

* make match() on Enum into a top-level function in meta.py (#8504)
`PR #8504 <https://github.com/pantsbuild/pants/pull/8504>`_

* add SingleFileExecutable to make it easier to consume Snapshots of executables (#8860)
`PR #8860 <https://github.com/pantsbuild/pants/pull/8860>`_

* improve ergonomics of checking for @union types with new @decorated_type_checkable decorator (#8496)
`PR #8496 <https://github.com/pantsbuild/pants/pull/8496>`_

* Partially type check `backend/native` and 100 more files (#8864)
`PR #8864 <https://github.com/pantsbuild/pants/pull/8864>`_

* Fix type hints for decorators in `memo.py` and `meta.py` (#8863)
`PR #8863 <https://github.com/pantsbuild/pants/pull/8863>`_

* [IntelliJ] Export only modulizable targets when in `export-dep-as-jar` (#8812)
`PR #8812 <https://github.com/pantsbuild/pants/pull/8812>`_

* Use raw strings to fix regex deprecation warnings (#8880)
`PR #8880 <https://github.com/pantsbuild/pants/pull/8880>`_

1.24.0rc0 (12/19/2019)
----------------------

Expand Down
1 change: 1 addition & 0 deletions src/python/pants/task/target_restriction_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """\
Expand All @@ -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.
Expand All @@ -123,19 +126,25 @@ 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()
clashing_targets = [target_dict[k] for k in ['clashingA', 'clashingB']]
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(
Expand Down

0 comments on commit 036630e

Please sign in to comment.