From 10de103449e64b009734d25798d81ce3ee7994ce Mon Sep 17 00:00:00 2001 From: Benjy Weinberger Date: Tue, 22 Mar 2022 13:01:31 -0400 Subject: [PATCH] Fix the README examples, and upgrade to a non-busted Pants. --- README.md | 25 +++++++++++++------------ pants.toml | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 0eb2d34..b2c00c5 100644 --- a/README.md +++ b/README.md @@ -37,25 +37,25 @@ In the latter case, Pants locates target metadata for the source files as needed Invoking goals on files is straightforward, e.g., ``` -./pants test helloworld/util/lang_test.py +./pants test helloworld/greet/greeting_test.py ``` You can use globs: ``` -./pants lint helloworld/util/*.py +./pants lint helloworld/greet/*.py ``` But note that these will be expanded by your shell, so this is equivalent to having used ``` -./pants lint helloworld/util/lang.py helloworld/util/lang_test.py helloworld/util/resources.py helloworld/util/resources_test.py +./pants lint helloworld/greet/__init__.py helloworld/greet/greeting.py helloworld/greet/greeting_test.py ``` If you want Pants itself to expand the globs (which is sometimes necessary), you must quote them in the shell: ``` -./pants lint 'helloworld/util/*.py' +./pants lint 'helloworld/greet/*.py' ``` You can run on all changed files: @@ -75,7 +75,7 @@ You can run on all changed files, and any of their "dependees": Targets are referenced on the command line using their address, of the form `path/to/dir:name`, e.g., ``` -./pants lint helloworld/util:util +./pants lint helloworld/greet:lib ``` You can glob over all targets in a directory with a single trailing `:`, or over all targets in a directory @@ -125,9 +125,10 @@ Try these out in this repo! ``` ./pants test :: # Run all tests in the repo. -./pants test helloworld/util:test # Run all the tests in this target. -./pants test helloworld/util/lang_test.py # Run just the tests in this file. -./pants test helloworld/util/lang_test.py -- -k test_language_translator # Run just this one test. +./pants test --output=all :: # Run all tests in the repo and view pytest output even for tests that passed (you can set this permanently in pants.toml). +./pants test helloworld/translator:tests # Run all the tests in this target. +./pants test helloworld/translator/translator_test.py # Run just the tests in this file. +./pants test helloworld/translator/translator_test.py -- -k test_unknown_phrase # Run just this one test by passing through pytest args. ``` ## Create a PEX binary @@ -136,7 +137,7 @@ Try these out in this repo! ./pants package helloworld/main.py ``` -## Run a binary +## Run a binary directly ``` ./pants run helloworld/main.py @@ -145,8 +146,8 @@ Try these out in this repo! ## Open a REPL ``` -./pants repl helloworld/greet # The REPL will have all relevant code and dependencies on its sys.path. -./pants repl --shell=ipython helloworld/greet --no-pantsd # To use IPython, you must disable Pantsd for now. +./pants repl helloworld/greet:lib # The REPL will have all relevant code and dependencies on its sys.path. +./pants repl --shell=ipython helloworld/greet:lib --no-pantsd # To use IPython, you must disable Pantsd for now. ``` ## Build a wheel / generate `setup.py` @@ -154,7 +155,7 @@ Try these out in this repo! This will build both a `.whl` bdist and a `.tar.gz` sdist. ``` -./pants package helloworld/util:dist +./pants package helloworld/translator:dist ``` ## Count lines of code diff --git a/pants.toml b/pants.toml index 6b89b95..453a9b1 100644 --- a/pants.toml +++ b/pants.toml @@ -2,7 +2,7 @@ # Licensed under the Apache License, Version 2.0 (see LICENSE). [GLOBAL] -pants_version = "2.10.0rc3" +pants_version = "2.10.0rc5" backend_packages.add = [ "pants.backend.python", "pants.backend.python.lint.docformatter",