Skip to content

Commit 65c8ac7

Browse files
committed
first commit
0 parents  commit 65c8ac7

11 files changed

Lines changed: 232 additions & 0 deletions

File tree

.github/workflows/format.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Format
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
format:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.10'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install ruff
25+
26+
- name: Check formatting with ruff
27+
run: |
28+
ruff format --check .
29+
30+
- name: Check code with ruff
31+
run: |
32+
ruff check .

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'trackio/version.txt'
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Debug - Show version.txt content
17+
run: cat trackio/version.txt
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build twine
28+
29+
- name: Build package
30+
run: python -m build
31+
32+
- name: Publish to PyPI
33+
env:
34+
TWINE_USERNAME: __token__
35+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
36+
run: |
37+
python -m twine upload dist/*

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Unit Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.10'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e .
25+
pip install pytest
26+
27+
- name: Run tests
28+
run: |
29+
pytest

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Your Name
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include README.md
2+
include LICENSE

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# trackio
2+
3+
A Python library for tracking and analytics.
4+
5+
## Installation
6+
7+
```bash
8+
pip install trackio
9+
```
10+
11+
## Usage
12+
13+
```python
14+
import trackio
15+
16+
print(trackio.__version__)
17+
```
18+
19+
## License
20+
21+
MIT License

pyproject.toml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "trackio"
7+
description = "A small Python library created to help developers protect their applications from Server Side Request Forgery (SSRF) attacks."
8+
authors = [
9+
{ name = "Abubakar Abid", email = "abubakar@hf.co" }
10+
]
11+
readme = "README.md"
12+
requires-python = ">3.9"
13+
dependencies = [
14+
]
15+
classifiers = [
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
]
20+
dynamic = ["version"]
21+
22+
[project.urls]
23+
homepage = "https://github.com/gradio-app/trackio"
24+
repository = "https://github.com/gradio-app/trackio"
25+
26+
[project.optional-dependencies]
27+
dev = [
28+
"pytest",
29+
"ruff==0.9.3"
30+
]
31+
32+
[tool.hatch.build.targets.wheel]
33+
packages = ["trackio"]
34+
35+
[tool.hatch.version]
36+
path = "trackio/version.txt"
37+
pattern = "^(?P<version>[0-9]+\\.[0-9]+\\.[0-9]+)$"
38+
39+
[tool.ruff]
40+
# Exclude a variety of commonly ignored directories.
41+
exclude = [
42+
".git",
43+
".mypy_cache",
44+
".ruff_cache",
45+
".venv",
46+
"__pycache__",
47+
"build",
48+
"dist",
49+
]
50+
51+
# Same as Black.
52+
line-length = 88
53+
indent-width = 4
54+
55+
# Assume Python 3.8
56+
target-version = "py38"
57+
58+
[tool.ruff.lint]
59+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`)
60+
select = ["E", "F", "I"]
61+
# Ignore line length violations
62+
ignore = ["E501"]
63+
64+
# Allow autofix for all enabled rules (when `--fix`) is provided.
65+
fixable = ["ALL"]
66+
67+
# Allow unused variables when underscore-prefixed.
68+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
69+
70+
[tool.ruff.format]
71+
# Use single quotes for strings.
72+
quote-style = "double"
73+
74+
# Indent with spaces, rather than tabs.
75+
indent-style = "space"
76+
77+
# Like Black, respect magic trailing commas.
78+
skip-magic-trailing-comma = false
79+
80+
# Like Black, automatically detect the appropriate line ending.
81+
line-ending = "auto"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

tests/test_basic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import trackio
2+
3+
def test_version():
4+
assert trackio.__version__ == "0.1.0"

trackio/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from pathlib import Path
2+
3+
__version__ = Path(__file__).parent.joinpath("version.txt").read_text().strip()

0 commit comments

Comments
 (0)