Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[flake8]
# E203 -> whitespace before ':' (conflicts with Black)
# E231 -> Bad trailing comma (conflicts with Black)
# E501 -> line too long (conflicts with Black)

extend-ignore:
E203, # whitespace before ':' (conflicts with Black)
E231, # Bad trailing comma (conflicts with Black)
E501, # line too long (conflicts with Black)
E203,
E231,
E501,
18 changes: 9 additions & 9 deletions .github/workflows/pants.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2020 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

# See https://pants.readme.io/docs/using-pants-in-ci for tips on how to set up your CI with Pants.
# See https://www.pantsbuild.org/stable/docs/using-pants/using-pants-in-ci for tips on how to set up your CI with Pants.

name: Pants

Expand All @@ -11,23 +11,23 @@ jobs:
org-check:
name: Check GitHub Organization
if: ${{ github.repository_owner == 'pantsbuild' }}
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Noop
run: "true"
build:
name: Perform CI Checks
needs: org-check
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: [3.9]
python-version: [3.12]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: pantsbuild/actions/init-pants@v5-scie-pants
- uses: pantsbuild/actions/init-pants@v8
# This action bootstraps pants and manages 2-3 GHA caches.
# See: github.com/pantsbuild/actions/tree/main/init-pants/
with:
Expand All @@ -45,7 +45,7 @@ jobs:
# Note that named_caches and lmdb_store falls back to partial restore keys which
# may give a useful partial result that will save time over completely clean state,
# but will cause the cache entry to grow without bound over time.
# See https://pants.readme.io/docs/using-pants-in-ci for tips on how to periodically clean it up.
# See https://www.pantsbuild.org/stable/docs/using-pants/using-pants-in-ci for tips on how to periodically clean it up.
# Alternatively you change gha-cache-key to ignore old caches.
- name: Check BUILD files
run: |
Expand All @@ -62,7 +62,7 @@ jobs:
pants package ::
pants run helloworld/:pex_binary
- name: Upload pants log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pants-log
path: .pants.d/workdir/pants.log
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ You can run on all changed files:
pants --changed-since=HEAD lint
```

You can run on all changed files, and any of their "dependees":
You can run on all changed files, and any of their "dependents":

```
pants --changed-since=HEAD --changed-dependees=transitive test
pants --changed-since=HEAD --changed-dependents=transitive test
```

## Target specifications
Expand Down Expand Up @@ -139,10 +139,14 @@ pants test helloworld/translator/translator_test.py -- -k test_unknown_phrase #

## Create a PEX binary

The `package` goal requires specifying a target which can be packaged. In this case, the there is a `pex_binary` target with the name `pex_binary` in the `helloworld/BUILD` file.

```
pants package helloworld/main.py
pants package helloworld:pex_binary
```

The pex file is output to `dist/helloworld/pex_binary.pex` and can be executed directly.

## Run a binary directly

```
Expand Down
4 changes: 2 additions & 2 deletions get-pants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Once installed, if you want to update your "pants" launcher binary, use
-h | --help: Print this help message.

-d | --bin-dir:
The directory to install the scie-pants binary in, "~/bin" by default.
The directory to install the scie-pants binary in, "~/.local/bin" by default.

-b | --base-name:
The name to use for the scie-pants binary, "pants" by default.
Expand All @@ -176,7 +176,7 @@ Once installed, if you want to update your "pants" launcher binary, use
EOF
}

bin_dir="${HOME}/bin"
bin_dir="${HOME}/.local/bin"
base_name="pants"
version="latest/download"
while (($# > 0)); do
Expand Down
5 changes: 2 additions & 3 deletions helloworld/greet/greeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

from __future__ import annotations

import importlib.resources
import json
import random

import pkg_resources

from helloworld.translator.translator import LanguageTranslator


Expand All @@ -19,7 +18,7 @@ def __init__(
translations
if translations is not None
else json.loads(
pkg_resources.resource_string(__name__, "translations.json")
importlib.resources.read_text(__name__, "translations.json")
)
)
self._translator = LanguageTranslator(self._translations)
Expand Down
12 changes: 4 additions & 8 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

[GLOBAL]
pants_version = "2.20.0"
pants_version = "2.31.0"
backend_packages.add = [
"pants.backend.build_files.fmt.black",
"pants.backend.python",
Expand All @@ -25,11 +25,11 @@ root_patterns = ["/"]
# 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.

# Modify this if you don't have Python 3.9 on your machine.
#
# Modify this if you don't have Python 3.13 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.*"]
interpreter_constraints = ["==3.12.*"]

# 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
Expand All @@ -44,7 +44,3 @@ resolves = { python-default = "python-default.lock"}
# problematic system Pythons. See
# https://www.pantsbuild.org/docs/python-interpreter-compatibility#changing-the-interpreter-search-path.
search_path = ["<PATH>", "<PYENV>"]

[python-infer]
# 2.17 is transitioning to a new, faster parser for dependency inference:
use_rust_parser = true
Loading