Skip to content

chore: migrate from setup.py to pyproject.toml #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v1
- uses: astral-sh/ruff-action@v3
with:
args: check
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v1
- uses: astral-sh/ruff-action@v3
with:
args: format --check
test:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
- name: Install dependencies
if: ${{ steps.release.outputs.release_created }}
run: |
python -m pip install --upgrade pip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't seem necessary to try to upgrade pip just to install build

pip install build
run: pip install build
- name: Build
if: ${{ steps.release.outputs.release_created }}
run: python -m build
Expand Down
24 changes: 5 additions & 19 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Instructions for Deploying
# Instructions for Building

### Install dependencies

Expand All @@ -7,34 +7,20 @@ Use a virtual environment and install dependencies
```
> python3 -m venv venv
> source venv/bin/activate
> pip install twine build python-dotenv
> pip install build

python3 -m venv venv; source venv/bin/activate; pip install twine build python-dotenv
python3 -m venv venv; source venv/bin/activate; pip install build
```

### Build the project

This will create the `/dist` directory
```
python setup.py sdist bdist_wheel
python -m build
```

### Run tests

```
python setup.py pytest
```

### Publish the package
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

people outside the org can't publish anyways, so removing this block


To publish the package, you need an API key on pypi.org. You can save this API key in a `.pypirc` file

```
[pypi]
username = __token__
password = pypi__abc...
```

```
python3 -m twine upload dist/*
pytest
```
88 changes: 84 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,86 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
requires = ["setuptools >= 75.0"]
build-backend = "setuptools.build_meta"

[project]
name = "passage-identity"
version = "3.0.1"
dependencies = [
"cryptography ~= 44.0", # used by pyjwt
"pydantic ~= 2.10", # used by codgen
"pyjwt ~= 2.9",
"python-dateutil ~= 2.9", # used by codegen
"requests ~= 2.32",
]
requires-python = ">=3.8"
authors = [
{ name = "Passage by 1Password", email = "support@passage.id" },
]
description = "Passkey Complete for Python - Integrate into your Python API or service to enable a completely passwordless standalone auth solution with Passage by 1Password"
readme = "README.md"
classifiers = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were pulled from https://pypi.org/classifiers/

"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Security",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[project.urls]
Documentation = "https://docs.passage.id/complete"
"Bug Tracker" = "https://github.com/passageidentity/.github/blob/main/SUPPORT.md"

[project.license]
file = "LICENSE"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[project]
license-files = ["LICENSE"]

the above syntax is noted in the docs but hasn't been adopted by setuptools yet, so we are using the legacy syntax for now


[project.optional-dependencies]
test = [
"pytest ~= 8.3",
]
lint = [
"ruff ~= 0.8",
]
dev = [
"passage-identity[test,lint]",
]

[tool.ruff]
exclude = [
".eggs",
".git",
".pytest_cache",
".ruff_cache",
".venv",
".vscode",
"__pypackages__",
"dist",
"passageidentity/openapi_client",
]
line-length = 120
indent-width = 4
target-version = "py38"

[tool.ruff.lint]
select = ["ALL"]
ignore = []
fixable = ["ALL"]
unfixable = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.per-file-ignores]
"tests/**.py" = ["D", "S101", "PLR2004"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
68 changes: 0 additions & 68 deletions ruff.toml

This file was deleted.

71 changes: 0 additions & 71 deletions setup.py

This file was deleted.