Skip to content

Commit 7c8ce2a

Browse files
authored
Enable Publishing Workflow (#5)
* Enable Publishing Workflow * Update README.md
1 parent 864d051 commit 7c8ce2a

File tree

2 files changed

+57
-52
lines changed

2 files changed

+57
-52
lines changed
Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,55 @@
11
# This GitHub workflow is only needed for python package releases which are supposed to be published on pypi.
2-
3-
4-
# This workflows will upload a Python Package using Twine when a release is created
2+
# This workflow will upload a Python Package using Twine when a release is created
53
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
64

7-
# name: Upload Python Package
5+
name: Upload Python Package
86

9-
# on:
10-
# release:
11-
# branches: main
12-
# types: [created, edited]
7+
on:
8+
release:
9+
types: [ created, edited ]
1310

14-
# jobs:
15-
# tests:
16-
# if: startsWith(github.ref, 'refs/tags/v')
17-
# runs-on: ${{ matrix.os }}
18-
# strategy:
19-
# matrix:
20-
# python-version: ["3.11"]
21-
# os: [ubuntu-latest]
22-
# steps:
23-
# - uses: actions/checkout@v2
24-
# - name: Set up Python ${{ matrix.python-version }}
25-
# uses: actions/setup-python@v2
26-
# with:
27-
# python-version: ${{ matrix.python-version }}
28-
# - name: Install tox
29-
# run: |
30-
# python -m pip install --upgrade pip
31-
# pip install tox
32-
# - name: Run tox
33-
# run: |
34-
# tox
11+
jobs:
12+
tests:
13+
if: startsWith(github.ref, 'refs/tags/v')
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
python-version: [ "3.11" ]
18+
os: [ ubuntu-latest ]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install tox
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install tox
29+
- name: Run tox
30+
run: |
31+
tox
3532
36-
# build-n-publish:
37-
# name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
38-
# runs-on: ubuntu-latest
39-
# needs: tests
40-
# steps:
41-
# - uses: actions/checkout@v2
42-
# - name: Set up Python
43-
# uses: actions/setup-python@v2
44-
# with:
45-
# python-version: ${{ matrix.python-version }}
46-
# - name: Install dependencies
47-
# run: |
48-
# python -m pip install --upgrade pip
49-
# pip install setuptools setuptools-scm wheel twine
50-
# - name: Build a binary wheel and a source tarball
51-
# run: |
52-
# python setup.py sdist bdist_wheel
53-
# - name: Publish distribution 📦 to PyPI
54-
# if: startsWith(github.ref, 'refs/tags/v')
55-
# uses: pypa/gh-action-pypi-publish@release/v1
56-
# with:
57-
# user: __token__
58-
# password: ${{ secrets.PYPI_API_TOKEN }}
33+
build-n-publish:
34+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
35+
runs-on: ubuntu-latest
36+
needs: tests
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Set up Python
40+
uses: actions/setup-python@v2
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
- name: Install dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
pip install -r dev_requirements/requirements-packaging.txt
47+
- name: Build a binary wheel and a source tarball
48+
run: |
49+
python -m build
50+
- name: Publish distribution 📦 to PyPI
51+
if: startsWith(github.ref, 'refs/tags/v')
52+
uses: pypa/gh-action-pypi-publish@release/v1
53+
with:
54+
user: __token__
55+
password: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ This package provides functionalities to determine the values of generic type va
99
As of now, it only supports two functions: `get_type_vars` and `get_filled_type`. These functions work also
1010
with pydantic generic models (only tested with pydantic > v2.3.0).
1111

12+
### Installation
13+
The package is [available on PyPI](https://pypi.org/project/python-generics/):
14+
```bash
15+
pip install python-generics
16+
```
17+
18+
### Usage
19+
1220
The `get_type_vars` function returns a tuple of all type variables for a given generic type. The `TypeVar`s are
1321
determined by `Generic` if the type is a subclass of `Generic`. Otherwise, they are determined by the indexed
1422
supertypes (the order of the returned tuple is the lexicographical in the list of the supertypes).

0 commit comments

Comments
 (0)