Skip to content

Commit 89c9e90

Browse files
authored
feat: add .tool-versions and prompt for poetry_version (#37)
1 parent a9d4a00 commit 89c9e90

File tree

7 files changed

+54
-2
lines changed

7 files changed

+54
-2
lines changed

cookiecutter.json

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"project_name_underscored": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}",
1717
"github_username": "elixir-cloud-aai",
1818
"python_version": "3.13.0",
19+
"poetry_version": "1.8.5",
1920
"add_script": "y",
2021
"year": "{% now 'utc', '%Y' %}",
2122
"add_pypi_release_ci": "y",
@@ -29,6 +30,7 @@
2930
"project_name_dashed": "Distribution name <lowercase, hyphens, no spaces> (used on PyPI)",
3031
"github_username": "GitHub account name (used in repo URL and package metadata)",
3132
"python_version": "Minimum Python version <X.Y.Z format> (used in dependency specification)",
33+
"poetry_version": "Poetry version <X.Y.Z format>",
3234
"add_script": "CLI tool inclusion flag <y/n> (used in build configuration)",
3335
"add_pypi_release_ci": "PyPI publishing automation flag <y/n>"
3436
}

{{ cookiecutter.project_name_dashed }}/.devcontainer/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master
4242
&& git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM}/plugins/zsh-autosuggestions \
4343
&& git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM}/plugins/fast-syntax-highlighting
4444

45+
# Clone asdf scripts
46+
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf
47+
4548
# Install direnv
4649
RUN curl -sfL https://direnv.net/install.sh | bash
4750

{{ cookiecutter.project_name_dashed }}/.devcontainer/override.zshrc

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export ZSH="/root/.oh-my-zsh"
33

44
# Plugins
55
plugins=(
6+
asdf # Sets up asdf version manager
67
direnv # Loads .envrc files
78
git # Adds git command aliases and useful prompt info
89
docker # Provides docker command completion and aliases

{{ cookiecutter.project_name_dashed }}/.github/actions/setup/poetry/action.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
default: '{{ cookiecutter.python_version }}'
1111
description: The version of Python to use
1212
poetry-version:
13-
default: '1.8.2'
13+
default: '{{ cookiecutter.poetry_version }}'
1414
description: The version of Poetry to install
1515
poetry-install-options:
1616
default: ''
@@ -19,7 +19,7 @@ inputs:
1919
default: ''
2020
description: Options to pass to poetry export for hash generation for cache
2121
invalidation
22-
22+
{% raw %}
2323
runs:
2424
using: composite
2525
steps:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
poetry {{ cookiecutter.poetry_version }}
2+
python {{ cookiecutter.python_version }}

{{ cookiecutter.project_name_dashed }}/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ help:
2424
@echo " \033[1m\033[35mdocs\033[0m \033[37m(d)\033[0m: \033[36mGenerate project documentation.\033[0m\n"
2525

2626
@echo "Environment Management --------------------------------------------------------"
27+
@echo " \033[1m\033[35masdf-install\033[0m \033[37m(asdfi)\033[0m: \033[36mTry to install tools listed in .tool-versions.\033[0m"
2728
@echo " \033[1m\033[35mclean-venv\033[0m \033[37m(cv)\033[0m: \033[36mRemove virtual environment.\033[0m"
2829
@echo " \033[1m\033[35minstall\033[0m \033[37m(i)\033[0m: \033[36mInstall app and dependencies.\033[0m"
2930
@echo " \033[1m\033[35mvenv\033[0m \033[37m(v)\033[0m: \033[36mCreate virtual environment.\033[0m\n"
@@ -39,6 +40,14 @@ help:
3940
# NOTE: Do not modify the autogenerated targets, unless necessary, write custom
4041
# targets in the custom section below..
4142

43+
.PHONY: asdf-install asdfi
44+
asdf-install:
45+
@echo "\nInstalling ASDF Plugins & Tools +++++++++++++++++++++++++++++++++++++++++++++++\n"
46+
@cat .tool-versions | cut -d' ' -f1 | grep "^[^\#]" | xargs -I {} asdf plugin add {}
47+
@asdf install
48+
49+
asdfi: asdf-install
50+
4251
.PHONY: clean-venv cv
4352
clean-venv:
4453
@echo "\nRemoving the virtual environment ++++++++++++++++++++++++++++++++++++++++++++++\n"

{{ cookiecutter.project_name_dashed }}/README.md

+35
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [Development](#development)
2020
- [Makefile](#makefile)
2121
- [Environment reproducibility](#environment-reproducibility)
22+
- [asdf](#asdf)
2223
- [Dev containers](#dev-containers)
2324
- [Editor config](#editor-config)
2425
- [Setting environment variables (direnv)](#setting-environment-variables-direnv)
@@ -128,6 +129,38 @@ make u
128129
129130
### Environment reproducibility
130131
132+
Below mentioned are some tools and configuration that you can use to make your
133+
environment development-ready. This is optional and opinionated but can help you
134+
set up your environment quickly.
135+
136+
#### asdf
137+
138+
We recommend using [asdf][asdf] to manage your development environment
139+
efficiently. This tool allows you to handle multiple language versions and tools
140+
seamlessly. You can install asdf by following the
141+
[official installation guide][asdf-install]. If you are working within
142+
[dev containers](#dev-containers), asdf will come pre-installed.
143+
144+
The project includes a `.tool-versions` file, which lists the specific versions
145+
of tools used. This ensures consistency across environments. To streamline the
146+
installation process, use the following command to install the required tools
147+
defined in the `.tool-versions` file:
148+
149+
```sh
150+
make asdfi
151+
```
152+
153+
> **Note:** The `make asdfi` command might not install every tool listed in
154+
> the `.tool-versions` file. After running the command, verify that all
155+
> necessary tools are installed. If any tools are missing, install them
156+
> manually using asdf.
157+
158+
Example manual installation command:
159+
160+
```sh
161+
asdf install <tool-name> <version>
162+
```
163+
131164
#### Dev Containers
132165
133166
Our project supports [Dev Containers][devcontainers] for an easy and reproducible
@@ -237,6 +270,8 @@ To get in touch with us, please use one of the following routes:
237270
238271
[![logo-elixir]][elixir] [![logo-elixir-cloud-aai]][elixir-cloud-aai]
239272
273+
[asdf]: https://asdf-vm.com/
274+
[asdf-install]: https://asdf-vm.com/guide/getting-started.html
240275
[badge-chat-url]: https://join.slack.com/t/elixir-cloud/shared_invite/enQtNzA3NTQ5Mzg2NjQ3LTZjZGI1OGQ5ZTRiOTRkY2ExMGUxNmQyODAxMDdjM2EyZDQ1YWM0ZGFjOTJhNzg5NjE0YmJiZTZhZDVhOWE4MWM
241276
[badge-license-url]: http://www.apache.org/licenses/LICENSE-2.0
242277
[code-of-conduct]: https://elixir-cloud-aai.github.io/about/code-of-conduct/

0 commit comments

Comments
 (0)