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.0.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.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hatch_pre_index-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 3fbbc740763a7b87b07e1610907364f8db51cdb03530d588b6519c190ea77048
MD5 c73a1d53f14c4e98d8545f5df2acbc50
BLAKE2b-256 efff60a2f1a069c4ce9a95334ac09595577b2655b3ac25745f57c058619b81b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hatch_pre_index-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7dc282c9827c743a707916d4107b562551a77b685d74ee2c67efee3388e1bada
MD5 7bacdcb4ff72cad325dc7da57677965c
BLAKE2b-256 a5303c5ab1818e449aaaa2f5c68f029b21f09b5290147c0cc67a8f640a3fb41f

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