Skip to content

Commit

Permalink
switch to Poetry (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
aerickson authored May 17, 2023
1 parent 118673c commit 1db9191
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 185 deletions.
25 changes: 16 additions & 9 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ tasks:
command:
- /bin/bash
- --login
- -cx
- -cxe
- |
CHECKOUT_DIR="/monopacker_checkout"
git clone "${event.pull_request.head.repo.clone_url}" "$CHECKOUT_DIR"
cd "$CHECKOUT_DIR"
git checkout "${event.pull_request.head.sha}"
pip install --no-use-pep517 -r requirements.txt
python setup.py test
pip install pip-tools
./pipupdate.sh
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
export PATH="/root/.local/bin:$PATH"
poetry config virtualenvs.in-project true
poetry install --no-ansi
poetry run pip list
poetry run pytest
poetry update --no-ansi
if ! output=$(git status --porcelain) || [ -n "$output" ]; then
echo "*** ./pipupdate.sh produced changes to the repository; these changes should be checked in ***";
echo "*** `poetry update` produced changes to the repository; these changes should be checked in ***";
git --no-pager diff;
exit 1;
fi
Expand All @@ -48,14 +51,18 @@ tasks:
command:
- /bin/bash
- --login
- -cx
- -cxe
- |
CHECKOUT_DIR="/monopacker_checkout"
git clone "${event.repository.url}" "$CHECKOUT_DIR"
cd "$CHECKOUT_DIR"
git checkout "${event.after}"
pip install -r requirements.txt
python setup.py test
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
export PATH="/root/.local/bin:$PATH"
poetry config virtualenvs.in-project true
poetry install --no-ansi
poetry run pip list
poetry run pytest
metadata:
name: monopacker tests
description: runs tests, validates default packer builders
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ The intention here is to create a single Packer + cloud-init configuration set t
### Install locally
(you will probably want a virtualenv set up first!)
Install Poetry (https://python-poetry.org/) if you don't already have it.

```shell
# install package with runtime dependencies
python setup.py install
# create and activate a poetry virtualenv for this repo
poetry shell
# if developing this package, install dev dependencies
pip -r requirements.txt
# install package
poetry install
```

## Usage
Expand Down Expand Up @@ -122,6 +122,6 @@ Mostly, I just haven't tried to make this work.

# Development

To run the tests for this library, run `python setup.py test`.
To run the tests for this library, run `poetry run pytest`.

To update dependencies, modify `setup.py`, install `pip-tools`, and then run `./pipupdate.sh`.
To update dependencies, run `poetry update`.
6 changes: 0 additions & 6 deletions pipupdate.sh

This file was deleted.

347 changes: 347 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tool.poetry]
name = "monopacker"
version = "0.1.0"
description = "builds taskcluster worker images for AWS and GCP using packer"
authors = ["Miles Crabill <mcrabill@mozilla.com>", "Dustin J. Mitchell <dustin@mozilla.com>"]
maintainers = ["Taskcluster Team <tools-taskcluster@lists.mozilla.org>",
"Release SRE <relops@mozilla.com>",]
license = "MPL 2.0"
readme = "README.md"
keywords = ["packer", "templating"]

[tool.poetry.dependencies]
python = "^3.7"
ruamel-yaml = "^0.16.10"
jinja2 = "^2.11.3"
click = "^7.0"
markupsafe = "2.0.1"

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.2"
pyfakefs = "^5.1.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
monopacker = "monopacker.main:main"
133 changes: 0 additions & 133 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

28 changes: 0 additions & 28 deletions setup.py

This file was deleted.

0 comments on commit 1db9191

Please sign in to comment.