-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from numberly/chore/hatch
chore(hatch): hatch builder + ci + lint
- Loading branch information
Showing
17 changed files
with
407 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: CI | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ '3.10', '3.11' ] | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade hatch | ||
- name: Run tests | ||
run: | | ||
hatch run +py=${{ matrix.py || matrix.python-version }} test:with-coverage | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade hatch | ||
- name: Check with black + isort | ||
if: always() | ||
run: hatch run style:format && git diff --exit-code | ||
- name: Check with ruff | ||
if: always() | ||
run: hatch run style:lint | ||
- name: Check with mypy | ||
if: always() | ||
run: hatch run types:check | ||
|
||
package: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install Hatch | ||
run: | | ||
python -m pip install -U hatch | ||
- name: Build package | ||
run: | | ||
hatch build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: deploy-release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install Hatch | ||
run: | | ||
python -m pip install -U hatch | ||
- name: Build package | ||
run: | | ||
hatch build | ||
- name: Publish | ||
run: | | ||
hatch publish | ||
env: | ||
HATCH_INDEX_USER: __token__ | ||
HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,148 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "python-vaultwarden" | ||
version = "0.7.0" | ||
description = "The Vautlwarden Python Client" | ||
requires-python = ">=3.11" | ||
description = "Admin Vaultwarden and Simple Bitwarden Python Client" | ||
authors = [ | ||
{ name = "Lyonel Martinez", email = "lyonel.martinez@numberly.com" }, | ||
{ name = "Mathis Ribet", email = "mathis.ribet@numberly.com" }, | ||
] | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
repository = "https://github.com/numberly/python-vaultwarden" | ||
documentation = "https://numberly.github.io/python-vaultwarden/" | ||
packages = [ | ||
{ include = "vaultwarden", from = "src" }, | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Web Environment", | ||
"Intended Audience :: Developers", | ||
"Environment :: Web Environment", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
"Intended Audience :: Developers", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Typing :: Typed", | ||
"Topic :: Internet :: WWW/HTTP", | ||
# Include this classifier to prevent accidently publishing private code to PyPI. | ||
# https://pypi.org/classifiers/ | ||
"Private :: Do Not Upload", | ||
] | ||
requires-python = ">=3.10" | ||
dependencies = [ | ||
"bitwardentools >=1.0.55", | ||
"httpx >=0.24.1", | ||
] | ||
|
||
[tool.hatch.version] | ||
path = "src/vaultwarden/__version__.py" | ||
|
||
[tool.hatch.build] | ||
packages = [ | ||
"src/vaultwarden", | ||
] | ||
include = [ | ||
"/tests", | ||
] | ||
|
||
[tool.hatch.build.targets.sdist] | ||
include = ["/src/vaultwarden/**/*.py"] | ||
[tool.hatch.build.targets.wheel] | ||
packages = [ | ||
"src/vaultwarden", | ||
] | ||
|
||
[tool.hatch.envs.test] | ||
dependencies = [ | ||
"coverage", | ||
] | ||
|
||
[tool.hatch.envs.test.scripts] | ||
test = "coverage run --source=src/vaultwarden -m unittest discover -p 'test_*.py' tests --top-level-directory ." | ||
_coverage = ["test", "coverage xml", "coverage report --show-missing"] | ||
with-coverage = "test" | ||
[[tool.hatch.envs.test.matrix]] | ||
python = ["3.10", "3.11"] | ||
type = ["default"] | ||
[tool.hatch.envs.test.overrides] | ||
matrix.type.scripts = [ | ||
{ key = "with-coverage", value = "_coverage", if = ["default"] }, | ||
] | ||
|
||
[tool.hatch.envs.types] | ||
dependencies = [ | ||
"mypy", | ||
"types-PyYAML", | ||
"types-setuptools", | ||
"typing-extensions", | ||
] | ||
[tool.hatch.envs.types.scripts] | ||
check = "mypy src/vaultwarden" | ||
|
||
[tool.hatch.envs.style] | ||
detached = true | ||
dependencies = [ | ||
"bitwardentools==1.0.55", | ||
"httpx==0.24.1", | ||
"black", | ||
"isort", | ||
"ruff", | ||
] | ||
[tool.hatch.envs.style.scripts] | ||
lint = [ | ||
"ruff check --fix src/vaultwarden", | ||
] | ||
check = [ | ||
"isort --check-only --diff src/vaultwarden", | ||
"black -q --check --diff src/vaultwarden", | ||
"ruff check src/vaultwarden", | ||
] | ||
format = [ | ||
"isort -q src/vaultwarden", | ||
"black -q src/vaultwarden", | ||
"lint" | ||
] | ||
|
||
[tool.ruff] | ||
# Add "Q" to the list of enabled codes. | ||
select = ["B", "E", "F", "I", "N", "Q", "RUF", "SIM", "TCH"] | ||
fixable = ["ALL"] | ||
src = ["src/vaultwarden", "tests"] | ||
target-version = "py310" | ||
line-length = 79 | ||
|
||
[tool.ruff.flake8-quotes] | ||
docstring-quotes = "double" | ||
|
||
[tool.ruff.flake8-bugbear] | ||
extend-immutable-calls = ["typer.Argument"] | ||
|
||
[tool.ruff.isort] | ||
force-sort-within-sections = true | ||
|
||
[tool.black] | ||
line-length = 79 | ||
target-version = ["py310", "py311"] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 80 | ||
|
||
[tool.mypy] | ||
ignore_missing_imports = true | ||
warn_unreachable = true | ||
no_implicit_optional = true | ||
show_error_codes = true | ||
|
||
[tool.commitizen] | ||
version = "0.7.0" | ||
tag_format = "$version" | ||
update_changelog_on_bump = true | ||
version_files = [ | ||
"pyproject.toml:version", | ||
"vaultwarden/__version__.py", | ||
"src/vaultwarden/__version__.py", | ||
] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.