Skip to content

Commit

Permalink
Update README (#261)
Browse files Browse the repository at this point in the history
* Upgrade dependencies

* Fix terraform installation into Dockerfile

* Update README

* Fix pyproject sorting

* Fix minors into README

* Fix requirements sorting

* Update README.md

Co-authored-by: Paolo Melchiorre <paolo@melchiorre.org>

* Improve Dockerfile

* Restore requirements

* Fix minors

* Update requirements/test.in

Co-authored-by: Paolo Melchiorre <paolo@melchiorre.org>

---------

Co-authored-by: Paolo Melchiorre <paolo@melchiorre.org>
  • Loading branch information
trottomv and pauloxnet authored Jan 12, 2024
1 parent 823332e commit b3445c4
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 90 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements/test.txt
- name: Run Test
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ cython_debug/
.DS_Store

# Ruff
.ruff_cache
.ruff_cache

# Terraform
.terraform*
Expand Down
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ ARG DEBIAN_FRONTEND=noninteractive
ARG OUTPUT_BASE_DIR=/data
ENV OUTPUT_BASE_DIR=${OUTPUT_BASE_DIR}
WORKDIR /app
COPY ./requirements/common.txt requirements/common.txt
RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
curl \
git \
gnupg \
libpq-dev \
software-properties-common \
&& curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - \
&& apt-add-repository "deb https://apt.releases.hashicorp.com $(lsb_release -cs) main" \
&& apt-get update && apt-get install -y --no-install-recommends terraform \
&& curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg \
&& gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint \
&& echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list \
&& apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
terraform \
&& rm -rf /var/lib/apt/lists/*
COPY ./requirements/common.txt requirements/common.txt
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools \
&& python3 -m pip install --no-cache-dir -r requirements/common.txt
COPY . .
RUN mkdir ${OUTPUT_BASE_DIR}
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ outdated: ## Check outdated requirements and dependencies

.PHONY: pip
pip: pip_update ## Compile requirements
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --upgrade --output-file requirements/common.txt requirements/common.in
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --upgrade --output-file requirements/local.txt requirements/local.in
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --upgrade --output-file requirements/test.txt requirements/test.in
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/common.txt requirements/common.in
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/local.txt requirements/local.in
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/test.txt requirements/test.in

.PHONY: pip_update
pip_update: ## Update requirements and dependencies
Expand Down
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,34 @@
## 🧩 Requirements

The Talos script can be run either using Docker or as a local shell command.
The Talos script can be run either using Docker or a Python virtual environment.

### 🐋 Docker

In order to run Talos via Docker, a working [Docker installation](https://docs.docker.com/get-docker/) is the only requirement.

### 👨‍💻 Shell command
### 🐍 Virtual environment

In order to run Talos as a shell command, first clone the repository in a local projects directory
In order to run Talos in a virtual environment, first clone the repository in a local projects directory and ensure it is your current directory:

```console
cd ~/projects
git clone git@github.com:20tab/talos.git
cd talos
```

Then, install the following requirements:
Then, create and activate a virtual environment and install the requirements:

| Requirements | Instructions |
| ---------------------- | ---------------------------------------------------------------------------- |
| 🌎 Terraform | [Install Guide](https://learn.hashicorp.com/tutorials/terraform/install-cli) |
| 🐍 Python Dependencies | `pip install -r talos/requirements/common.txt` |
```console
python3.12 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip setuptools
python3 -m pip install -r requirements/common.txt
```

The `terraform` cli package is required, unless you want to generate a project only locally. To install it we suggest to use the official [install guide](https://learn.hashicorp.com/tutorials/terraform/install-cli).

## 🔑 Credentials
## 🔑 Credentials (optional)

### 🌊 DigitalOcean

Expand Down Expand Up @@ -57,7 +62,7 @@ If the Terraform Cloud integration is enabled, a User API token is required.<br/

## 🚀️ Quickstart

Change to the projects directory, for example
Change to the projects directory, for example:

```console
cd ~/projects
Expand All @@ -71,9 +76,10 @@ docker run --interactive --tty --rm --volume $PWD/.dumps:/app/.dumps --volume $P

**Note:** On a non-AMD64 architecture, `--platform linux/amd64` can be passed to force emulation.

### 👨‍💻 Shell command
### 🐍 Virtual environment

```console
source talos/.venv/bin/activate
./talos/start.py
```

Expand Down
46 changes: 23 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
[tool.black]
target-version = ["py312"]

[tool.coverage.html]
title = "Talos - Coverage"
show_contexts = true

[tool.coverage.report]
show_missing = true

[tool.coverage.run]
branch = true
dynamic_context = "test_function"
omit = [
".venv/*",
"venv/*",
]
source = ["."]

[tool.mypy]
enable_error_code = [
"truthy-bool",
]
ignore_missing_imports = true
python_version = "3.12"

[tool.ruff]
extend-exclude = [
"__pycache__",
Expand Down Expand Up @@ -66,3 +43,26 @@ combine-as-imports = true
known-first-party = [
"bootstrap",
]

[tool.coverage.html]
title = "Talos - Coverage"
show_contexts = true

[tool.coverage.report]
show_missing = true

[tool.coverage.run]
branch = true
dynamic_context = "test_function"
omit = [
".venv/*",
"venv/*",
]
source = ["."]

[tool.mypy]
enable_error_code = [
"truthy-bool",
]
ignore_missing_imports = true
python_version = "3.12"
6 changes: 3 additions & 3 deletions requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ idna==3.6 \
--hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \
--hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
# via requests
jinja2==3.1.2 \
--hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \
--hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61
jinja2==3.1.3 \
--hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \
--hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90
# via cookiecutter
markdown-it-py==3.0.0 \
--hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \
Expand Down
44 changes: 22 additions & 22 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ cookiecutter==2.5.0 \
--hash=sha256:8aa2f12ed11bc05628651e9dc4353a10571dd9908aaaaeec959a2b9ea465a5d2 \
--hash=sha256:e61e9034748e3f41b8bd2c11f00d030784b48711c4d5c42363c50989a65331ec
# via -r requirements/common.in
coverage[toml]==7.4.0 \
coverage==7.4.0 \
--hash=sha256:04387a4a6ecb330c1878907ce0dc04078ea72a869263e53c72a1ba5bbdf380ca \
--hash=sha256:0676cd0ba581e514b7f726495ea75aba3eb20899d824636c6f59b0ed2f88c471 \
--hash=sha256:0e8d06778e8fbffccfe96331a3946237f87b1e1d359d7fbe8b06b96c95a5407a \
Expand Down Expand Up @@ -244,9 +244,9 @@ jedi==0.19.1 \
--hash=sha256:cf0496f3651bc65d7174ac1b7d043eff454892c708a87d1b683e57b569927ffd \
--hash=sha256:e983c654fe5c02867aef4cdfce5a2fbb4a50adc0af145f70504238f18ef5e7e0
# via ipython
jinja2==3.1.2 \
--hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \
--hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61
jinja2==3.1.3 \
--hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \
--hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90
# via cookiecutter
markdown-it-py==3.0.0 \
--hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \
Expand Down Expand Up @@ -527,24 +527,24 @@ rich==13.7.0 \
--hash=sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa \
--hash=sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235
# via cookiecutter
ruff==0.1.11 \
--hash=sha256:09c415716884950080921dd6237767e52e227e397e2008e2bed410117679975b \
--hash=sha256:0f58948c6d212a6b8d41cd59e349751018797ce1727f961c2fa755ad6208ba45 \
--hash=sha256:190a566c8f766c37074d99640cd9ca3da11d8deae2deae7c9505e68a4a30f740 \
--hash=sha256:231d8fb11b2cc7c0366a326a66dafc6ad449d7fcdbc268497ee47e1334f66f77 \
--hash=sha256:4b077ce83f47dd6bea1991af08b140e8b8339f0ba8cb9b7a484c30ebab18a23f \
--hash=sha256:5b25093dad3b055667730a9b491129c42d45e11cdb7043b702e97125bcec48a1 \
--hash=sha256:6464289bd67b2344d2a5d9158d5eb81025258f169e69a46b741b396ffb0cda95 \
--hash=sha256:934832f6ed9b34a7d5feea58972635c2039c7a3b434fe5ba2ce015064cb6e955 \
--hash=sha256:97ce4d752f964ba559c7023a86e5f8e97f026d511e48013987623915431c7ea9 \
--hash=sha256:9b8f397902f92bc2e70fb6bebfa2139008dc72ae5177e66c383fa5426cb0bf2c \
--hash=sha256:9bd4025b9c5b429a48280785a2b71d479798a69f5c2919e7d274c5f4b32c3607 \
--hash=sha256:a7f772696b4cdc0a3b2e527fc3c7ccc41cdcb98f5c80fdd4f2b8c50eb1458196 \
--hash=sha256:c4a88efecec23c37b11076fe676e15c6cdb1271a38f2b415e381e87fe4517f18 \
--hash=sha256:e1ad00662305dcb1e987f5ec214d31f7d6a062cae3e74c1cbccef15afd96611d \
--hash=sha256:ea0d3e950e394c4b332bcdd112aa566010a9f9c95814844a7468325290aabfd9 \
--hash=sha256:eb85ee287b11f901037a6683b2374bb0ec82928c5cbc984f575d0437979c521a \
--hash=sha256:f9d4d88cb6eeb4dfe20f9f0519bd2eaba8119bde87c3d5065c541dbae2b5a2cb
ruff==0.1.12 \
--hash=sha256:1c49e826de55d81a6ef93808b760925e492bad7cc470aaa114a3be158b2c7f99 \
--hash=sha256:25be18abc1fc3f3d3fb55855c41ed5d52063316defde202f413493bb3888218c \
--hash=sha256:46685ef2f106b827705df876d38617741ed4f858bbdbc0817f94476c45ab6669 \
--hash=sha256:472a0548738d4711549c7874b43fab61aacafb1fede29c5232d4cfb8e2d13f69 \
--hash=sha256:47f6d939461e3273f10f4cd059fd0b83c249d73f1736032fffbac83a62939395 \
--hash=sha256:4bdf26e5a2efab4c3aaf6b61648ea47a525dc12775810a85c285dc9ca03e5ac0 \
--hash=sha256:544038693543c11edc56bb94a9875df2dc249e3616f90c15964c720dcccf0745 \
--hash=sha256:718523c3a0b787590511f212d30cc9b194228ef369c8bdd72acd1282cc27c468 \
--hash=sha256:7fe06ba77e5b7b78db1d058478c47176810f69bb5be7c1b0d06876af59198203 \
--hash=sha256:8a0e3ef6299c4eab75a7740730e4b4bd4a36e0bd8102ded01553403cad088fd4 \
--hash=sha256:97189f38c655e573f6bea0d12e9f18aad5539fd08ab50651449450999f45383a \
--hash=sha256:b631c6a95e4b6d5c4299e599067b5a89f5b18e2f2d9a6c22b879b3c4b077c96e \
--hash=sha256:bb29f8e3e6c95024902eaec5a9ce1fd5ac4e77f4594f4554e67fbb0f6d9a2f37 \
--hash=sha256:cf6073749c70b616d7929897b14824ec6713a6c3a8195dfd2ffdcc66594d880c \
--hash=sha256:d41e9f100b50526d80b076fc9c103c729387ff3f10f63606ed1038c30a372a40 \
--hash=sha256:f193f460e231e63af5fc7516897cf5ab257cbda72ae83cf9a654f1c80c3b758a \
--hash=sha256:fbb1c002eeacb60161e51d77b2274c968656599477a1c8c65066953276e8ee2b
# via -r requirements/test.in
six==1.16.0 \
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
Expand Down
44 changes: 22 additions & 22 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ cookiecutter==2.5.0 \
--hash=sha256:8aa2f12ed11bc05628651e9dc4353a10571dd9908aaaaeec959a2b9ea465a5d2 \
--hash=sha256:e61e9034748e3f41b8bd2c11f00d030784b48711c4d5c42363c50989a65331ec
# via -r requirements/common.in
coverage[toml]==7.4.0 \
coverage==7.4.0 \
--hash=sha256:04387a4a6ecb330c1878907ce0dc04078ea72a869263e53c72a1ba5bbdf380ca \
--hash=sha256:0676cd0ba581e514b7f726495ea75aba3eb20899d824636c6f59b0ed2f88c471 \
--hash=sha256:0e8d06778e8fbffccfe96331a3946237f87b1e1d359d7fbe8b06b96c95a5407a \
Expand Down Expand Up @@ -180,9 +180,9 @@ idna==3.6 \
--hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \
--hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
# via requests
jinja2==3.1.2 \
--hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \
--hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61
jinja2==3.1.3 \
--hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \
--hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90
# via cookiecutter
markdown-it-py==3.0.0 \
--hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \
Expand Down Expand Up @@ -401,24 +401,24 @@ rich==13.7.0 \
--hash=sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa \
--hash=sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235
# via cookiecutter
ruff==0.1.11 \
--hash=sha256:09c415716884950080921dd6237767e52e227e397e2008e2bed410117679975b \
--hash=sha256:0f58948c6d212a6b8d41cd59e349751018797ce1727f961c2fa755ad6208ba45 \
--hash=sha256:190a566c8f766c37074d99640cd9ca3da11d8deae2deae7c9505e68a4a30f740 \
--hash=sha256:231d8fb11b2cc7c0366a326a66dafc6ad449d7fcdbc268497ee47e1334f66f77 \
--hash=sha256:4b077ce83f47dd6bea1991af08b140e8b8339f0ba8cb9b7a484c30ebab18a23f \
--hash=sha256:5b25093dad3b055667730a9b491129c42d45e11cdb7043b702e97125bcec48a1 \
--hash=sha256:6464289bd67b2344d2a5d9158d5eb81025258f169e69a46b741b396ffb0cda95 \
--hash=sha256:934832f6ed9b34a7d5feea58972635c2039c7a3b434fe5ba2ce015064cb6e955 \
--hash=sha256:97ce4d752f964ba559c7023a86e5f8e97f026d511e48013987623915431c7ea9 \
--hash=sha256:9b8f397902f92bc2e70fb6bebfa2139008dc72ae5177e66c383fa5426cb0bf2c \
--hash=sha256:9bd4025b9c5b429a48280785a2b71d479798a69f5c2919e7d274c5f4b32c3607 \
--hash=sha256:a7f772696b4cdc0a3b2e527fc3c7ccc41cdcb98f5c80fdd4f2b8c50eb1458196 \
--hash=sha256:c4a88efecec23c37b11076fe676e15c6cdb1271a38f2b415e381e87fe4517f18 \
--hash=sha256:e1ad00662305dcb1e987f5ec214d31f7d6a062cae3e74c1cbccef15afd96611d \
--hash=sha256:ea0d3e950e394c4b332bcdd112aa566010a9f9c95814844a7468325290aabfd9 \
--hash=sha256:eb85ee287b11f901037a6683b2374bb0ec82928c5cbc984f575d0437979c521a \
--hash=sha256:f9d4d88cb6eeb4dfe20f9f0519bd2eaba8119bde87c3d5065c541dbae2b5a2cb
ruff==0.1.12 \
--hash=sha256:1c49e826de55d81a6ef93808b760925e492bad7cc470aaa114a3be158b2c7f99 \
--hash=sha256:25be18abc1fc3f3d3fb55855c41ed5d52063316defde202f413493bb3888218c \
--hash=sha256:46685ef2f106b827705df876d38617741ed4f858bbdbc0817f94476c45ab6669 \
--hash=sha256:472a0548738d4711549c7874b43fab61aacafb1fede29c5232d4cfb8e2d13f69 \
--hash=sha256:47f6d939461e3273f10f4cd059fd0b83c249d73f1736032fffbac83a62939395 \
--hash=sha256:4bdf26e5a2efab4c3aaf6b61648ea47a525dc12775810a85c285dc9ca03e5ac0 \
--hash=sha256:544038693543c11edc56bb94a9875df2dc249e3616f90c15964c720dcccf0745 \
--hash=sha256:718523c3a0b787590511f212d30cc9b194228ef369c8bdd72acd1282cc27c468 \
--hash=sha256:7fe06ba77e5b7b78db1d058478c47176810f69bb5be7c1b0d06876af59198203 \
--hash=sha256:8a0e3ef6299c4eab75a7740730e4b4bd4a36e0bd8102ded01553403cad088fd4 \
--hash=sha256:97189f38c655e573f6bea0d12e9f18aad5539fd08ab50651449450999f45383a \
--hash=sha256:b631c6a95e4b6d5c4299e599067b5a89f5b18e2f2d9a6c22b879b3c4b077c96e \
--hash=sha256:bb29f8e3e6c95024902eaec5a9ce1fd5ac4e77f4594f4554e67fbb0f6d9a2f37 \
--hash=sha256:cf6073749c70b616d7929897b14824ec6713a6c3a8195dfd2ffdcc66594d880c \
--hash=sha256:d41e9f100b50526d80b076fc9c103c729387ff3f10f63606ed1038c30a372a40 \
--hash=sha256:f193f460e231e63af5fc7516897cf5ab257cbda72ae83cf9a654f1c80c3b758a \
--hash=sha256:fbb1c002eeacb60161e51d77b2274c968656599477a1c8c65066953276e8ee2b
# via -r requirements/test.in
six==1.16.0 \
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
Expand Down

0 comments on commit b3445c4

Please sign in to comment.