README.md
1# fetchartifact
2
3This is a Python interface to http://go/fetchartifact, which is used for
4fetching artifacts from http://go/ab.
5
6## Usage
7
8```python
9from fetchartifact import fetchartifact
10
11
12async def main() -> None:
13 artifacts = await fetch_artifact(
14 branch="aosp-master-ndk",
15 target="linux",
16 build="1234",
17 pattern="android-ndk-*.zip",
18 )
19 for artifact in artifacts:
20 print(f"Downloaded {artifact}")
21```
22
23## Development
24
25For first time set-up, install https://python-poetry.org/, then run
26`poetry install` to install the project's dependencies.
27
28This project uses mypy and pylint for linting, black and isort for
29auto-formatting, and pytest for testing. All of these tools will be installed
30automatically, but you may want to configure editor integration for them.
31
32To run any of the tools poetry installed, you can either prefix all your
33commands with `poetry run` (as in `poetry run pytest`), or you can run
34`poetry shell` to enter a shell with all the tools on the `PATH`. The following
35instructions assume you've run `poetry shell` first.
36
37To run the linters:
38
39```bash
40mypy fetchartifact tests
41pylint fetchartifact tests
42```
43
44To auto-format the code (though I recommend configuring your editor to do this
45on save):
46
47```bash
48isort .
49black .
50```
51
52To run the tests and generate coverage:
53
54```bash
55pytest --cov=fetchartifact
56```
57
58Optionally, pass `--cov-report=html` to generate an HTML report, or
59`--cov-report=xml` to generate an XML report for your editor.
60
61Some tests require network access. If you need to run the tests in an
62environment that cannot access the Android build servers, add
63`-m "not requires_network"` to skip those tests. Only a mock service can be
64tested without network access.
65