radix-ai / poetry-cookiecutter Goto Github PK
View Code? Open in Web Editor NEWπͺ Poetry Cookiecutter is a modern Cookiecutter template for scaffolding Python packages and apps
License: GNU Affero General Public License v3.0
πͺ Poetry Cookiecutter is a modern Cookiecutter template for scaffolding Python packages and apps
License: GNU Affero General Public License v3.0
With:
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=1000
Considerations:
origin/main
(the default), which needs to be configured in pyproject.toml
. What happens is that branch doesn't exist? Is there a way we can figure this out from Cookiecutter?When working on several poetry cookie cutter projects (and/or with other apps that use port 8000), the devcontainer won't work because the port 8000 is already used by those other projects/apps.
Simply manually setting a different port in the docker-compose.yml
and pyproject.toml
for each of the projects does the trick.
But it would be nice to have something like what jupyter notebook and lab do. I.e. trying their default port number, and using another one if the first one is already used, and another one if the second one is already in use, etc.
WDYT?
To verify that the poetry.lock
is in sync with pyproject.toml
. See python-poetry/poetry#1954.
It appears the secrets:
in the dockercompose file in the app:build and dev:build is overindented
Replace the Dev Container CLI with the Dev Container GitHub Action once devcontainers/ci#148 is resolved to benefit from image caching.
target-version
will be treated as the minimum version in the future: psf/black#751 (comment)
Including Conventional Commit linting.
post_gen_project.sh
.post_gen_project
as well %
is not a supported filepath character on WindowsFor portability, you should use Python scripts (with extension .py) for your hooks, as these can be run on any platform.
[1] https://cookiecutter.readthedocs.io/en/latest/advanced/hooks.html#using-pre-post-generate-hooks
pyupgrade
settingsWhen scaffolding a newly created GitLab repo via the command "cruft create -f [email protected]:radix-ai/poetry-cookiecutter.git", it fails with the following error (full error stack below):
FileNotFoundError: [Errno 2] No such file or directory: '<local_path>/{{ cookiecutter.package_name|slugify }}/tests/test_sentry.py'
(base) β VLAIO_HSCO cruft create -f [email protected]:radix-ai/poetry-cookiecutter.git
package_name [My Package]: HSCO
package_description [A Python package that ...]:
package_url [https://github.com/user/my-package]:
author_name [John Smith]:
author_email [[email protected]]:
python_version [3.8]:
with_fastapi_api [0]:
with_jupyter_lab [0]:
with_pydantic_typing [0]:
with_sentry_logging [0]:
with_streamlit_app [0]:
with_typer_cli [0]:
Select continuous_integration:
1 - GitHub
2 - GitLab
Choose from 1, 2 [1]: 2
Select docstring_style:
1 - NumPy
2 - Google
Choose from 1, 2 [1]:
private_package_repository_name []:
private_package_repository_url []:
Traceback (most recent call last):
File "/usr/local/bin/cruft", line 8, in
sys.exit(app())
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/typer/main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/typer/main.py", line 500, in wrapper
return callback(**use_params) # type: ignore
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/cruft/_cli.py", line 107, in create
_commands.create(
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/cruft/_commands/utils/init.py", line 14, in wrapper
return f(*args, **kwargs)
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/cruft/_commands/create.py", line 46, in create
generate_files(
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/cookiecutter/generate.py", line 352, in generate_files
generate_file(
File "/usr/local/Cellar/cruft/2.10.2/libexec/lib/python3.10/site-packages/cookiecutter/generate.py", line 179, in generate_file
with io.open(outfile, 'w', encoding='utf-8') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/{{ cookiecutter.package_name|slugify }}/tests/test_sentry.py'
Should be removed.
If one image extends another, the volumes get extended as well. Hence, there's a redundant .:/app/
mount in dev
found in the docker-compose.yml
.
Problem: when the Dev Container starts, all services in docker-compose.yml
are started, while not all of them are necessary (e.g. the app
service).
Solution: add a profile to avoid this. Services with a profile won't automatically be started by docker compose up
.
Relevant VS Code issue: microsoft/vscode-remote-release#6188
Workflow:
CC @RubenPants
For the Darts demo, Tanguy added code to Terraform the app through the Gitlab CI/CD.
Would it be valuable to have an Azure App Service Terraform setup included in Cookiecutter (maybe as an optional choice when initializing a new project)? I see a lot of value in having an automated way to deploy e.g. Streamlit apps to App Service, but maybe itβs too much, wdyt?
When inside a dev-container, it is not possible to push/pull/communicate with Gitlab until the command "ssh-add ~/.ssh/<your_key>" (e.g. ssh-add ~/.ssh/id_rsa) is performed: we get "Permission denied" without the possibility to enter a passphrase. For example:
β¬’ [Docker] β― ssh -T [email protected]
[email protected]: Permission denied (publickey,keyboard-interactive).
Outside the dev container, even without doing the command "ssh-add ~/.ssh/<your_key>", it is possible to interact with Gitlab but the passphrase is required every time. For example:
(base) raphaelpeschi@Raphaels-MBP or-tools-test % ssh -T [email protected]
Enter passphrase for key '/Users/raphaelpeschi/.ssh/id_rsa':
Welcome to GitLab, @Raphael85!
root in app on ξ main [!] is π¦ v0.0.0 via π v3.8.12
β¬’ [Docker] β― ssh -T [email protected]
[email protected]: Permission denied (publickey,keyboard-interactive).
Method 1) Push/pull from outside the container (e.g. open a new terminal outside VSCode)
Method 2) After each laptop reboot, perform the command "ssh-add ~/.ssh/<your_key>" outside the dev container. This will allow to interact with Gitlab without entering the passphrase, both outside and within dev containers.
Problem: rebuilding the Dev Container means you lose your shell history right now.
https://github.com/charliermarsh/ruff
Checklist (last updated 2022-11-18):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.