Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

project-create generates an invalid class name when the project name starts with a digit

Abierto
#673 0 comentarios 0 reacciones 0 asignados Ver en GitHub

@Amadeus-22 ya está trabajando en esto.

Desde el 6/10/2026.

  • #674 de @Amadeus-22 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
40/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
cli

Línea de trabajo

Find the code handling the project-create command in the lean-cli codebase, likely in a commands or templates directory. Look for the function that generates class names by removing non-alphanumeric characters from the project name. Add a check to prefix the result with an underscore when it starts with a digit or is empty, then add tests for project names like '2024 Momentum' and '123'.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Expected Behavior

lean project-create writes a main file that compiles, whatever the project name is.

Actual Behavior

The class name is the project name with non-alphanumeric characters removed. If the name starts with a digit, the generated class is not a valid identifier in Python or C#:

$ lean project-create --language python "2024 Momentum"
$ grep class "2024 Momentum/main.py"
class 2024Momentum(QCAlgorithm):

python -m py_compile on that file fails with SyntaxError: invalid decimal literal. A name with only digits (123) gives class 123(QCAlgorithm):. The command exits with code 0 in both cases, so the problem only shows up when the project is run.

Potential Solution

Prefix the class name with an underscore when it is empty or starts with a digit (_2024Momentum). I can open a PR with the fix and tests.

Reproducing the Problem

See the commands above.

System Information

lean-cli master at 20e58aa, Linux.

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
Lenguaje dominante
Python
Estrellas
327
Forks
170
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de QuantConnect/lean-cli

Todos los issues de QuantConnect/lean-cli

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.