Skip to content
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
1 change: 1 addition & 0 deletions data/empty_package/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys

from setuptools import setup

increment = int(sys.argv.pop())
Expand Down
15 changes: 10 additions & 5 deletions stub_uploader/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@
import subprocess
import tempfile
from textwrap import dedent
from typing import Dict, List, Optional
from typing import Optional

from stub_uploader.const import *
from stub_uploader.const import (
CHANGELOG_PATH,
META,
TESTS_NAMESPACE,
THIRD_PARTY_NAMESPACE,
)
from stub_uploader.metadata import Metadata, read_metadata

CHANGELOG = "CHANGELOG.md"
Expand Down Expand Up @@ -99,7 +104,7 @@ def __init__(self, typeshed_dir: str, distribution: str) -> None:
self.stub_dir = os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE, distribution)


def find_stub_files(top: str) -> List[str]:
def find_stub_files(top: str) -> list[str]:
"""Find all stub files for a given package, relative to package root.

Raise if we find any unknown file extensions during collection.
Expand Down Expand Up @@ -169,7 +174,7 @@ def copy_changelog(distribution: str, dst: str) -> None:
pass # Ignore missing changelogs


def collect_setup_entries(base_dir: str) -> Dict[str, List[str]]:
def collect_setup_entries(base_dir: str) -> dict[str, list[str]]:
"""Generate package data for a setuptools.setup() call.

This reflects the transformations done during copying in copy_stubs().
Expand Down Expand Up @@ -263,7 +268,7 @@ def main(
commit = subprocess.run(
["git", "rev-parse", "HEAD"],
capture_output=True,
universal_newlines=True,
text=True,
cwd=typeshed_dir,
).stdout.strip()
metadata = read_metadata(typeshed_dir, distribution)
Expand Down
6 changes: 2 additions & 4 deletions stub_uploader/get_changed.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
import os
import subprocess

from typing import List


def main(typeshed_dir: str, commit: str) -> List[str]:
def main(typeshed_dir: str, commit: str) -> list[str]:
"""List all distributions that changed since commit."""
assert typeshed_dir.endswith(os.sep + "typeshed")
git = subprocess.run(
["git", "diff", "--no-renames", "--name-only", "HEAD", commit],
capture_output=True,
universal_newlines=True,
text=True,
cwd=typeshed_dir,
check=True,
)
Expand Down
4 changes: 2 additions & 2 deletions stub_uploader/get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

from __future__ import annotations

from typing import Any, Union
from typing import Any

import requests
from packaging.specifiers import SpecifierSet
from packaging.version import Version
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

from stub_uploader.const import *
from stub_uploader.const import TYPES_PREFIX
from stub_uploader.metadata import Metadata

URL_TEMPLATE = "https://pypi.org/pypi/{}/json"
Expand Down
5 changes: 3 additions & 2 deletions stub_uploader/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import graphlib
import os
import re
from typing import Any, Dict, Iterator, Optional
from typing import Any, Optional
from collections.abc import Iterator

import requests
import tomli
Expand All @@ -18,7 +19,7 @@ class InvalidRequires(Exception):


class Metadata:
def __init__(self, distribution: str, data: Dict[str, Any]):
def __init__(self, distribution: str, data: dict[str, Any]):
assert not distribution.startswith(TYPES_PREFIX)
self._alleged_upstream_distribution = distribution
self.data = data
Expand Down
2 changes: 0 additions & 2 deletions stub_uploader/update_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import os
import re
import subprocess
from dataclasses import dataclass
from pathlib import Path

from stub_uploader.const import CHANGELOG_PATH


THIRD_PARTY_NAMESPACE = "stubs"


Expand Down
2 changes: 1 addition & 1 deletion tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ def test_uploaded_packages() -> None:
up.add("six")
assert up.read() == {"types-sqlalchemy", "types-six"}

with open(file_path, "r") as f:
with open(file_path) as f:
assert f.read() == "types-SqLaLcHeMy\ntypes-six"