Skip to content

Commit

Permalink
v2.0.0 (#3)
Browse files Browse the repository at this point in the history
* rewrite and new version

* small fixes and documentation

* update version number
  • Loading branch information
offish authored Aug 28, 2023
1 parent bee71f2 commit 54d7625
Show file tree
Hide file tree
Showing 15 changed files with 323 additions and 364 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Upload Python Package
on:
release:
types: [published]
jobs:
pypi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: python3 -m pip install --upgrade build && python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# tf2-sku
[![License](https://img.shields.io/github/license/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku/blob/master/LICENSE)
[![Stars](https://img.shields.io/github/stars/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku/stargazers)
[![Issues](https://img.shields.io/github/issues/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku/issues)
[![Size](https://img.shields.io/github/repo-size/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku)
[![Discord](https://img.shields.io/discord/467040686982692865?color=7289da&label=Discord&logo=discord)](https://discord.gg/t8nHSvA)
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Parse TF2 items to SKU format with Python.

## Donate
- BTC: `bc1qntlxs7v76j0zpgkwm62f6z0spsvyezhcmsp0z2`
- [Steam Trade Offer](https://steamcommunity.com/tradeoffer/new/?partner=293059984&token=0-l_idZR)

## Usage
```python
>>> from tf2_sku import to_sku, from_sku

>>> to_sku({"defindex": 5021, "quality": 6})
"5021;6"
# https://marketplace.tf/items/tf2/5021;6

>>> from_sku("161;3;kt-3")
{
"defindex": 161,
"quality": 3,
"effect": -1,
"australium": False,
"craftable": True,
"wear": -1,
"skin": -1,
"strange": -1,
"killstreak_tier": 3,
"target_defindex": -1,
"festivized": False,
"craft_number": -1,
"crate_number": -1,
"output_defindex": -1,
"output_quality": -1,
"paint": -1,
}
# https://marketplace.tf/items/tf2/161;3;kt-3

>>> to_sku({
... "defindex": 199,
... "quality": 5,
... "effect": 702,
... "wear": 3,
... "skin": 292,
... "strange": True,
... "killstreak_tier": 3})
"199;5;u702;w3;pk292;strange;kt-3"
# https://marketplace.tf/items/tf2/199;5;u702;w3;pk292;strange;kt-3
```

## Setup
### Install
```bash
pip install tf2-sku
# or
python -m pip install tf2-sku
```

### Upgrade
```bash
pip upgrade tf2-sku
# or
python -m pip upgrade tf2-sku
```

## Testing
```bash
# tf2-sku/
python -m unittest
```
121 changes: 0 additions & 121 deletions README.rst

This file was deleted.

34 changes: 0 additions & 34 deletions example.py

This file was deleted.

26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[project]
name = "tf2-sku"
authors = [
{ name="offish", email="overutilization@gmail.com" },
]
description = "Parse TF2 items to SKU format"
readme = "README.md"
requires-python = ">=3.7"
keywords = ["tf2", "sku"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = []
dynamic = ["version"]

[project.urls]
"Homepage" = "https://github.com/offish/tf2-sku"
"Bug Tracker" = "https://github.com/offish/tf2-sku/issues"

[tool.setuptools_scm]
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

31 changes: 1 addition & 30 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
from setuptools import setup
import re


with open("README.rst", "r") as f:
long_description = f.read()


with open("tf2_sku/__init__.py") as f:
version = re.search(
r"""^__version__\s*=\s*['"]([^\'"]*)['"]""", f.read(), re.MULTILINE).group(1)


setup(
name="tf2_sku",
version=version,
author="offish",
author_email="overutilization@gmail.com",
description="Format TF2 items as strings or objects.",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
url="https://github.com/offish/tf2_sku",
download_url="https://github.com/offish/tf2_sku/tarball/v" + version,
packages=["tf2_sku"],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
setup()
11 changes: 4 additions & 7 deletions tf2_sku/__init__.py → src/tf2_sku/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
"""
tf2_sku
=======
tf2-sku
Format TF2 items as strings or objects.
"""


__title__ = "tf2_sku"
__title__ = "tf2-sku"
__author__ = "offish"
__license__ = "MIT"
__version__ = "1.0.1"

__version__ = "2.0.0"

from .sku import to_sku, from_sku
from .prettify import prettify
from .utils import SKU, MAPPING
Loading

0 comments on commit 54d7625

Please sign in to comment.