Giter Site home page Giter Site logo

radix-ai / poetry-cookiecutter Goto Github PK

View Code? Open in Web Editor NEW
219.0 219.0 32.0 242 KB

πŸͺ Poetry Cookiecutter is a modern Cookiecutter template for scaffolding Python packages and apps

License: GNU Affero General Public License v3.0

Dockerfile 60.13% Python 39.87%
cookiecutter cookiecutter-poetry cookiecutter-python cookiecutter-template devcontainer docker poetry python scaffolding template

poetry-cookiecutter's People

Contributors

jwuzyk avatar lsorber avatar mattdl-radix avatar pgerardi avatar rubenpants avatar sinopeus avatar tanguynaets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

poetry-cookiecutter's Issues

Evaluate adding diff-cover to automatically require added/changed lines to be covered

Considerations:

  1. Is requiring 100% coverage on added/changed lines too strict? Maybe we should go for 50% by default and leave it up to the user to set it higher if they wish.
  2. The tool works by comparing against a remote branch like 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?

https://github.com/Bachmann1234/diff_cover

Automatically change port mapping if PORT 8000 is already used

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?

Handle conditional files in `post_gen_project.py`

  1. We currently only handle conditional directories in post_gen_project.sh.
  2. We should handle conditional files in post_gen_project as well because % is not a supported filepath character on Windows.
  3. We should not assume that bash is available [1]:

For 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

Unable to scaffold repo with default arguments

Short description:

When 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'

Steps to reproduce:

  • Create a new GitLab repo
  • Clone it locally
  • Scaffold it via the cruft create -f [email protected]:radix-ai/poetry-cookiecutter.git => you get the error.

Full logs / error message:

(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'

Remove redundant volume mounts

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.

Adding Terraform to Azure App Service setup

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?

Gitlab SSH key: permission denied from within dev container

Description

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!

Reproduction

  • Given a SSH key for Gitlab that requires a passphrase
  • Reboot your laptop
  • Using VSCode, open a project using poetry-cookiecutter (it will automatically be inside the dev container)
  • Perform the command "ssh -T [email protected]": the following results is obtained:

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).

Workarounds

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.

Evaluate replacing `flake8` with `ruff`

https://github.com/charliermarsh/ruff

Checklist (last updated 2022-11-18):

  • βœ… bandit
  • ❌ darglint
  • 🦺 flake8 (missing Python 3.9 and 3.10 language features)
  • 🦺 flake8-bugbear (25/32)
  • βœ… flake8-comprehensions
  • ❌ flake8-mutable
  • βœ… flake8-print
  • βœ… Flake8-pyproject
  • ❌ flake8-pytest-style
  • ❌ flake8-rst-docstrings
  • 🦺 flake8-tidy-imports (1/3)
  • βœ… pep8-naming
  • βœ… pydocstyle
  • 🦺 pyupgrade (13/33)
  • βœ… yesqa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.