<commit_before>#lang racket/base

(provide make-planet-require-spec
         syntax-source-planet-package
         syntax-source-planet-package-owner
         syntax-source-planet-package-name
         syntax-source-planet-package-major
         syntax-source-planet-package-minor
         syntax-source-planet-package-symbol)

(require racket/match
         planet/util
         racket/syntax
         unstable/syntax
         (for-template racket/base)
         (for-label racket/base))

(define (syntax-source-planet-package stx)
  (let* ([dir (syntax-source-directory stx)])
    (and dir (path->package-version dir))))

(define (syntax-source-planet-package-owner stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) owner]
    [_ #f]))

(define (syntax-source-planet-package-name stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) name]
    [_ #f]))

(define (syntax-source-planet-package-major stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) major]
    [_ #f]))

(define (syntax-source-planet-package-minor stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) minor]
    [_ #f]))

(define (syntax-source-planet-package-symbol stx [suffix #f])
  (match (syntax-source-planet-package stx)
    [(list owner name major minor)
     (string->symbol
      (format "~a/~a:~a:~a~a"
              owner
              (regexp-replace "\\.plt$" name "")
              major
              minor
              (if suffix (format-symbol "/~a" suffix) "")))]
    [#f #f]))

(define (make-planet-require-spec stx [id/f #f])
  (datum->syntax
   stx
   (list #'planet (syntax-source-planet-package-symbol stx id/f))
   (or id/f stx)))
<commit_msg>Made constructed planet links force the minor version for more reliable self-reference.<commit_after>#lang racket/base

(provide make-planet-require-spec
         syntax-source-planet-package
         syntax-source-planet-package-owner
         syntax-source-planet-package-name
         syntax-source-planet-package-major
         syntax-source-planet-package-minor
         syntax-source-planet-package-symbol)

(require racket/match
         planet/util
         racket/syntax
         unstable/syntax
         (for-template racket/base)
         (for-label racket/base))

(define (syntax-source-planet-package stx)
  (let* ([dir (syntax-source-directory stx)])
    (and dir (path->package-version dir))))

(define (syntax-source-planet-package-owner stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) owner]
    [_ #f]))

(define (syntax-source-planet-package-name stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) name]
    [_ #f]))

(define (syntax-source-planet-package-major stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) major]
    [_ #f]))

(define (syntax-source-planet-package-minor stx)
  (match (syntax-source-planet-package stx)
    [(list owner name major minor) minor]
    [_ #f]))

(define (syntax-source-planet-package-symbol stx [suffix #f])
  (match (syntax-source-planet-package stx)
    [(list owner name major minor)
     (string->symbol
      (format "~a/~a:~a:=~a~a"
              owner
              (regexp-replace "\\.plt$" name "")
              major
              minor
              (if suffix (format-symbol "/~a" suffix) "")))]
    [#f #f]))

(define (make-planet-require-spec stx [id/f #f])
  (datum->syntax
   stx
   (list #'planet (syntax-source-planet-package-symbol stx id/f))
   (or id/f stx)))

{'fraction_non_alphanumeric': 0.14119278779472955, 'fraction_numerical': 0.0, 'mean_word_length': 2.672097759674134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '892758', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1169, 'n_words': 263}