Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Time to rethink `prefered constraint sequence`?

Aperta
#119 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Inizia tracciando l’implementazione di VersionRange che ordina i vincoli, quindi esamina l’issue #118 per il problema correlato. Mantieni le relazioni esplicite AND e OR nell’espressione memorizzata e verifica che l’esempio di prerelease distingua l’intervallo di prerelease 1.2.3 consentito dai prerelease non consentiti su basi successive.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Python
Stelle
50
Fork
31
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aboutcode-org/univers

Tutte le issue di aboutcode-org/univers

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.