diff --git a/helloworld/greet/greeting.py b/helloworld/greet/greeting.py index 6a5eb1a..cd0eed4 100644 --- a/helloworld/greet/greeting.py +++ b/helloworld/greet/greeting.py @@ -24,7 +24,7 @@ def __init__( ) self._translator = LanguageTranslator(self._translations) - def greet(self, name: str) -> str: + def greet(self, name: int) -> str: random_greeting = random.choice(list(self._translations.keys())) greeting = self._translator.translate_to_random_language(random_greeting) return f"{greeting}, {name}!".capitalize() diff --git a/helloworld/main.py b/helloworld/main.py index 125d189..c408d10 100644 --- a/helloworld/main.py +++ b/helloworld/main.py @@ -7,7 +7,7 @@ def say_hello() -> None: - greeting = Greeter().greet("Pantsbuild") + greeting = Greeter().greet(5) print(green(greeting)) diff --git a/helloworld/pyproject.toml b/helloworld/pyproject.toml new file mode 100644 index 0000000..47e6dd2 --- /dev/null +++ b/helloworld/pyproject.toml @@ -0,0 +1,4 @@ +[tool.pyright] +reportArgumentType = false +reportGeneralTypeIssues = false +reportMissingImports = false \ No newline at end of file diff --git a/pants.toml b/pants.toml index f5b38ae..e10963b 100644 --- a/pants.toml +++ b/pants.toml @@ -4,13 +4,8 @@ [GLOBAL] pants_version = "2.20.0" backend_packages.add = [ - "pants.backend.build_files.fmt.black", "pants.backend.python", - "pants.backend.python.lint.docformatter", - "pants.backend.python.lint.black", - "pants.backend.python.lint.flake8", - "pants.backend.python.lint.isort", - "pants.backend.python.typecheck.mypy", + "pants.backend.experimental.python.typecheck.pyright", ] [anonymous-telemetry] @@ -18,33 +13,10 @@ enabled = true repo_id = "3B1D361B-E9F1-49A8-B761-03DCC41FD58E" [source] -# The Python source root is the repo root. See https://www.pantsbuild.org/docs/source-roots. -root_patterns = ["/"] +root_patterns = ["/helloworld/"] [python] -# The default interpreter constraints for code in this repo. Individual targets can override -# this with the `interpreter_constraints` field. See -# https://www.pantsbuild.org/docs/python-interpreter-compatibility. +interpreter_constraints = ["==3.8.*"] -# Modify this if you don't have Python 3.9 on your machine. -# This can be a range, such as [">=3.8,<3.11"], but it's usually recommended to restrict -# to a single minor version. -interpreter_constraints = ["==3.9.*"] - -# Enable the "resolves" mechanism, which turns on lockfiles for user code. See -# https://www.pantsbuild.org/docs/python-third-party-dependencies. This also adds the -# `generate-lockfiles` goal for Pants to generate the lockfile for you. -enable_resolves = true - -resolves = { python-default = "python-default.lock"} - -[python-bootstrap] -# We search for interpreters both on the $PATH and in the `$(pyenv root)/versions` folder. -# If you're using macOS, you may want to leave off the entry to avoid using the -# problematic system Pythons. See -# https://www.pantsbuild.org/docs/python-interpreter-compatibility#changing-the-interpreter-search-path. -search_path = ["", ""] - -[python-infer] -# 2.17 is transitioning to a new, faster parser for dependency inference: -use_rust_parser = true +[pyright] +version = "pyright@1.1.347" \ No newline at end of file diff --git a/python-default.lock b/python-default.lock index 41b799a..9c14d1a 100644 --- a/python-default.lock +++ b/python-default.lock @@ -6,7 +6,7 @@ // { // "version": 3, // "valid_for_interpreter_constraints": [ -// "CPython==3.9.*" +// "CPython==3.8.*" // ], // "generated_with_requirements": [ // "ansicolors==1.1.8", @@ -111,19 +111,19 @@ "artifacts": [ { "algorithm": "sha256", - "hash": "8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7", - "url": "https://files.pythonhosted.org/packages/ec/1a/610693ac4ee14fcdf2d9bf3c493370e4f2ef7ae2e19217d7a237ff42367d/packaging-23.2-py3-none-any.whl" + "hash": "2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5", + "url": "https://files.pythonhosted.org/packages/49/df/1fceb2f8900f8639e278b056416d49134fb8d84c5942ffaa01ad34782422/packaging-24.0-py3-none-any.whl" }, { "algorithm": "sha256", - "hash": "048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5", - "url": "https://files.pythonhosted.org/packages/fb/2b/9b9c33ffed44ee921d0967086d653047286054117d584f1b1a7c22ceaf7b/packaging-23.2.tar.gz" + "hash": "eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9", + "url": "https://files.pythonhosted.org/packages/ee/b5/b43a27ac7472e1818c4bafd44430e69605baefe1f34440593e0332ec8b4d/packaging-24.0.tar.gz" } ], "project_name": "packaging", "requires_dists": [], "requires_python": ">=3.7", - "version": "23.2" + "version": "24.0" }, { "artifacts": [ @@ -284,8 +284,10 @@ "platform_tag": null } ], + "only_builds": [], + "only_wheels": [], "path_mappings": {}, - "pex_version": "2.1.148", + "pex_version": "2.2.1", "pip_version": "23.1.2", "prefer_older_binary": false, "requirements": [ @@ -295,7 +297,7 @@ "types-setuptools<58,>=56.2.0" ], "requires_python": [ - "==3.9.*" + "==3.8.*" ], "resolver_version": "pip-2020-resolver", "style": "universal",