Repository: johtso/httpx-caching (language: python)

Issue:
Release to pypi ?
Hi -- do you plan on releasing this package to pypi ?


Discussion / hints:
Yeah. This would be really useful.

Fix patch:
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..86c8a70
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,29 @@
+name: Publish
+
+on:
+  push:
+    tags:
+      - '*'
+
+jobs:
+  publish:
+    name: "Publish release"
+    runs-on: "ubuntu-latest"
+
+    environment:
+       name: deploy
+
+    steps:
+      - uses: "actions/checkout@v2"
+      - uses: "actions/setup-python@v2"
+        with:
+          python-version: 3.9
+      - name: "Install dependencies"
+        run: "scripts/install"
+      - name: "Build packag"
+        run: "scripts/build"
+      - name: "Publish to PyPI"
+        run: "scripts/publish"
+        env:
+          TWINE_USERNAME: __token__
+          TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..93c1289
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,9 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+
+## 0.1a1 (18th February, 2022)
+
+First PyPI release.
diff --git a/dev_requirements.txt b/dev_requirements.txt
deleted file mode 100644
index 38372f8..0000000
--- a/dev_requirements.txt
+++ /dev/null
@@ -1,21 +0,0 @@
--r requirements.txt
-
-pytest
-pytest-cov
-pytest-asyncio
-pytest-mock
-pytest-timeout
-mock
-types-mock
-cherrypy
-freezegun
-types-freezegun
-autoflake
-black
-isort
-autoflake
-flake8
-flake8-bugbear
-mypy
-unasync
-types-dataclasses
diff --git a/httpx_caching/__version__.py b/httpx_caching/__version__.py
new file mode 100644
index 0000000..d9f9c59
--- /dev/null
+++ b/httpx_caching/__version__.py
@@ -0,0 +1,3 @@
+__title__ = "httpx-caching"
+__description__ = "Caching for HTTPX."
+__version__ = "0.1a1"
diff --git a/httpx_caching/py.typed b/httpx_caching/py.typed
new file mode 100644
index 0000000..e69de29
diff --git a/requirements.txt b/requirements.txt
index 6665b6d..37a5e3f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,25 @@
-httpx==0.22.*
-msgpack
-anyio
-multimethod
+# Packaging
+twine==3.7.1
+wheel==0.37.0
+
+# Testing
+autoflake==1.4
+black==22.1.0
+CherryPy==18.6.1
+coverage==6.3.2
+flake8==4.0.1
+flake8-bugbear==22.1.11
+freezegun==1.2.0
+isort==5.10.1
+mock==4.0.3
+mypy==0.941
+pyparsing==3.0.7
+pytest==7.1.0
+pytest-asyncio==0.18.2
+pytest-cov==3.0.0
+pytest-mock==3.7.0
+pytest-timeout==2.1.0
+types-dataclasses==0.6.4
+types-freezegun==1.1.7
+types-mock==4.0.11
+unasync==0.5.0
diff --git a/scripts/build b/scripts/build
new file mode 100755
index 0000000..355820b
--- /dev/null
+++ b/scripts/build
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+
+if [ -d 'venv' ] ; then
+    PREFIX="venv/bin/"
+else
+    PREFIX=""
+fi
+
+set -x
+
+${PREFIX}python setup.py sdist bdist_wheel
+${PREFIX}twine check dist/*
diff --git a/scripts/install b/scripts/install
index 6fb4c4c..65885a7 100755
--- a/scripts/install
+++ b/scripts/install
@@ -3,7 +3,7 @@
 # Use the Python executable provided from the `-p` option, or a default.
 [ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"
 
-REQUIREMENTS="dev_requirements.txt"
+REQUIREMENTS="requirements.txt"
 VENV="venv"
 
 set -x
@@ -16,3 +16,4 @@ else
 fi
 
 "$PIP" install -r "$REQUIREMENTS"
+"$PIP" install -e .
diff --git a/scripts/publish b/scripts/publish
new file mode 100755
index 0000000..b0d57bd
--- /dev/null
+++ b/scripts/publish
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+
+VERSION_FILE="httpx_caching/__version__.py"
+
+if [ -d 'venv' ] ; then
+    PREFIX="venv/bin/"
+else
+    PREFIX=""
+fi
+
+set -x
+
+${PREFIX}twine upload dist/*
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..f28d013
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from pathlib import Path
+
+from setuptools import setup
+
+
+def get_version(package):
+    """
+    Return package version as listed in `__version__.py`.
+    """
+    version = Path(package, "__version__.py").read_text()
+    return re.search("__version__ = ['\"]([^'\"]+)['\"]", version).group(1)
+
+
+def get_long_description():
+    """
+    Return the README.
+    """
+    long_description = ""
+    with open("README.md", encoding="utf8") as f:
+        long_description += f.read()
+    # long_description += "\n\n"
+    # with open("CHANGELOG.md", encoding="utf8") as f:
+    #     long_description += f.read()
+    return long_description
+
+
+def get_packages(package):
+    """
+    Return root package and all sub-packages.
+    """
+    return [str(path.parent) for path in Path(package).glob("**/__init__.py")]
+
+
+setup(
+    name="httpx-caching",
+    python_requires=">=3.7",
+    version=get_version("httpx_caching"),
+    url="https://github.com/johtso/httpx-caching",
+    project_urls={
+        "Source": "https://github.com/johtso/httpx-caching",
+    },
+    license="Apache-2.0",
+    description="Caching for HTTPX.",
+    long_description=get_long_description(),
+    long_description_content_type="text/markdown",
+    author="Johannes (johtso)",
+    author_email="johtso@gmail.com",
+    package_data={"httpx_caching": ["py.typed"]},
+    packages=get_packages("httpx_caching"),
+    include_package_data=True,
+    zip_safe=False,
+    install_requires=[
+        "httpx==0.22.*",
+        "msgpack",  
+        "anyio",
+        "multimethod",
+    ],
+    extras_require={},
+    classifiers=[
+        "Development Status :: 3 - Alpha",
+        "Environment :: Web Environment",
+        "Intended Audience :: Developers",
+        "License :: OSI Approved :: Apache Software License",
+        "Operating System :: OS Independent",
+        "Topic :: Internet :: WWW/HTTP",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
+        "Programming Language :: Python :: 3 :: Only",
+    ],
+)
\ No newline at end of file


Test patch:
diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml
index 58450e4..d21cb07 100644
--- a/.github/workflows/test-suite.yml
+++ b/.github/workflows/test-suite.yml
@@ -27,6 +27,8 @@ jobs:
         run: "scripts/check"
       - name: "Generate sync code"
         run: "scripts/compile"
+      - name: "Build package"
+        run: "scripts/build"
       - name: "Run tests"
         run: "scripts/test"
       - name: "Enforce coverage"