Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PEP691 Format support #1154

Merged
merged 1 commit into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 6.0.0

## New Features

- Add PEP691 simple index support `PR #1154`

# 5.3.0 (2022-07-29)

## New Features
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project_urls =
Source Code = https://github.com/pypa/bandersnatch
Change Log = https://github.com/pypa/bandersnatch/blob/master/CHANGES.md
url = https://github.com/pypa/bandersnatch/
version = 5.3.0
version = 6.0.0.dev0

[options]
install_requires =
Expand Down
6 changes: 3 additions & 3 deletions src/bandersnatch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def version_str(self) -> str:


__version_info__ = _VersionInfo(
major=5,
minor=3,
major=6,
minor=0,
micro=0,
releaselevel="",
releaselevel="dev0",
serial=0, # Not currently in use with Bandersnatch versioning
)
__version__ = __version_info__.version_str
11 changes: 10 additions & 1 deletion src/bandersnatch/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from pathlib import Path
from typing import Any, Dict, List, NamedTuple, Optional, Type

from .simple import SimpleFormat, get_format_value

logger = logging.getLogger("bandersnatch")


Expand All @@ -22,6 +24,7 @@ class SetConfigValues(NamedTuple):
compare_method: str
download_mirror: str
download_mirror_no_fallback: bool
simple_format: SimpleFormat


class Singleton(type): # pragma: no cover
Expand Down Expand Up @@ -75,7 +78,6 @@ def load_configuration(self) -> None:
self.config.read(config_file)


# 11-15, 84-89, 98-99, 117-118, 124-126, 144-149
def validate_config_values( # noqa: C901
config: configparser.ConfigParser,
) -> SetConfigValues:
Expand Down Expand Up @@ -205,6 +207,12 @@ def validate_config_values( # noqa: C901
+ "is not set in config."
)

try:
simple_format = get_format_value(config.get("mirror", "simple-format"))
except configparser.NoOptionError:
logger.debug("Storing all Simple Formats by default ...")
simple_format = SimpleFormat.ALL

return SetConfigValues(
json_save,
root_uri,
Expand All @@ -217,4 +225,5 @@ def validate_config_values( # noqa: C901
compare_method,
download_mirror,
download_mirror_no_fallback,
simple_format,
)
4 changes: 4 additions & 0 deletions src/bandersnatch/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ workers = 3
; Recommended setting: the default of false for full pip/pypi compatibility.
hash-index = false

; Format for simple API to be stored in
; Since PEP691 we have HTML and JSON
simple-format = ALL

; Whether to stop a sync quickly after an error is found or whether to continue
; syncing but not marking the sync as successful. Value should be "true" or
; "false".
Expand Down
Loading