Skip to main content

A publisher for hatch to check the project version and to run scripts before it invokes the index publisher.

Project description

hatch-pre-index

PyPI - Version PyPI - Python Version

This package provides the PreIndexPublisher for hatch.

Its purpose is to perform the following tasks before calling the index publisher (hatch default publisher):

  • Ask for an API token to use for publishing to PyPI.
    It provides the option to store the API token to be reused each time the project is published to the PyPI repository.
  • Track the project version published.
    It checks whether the current version has not been published or otherwise reminds you to run hatch build with a new version number.
  • [ToDo: Run scripts]

Use with 'hatch publish -p pre_index' with options in the command line or the pyproject.toml file (see below for details()).


Enjoy

 krokoreit
   

Installation

pip install hatch-pre-index

Usage

Using the pre_index publisher

Call hatch publish with the -p option:

  hatch publish -p pre_index

Use with options

To use the options of the pre_index publisher, you can

  • either use one or more -o flags with hatch publish
    'hatch publish -p pre_index -o key1=value1 -o key2=value2'
    
  • or use an entry in the pyproject.toml file, with string "values" inside quotes
    [tool.hatch.publish.pre_index]  
    key1="value1"  
    key2=value2  
    

The pw option

The pre_index publisher will ask whether you like to store an API token and then reuse it for the given context of 'project name' and 'repository', e.g. 'myproject' and 'main'. However, if you need to provide a new API token, you can apply the pw=new option to get prompted for entering a new API token.


The repo option

Provide the repo option to specify a repository (other than 'main') to which the project will be published.
The repo option will be passed on to the index publisher (see https://hatch.pypa.io/dev/plugins/publisher/package-index/).
It may be useful to publish to the PyPI test repository.


License

MIT license
Copyright © 2025 by krokoreit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hatch_pre_index-1.0.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hatch_pre_index-1.0.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file hatch_pre_index-1.0.1.tar.gz.

File metadata

  • Download URL: hatch_pre_index-1.0.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.13.2 HTTPX/0.28.1

File hashes

Hashes for hatch_pre_index-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d921a81dbf4960948ff28e4f3d3c539a8f4d63d0e541cb3b1477d5182aa89616
MD5 2d6c79a952bce6b9b7eb1b694525a9d3
BLAKE2b-256 7a5b7cc946abd1b5eb1a8e735e2d4b8164bbcec5600fd68a3e5102b5463418cc

See more details on using hashes here.

File details

Details for the file hatch_pre_index-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hatch_pre_index-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.13.2 HTTPX/0.28.1

File hashes

Hashes for hatch_pre_index-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56a1d8f1a75273b5c8e02249864e3595e82bebdef8d1818bfae2219fe5f87603
MD5 35134bb0bbb4cf3560887ad31095fbbc
BLAKE2b-256 bbbea2d4d771795706596794c2ff5ef2b764da3a1ba088b52cc3f73dad7f0ee1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page