Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Support local version identifiers

Đang mở
#57 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
release

Hướng nghiên cứu

Start with PEP 440 local version identifiers and incremental's Version implementation, especially public() and short(). Compare the proposed local argument with the existing version behavior; done means a value such as local='lp1' produces 20.3.0+lp1 for distribution files without a subclass or downstream workaround.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

PEP 440 defines local version identifiers which can be used when applying local patches to upstream projects. For example, in Launchpad we occasionally have to backport fixes from later releases that we can't upgrade to wholesale yet, or apply patches that haven't been integrated yet upstream; we do this by making distributions with local version identifiers that we commit to a git repository containing our dependencies.

This works fine with most Python projects, but it's awkward for ones that use incremental because incremental doesn't directly support local version identifiers: there's a Version.local, but it's just equal to Version.public. Let's say we're making a fork of Twisted 20.3.0, which has:

__version__ = Version('Twisted', 20, 3, 0)

Ideally we'd just be able to change that to something like:

__version__ = Version('Twisted', 20, 3, 0, local='lp1')

... and have that generate 20.3.0+lp1. However, since incremental doesn't support local version identifiers and since Twisted uses __version__.short(), I guess we end up doing something like this (obviously incomplete, but just for the purpose of getting distribution files with the right version number in them):

class LocalVersion(Version):
    def __init__(self, *args, **kwargs):
        self._local = kwargs.pop('local')
        super(LocalVersion, self).__init__(*args, **kwargs)

    def public(self):
        public = super(LocalVersion, self).public()
        if self._local:
            public += '+%s' % self._local
        return public

__version__ = LocalVersion('Twisted', 20, 3, 0, local='lp1')

Or alternatively I suppose that we could make src/twisted/__init__.py say:

__version__ = version.short() + '+lp1'

Either way, this seems like a lot of awkwardness just to make a temporary local backport distribution! I think incremental could usefully help to make this easier.

Ngôn ngữ chính
Python
Star
144
Fork
21
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của twisted/incremental

Tất cả issue của twisted/incremental

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.