Skip to content

Commit

Permalink
Prepare for pypi publish
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerwooo committed Dec 9, 2024
1 parent 2ccb2ee commit 5f5400b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 17 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ jobs:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v4
with:
python-version-file: "pyproject.toml"
python-version: "3.12"

# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version-file: "pyproject.toml"

- name: Install the project
run: uv sync --all-extras --dev
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: pypi-publish

on:
release:
types: [published]
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version-file: "pyproject.toml"

- name: Install the project with build deps
run: uv sync

- name: Build package
run: uv build

- name: Publish package
run: uv publish
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Daisy Lab
Copyright (c) 2023 Spencer Woo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<a href="https://github.com/psf/black">
<img src="https://img.shields.io/badge/code%20style-black-000000?labelColor=2D3339" alt="Code style: black">
</a>
<a href="https://pypi.python.org/pypi/torchattack">
<img src="https://img.shields.io/pypi/v/torchattack?labelColor=2D3339" alt="pypi">
</a>
<a href="https://github.com/spencerwooo/torchattack/actions/workflows/ci.yml">
<img src="https://github.com/spencerwooo/torchattack/actions/workflows/ci.yml/badge.svg" alt="lint">
</a>
Expand All @@ -19,16 +22,8 @@

🛡 **torchattack** - A curated list of adversarial attacks in PyTorch, with a focus on transferable black-box attacks.

<sub><b><em>INSTALL FROM GITHUB SOURCE</em></b></sub>

```shell
python -m pip install git+https://github.com/spencerwooo/[email protected]
```

<sub><b><em>INSTALL FROM GITEE MIRROR</em></b></sub>

```shell
python -m pip install git+https://gitee.com/spencerwoo/torchattack@v1.0.5
pip install torchattack
```

## Usage
Expand Down
18 changes: 17 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ description = "A set of adversarial attacks implemented in PyTorch"
authors = [{ name = "spencerwooo", email = "[email protected]" }]
requires-python = ">=3.10,<3.13"
readme = "README.md"
license = { text = "MIT" }
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: GPU :: NVIDIA CUDA",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"torch>=1.13.0",
"torchvision>=0.14.0",
Expand All @@ -13,6 +25,10 @@ dependencies = [
]
dynamic = ["version"]

[project.urls]
Repository = "https://github.com/spencerwooo/torchattack"
Documentation = "https://github.com/spencerwooo/torchattack/blob/main/README.md"

[project.optional-dependencies]
dev = ["mypy", "rich", "timm"]
test = ["pytest", "pytest-cov"]
Expand Down
2 changes: 1 addition & 1 deletion torchattack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from torchattack.vmifgsm import VMIFGSM
from torchattack.vnifgsm import VNIFGSM

__version__ = '1.0.5'
__version__ = '1.1.0'

__all__ = [
# Helper function to create an attack by its name
Expand Down

0 comments on commit 5f5400b

Please sign in to comment.