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

Time to rethink `prefered constraint sequence`?

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

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
tooling

Línea de trabajo

Comienza rastreando la implementación de VersionRange que ordena las restricciones y luego revisa el issue #118 para comprobar el fallo relacionado. Conserva las relaciones explícitas AND y OR en la expresión almacenada y verifica que el ejemplo de prerelease distinga el rango de prerelease 1.2.3 permitido de los prereleases no permitidos sobre bases posteriores.

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

Descripción

Our current implementation of VersionRange assumes that information regarding the logical operation (AND/OR) can be inferred by the order in which the constraints are arranged (currently, we arrange them in ascending order).

This works fine for simple version ranges, like the npm range expression >=5.1.0 || >=3.10 <4.0, which is converted to vers:npm/>=3.10|<4.0|>=5.1.0. When testing whether a given version, say 3.12.0, belongs to our range expression, we perform pairwise lookups, i.e., we test if our version belongs to either of the two pairs (>=3.10 and <4.0), (>=5.1.0).

However, this assumption fails for more complex range expressions, such as the npm range expression >=1.2.3-alpha <1.2.4 || >=1.2.3 <2.0.0, which essentially translates to any version between 1.2.3 and 2.0.0 including prerelease for base 1.2.3 but should not include prerelease for other bases (e.g., 1.3.0-alpha.1 is not allowed).
Now, univers VersionRange stores this range as vers:npm/>=1.2.3-alpha|>=1.2.3|<1.2.4|<2.0.0, and performing pairwise operations on this will yield incorrect results.

A better approach would be to explicitly preserve the information regarding logical operations.

  • Use , to denote the AND operation.
  • Use | to denote the OR operation.

This will also make the version expression human-readable and simplify the logic for testing whether a version is present in the version range or not.

In this new design, we will store >=1.2.3-alpha <1.2.4 || >=1.2.3 <2.0.0 as vers:npm/>=1.2.3-alpha,<1.2.4|>=1.2.3,<2.0.0.

This is also the root cause of https://github.com/nexB/univers/issues/118

Lenguaje dominante
Python
Estrellas
50
Forks
31
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 aboutcode-org/univers

Todos los issues de aboutcode-org/univers

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.