Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/cache-4
Browse files Browse the repository at this point in the history
  • Loading branch information
ghandic authored Jan 29, 2024
2 parents 1fcb373 + cfa8355 commit 8eceb06
Show file tree
Hide file tree
Showing 27 changed files with 3,243 additions and 613 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
Expand All @@ -30,11 +30,29 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Bootstrap Pants
run: |
./pants --version
- uses: pantsbuild/actions/init-pants@v5-scie-pants
# This action bootstraps pants and manages 2-3 GHA caches.
# See: github.com/pantsbuild/actions/tree/main/init-pants/
with:
# v0 makes it easy to bust the cache if needed
# just increase the integer to start with a fresh cache
gha-cache-key: v0
# The Python backend uses named_caches for Pip/PEX state,
# so it is appropriate to invalidate on lockfile changes.
named-caches-hash: ${{ hashFiles('python-default.lock') }}
# If you're not using a fine-grained remote caching service (see https://www.pantsbuild.org/docs/remote-caching),
# then you may also want to preserve the local Pants cache (lmdb_store). However this must invalidate for
# changes to any file that can affect the build, so may not be practical in larger repos.
# A remote cache service integrates with Pants's fine-grained invalidation and avoids these problems.
cache-lmdb-store: 'true' # defaults to 'false'
# 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.
# Alternatively you change gha-cache-key to ignore old caches.
- name: Check BUILD files
run: ./pants tailor --check update-build-files --check
run: |
pants tailor --check update-build-files --check ::
- name: Lint
run: |
make lint
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Application
*.json
!.vscode/settings.json
!jsf/tests/data/*.json
TODO.md

Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.defaultInterpreterPath": "./dist/export/python/virtualenvs/python-default/3.8.18"
}
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
.PHONY: build

test:
@./pants test ::
@pants test ::

lint:
@./pants lint ::
@pants lint ::

fmt:
@./pants fmt ::
@pants fmt ::

build:
@./pants package ::
@pants package ::

check:
@./pants check ::
@pants check ::

clean:
@rm -rf dist/ .pids/ .pants.d/
3 changes: 3 additions & 0 deletions docs/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python_requirements(
name="reqs",
)
11 changes: 7 additions & 4 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ Every little bit helps, and credit will always be given.

Nothing easier!

Fork and clone the repository, then:
Fork and clone the repository, then install [`pants`](https://www.pantsbuild.org/2.18/docs/getting-started/installing-pants)

```bash
docker build . -t challisa/jsf
docker run -it challisa/jsf bash
# Install `pants` on macos
brew install pantsbuild/tap/pants

# Export the virtual environment for IDE
pants export --py-resolve-format=symlinked_immutable_virtualenv --resolve=python-default
```

That's it!
Expand All @@ -27,7 +30,7 @@ As usual:

**Before committing:**

1. Ensure to run `isort -rc .` followed by `black . --line-length=120` from the root directory
1. Ensure to run `pants fmt ::` from the root directory to format all of the code in the repo before PR submission.
2. Follow our [commit message convention](#commit-message-convention)

If you are unsure about how to fix or ignore a warning,
Expand Down
4 changes: 4 additions & 0 deletions examples/fastapi/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
python_sources()

python_requirements(
name="reqs",
)
13 changes: 13 additions & 0 deletions jsf/3rdparty/python/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
python_requirements(name="reqs")

python_requirements(
name="pytest",
source="pytest-requirements.txt",
resolve="pytest",
)

python_requirements(
name="mypy",
source="mypy-requirements.txt",
resolve="mypy",
)
4 changes: 4 additions & 0 deletions jsf/3rdparty/python/mypy-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mypy==1.1.1
mypy-typing-asserts
types-requests
types-jsonschema
Loading

0 comments on commit 8eceb06

Please sign in to comment.