Skip to content

Commit 74c1506

Browse files
committed
chore: swap to poetry
1 parent 4d9c7b4 commit 74c1506

11 files changed

Lines changed: 1012 additions & 74 deletions

File tree

.github/workflows/package-test.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches:
88
- main
99
- nightly
10-
- 'releases/*'
10+
- "releases/*"
1111

1212
jobs:
1313
Unit-Tests:
@@ -17,18 +17,23 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
os: [macos-latest, windows-latest, ubuntu-latest]
20-
python-version: [3.6, 3.7, 3.8, 3.9]
20+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- name: Install Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
2525
with:
2626
python-version: ${{ matrix.python-version }}
27-
- name: Setup dependencies
27+
28+
- name: Install Poetry
2829
run: |
29-
python -m pip install --upgrade pip
30-
pip install pytest
31-
python setup.py install
30+
curl -sSL https://install.python-poetry.org | python - -y
31+
32+
- name: Update PATH
33+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
34+
35+
- name: Install dependencies
36+
run: poetry install --no-interaction
3237

3338
- name: Run Tests
34-
run: pytest tests
39+
run: poetry run pytest tests

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
pypi-publish:
14+
name: Upload release to PyPI
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Set up Python 3.x
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.x"
26+
27+
- name: Install Poetry
28+
run: |
29+
curl -sSL https://install.python-poetry.org | python - -y
30+
31+
- name: Update PATH
32+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
33+
34+
- name: Update Poetry configuration
35+
run: poetry config virtualenvs.create false
36+
37+
- name: Install dependencies
38+
run: poetry install --sync --no-interaction
39+
40+
- name: Package project
41+
run: poetry build
42+
43+
- name: Publish package distributions to PyPI
44+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/python-publish.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ __pycache__
33
dist
44
build
55
python_obfuscator.egg-info
6-
.pytest_cache
6+
.pytest_cache
7+
.mypy_cache
8+
.ruff_cache

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 25.1.0
4+
hooks:
5+
- id: black
6+
language_version: python3
7+
args: [--line-length=88]
8+
9+
- repo: https://github.com/pycqa/isort
10+
rev: 5.13.2
11+
hooks:
12+
- id: isort
13+
args: [--profile=black]
14+
15+
- repo: https://github.com/pycqa/flake8
16+
rev: 7.0.0
17+
hooks:
18+
- id: flake8
19+
args:
20+
[
21+
"--max-line-length=88",
22+
"--extend-ignore=E203,W503,E501,F401,F541",
23+
]
24+
25+
- repo: local
26+
hooks:
27+
- id: pytest-unit
28+
name: Run unit tests
29+
entry: poetry run pytest tests/ -v
30+
language: system
31+
pass_filenames: false
32+
always_run: true
33+
stages: [commit]
34+
35+
default_language_version:
36+
python: python3
37+
38+
fail_fast: true
39+
40+
default_stages: [commit]

poetry.lock

Lines changed: 845 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[build-system]
2+
requires = ["poetry-core>=1.0.0"]
3+
build-backend = "poetry.core.masonry.api"
4+
5+
[tool.poetry]
6+
packages = [{ include = "python_obfuscator" }]
7+
8+
[tool.poetry.dependencies]
9+
python = ">=3.9"
10+
regex = "*"
11+
12+
[tool.poetry.group.dev.dependencies]
13+
mypy = "^1.15.0"
14+
black = "^25.1.0"
15+
isort = "^6.0.0"
16+
pytest = "^8.3.4"
17+
coverage = "^7.6.12"
18+
19+
[project]
20+
name = "python_obfuscator"
21+
version = "0.0.2"
22+
description = "It's a python obfuscator."
23+
readme = "README.md"
24+
authors = [{ name = "David Teather", email = "contact.davidteather@gmail.com" }]
25+
license = { file = "LICENSE" }
26+
dependencies = ["regex"]
27+
requires-python = ">=3.9"
28+
classifiers = [
29+
"Development Status :: 3 - Alpha",
30+
"Intended Audience :: Developers",
31+
"Topic :: Software Development :: Build Tools",
32+
"License :: OSI Approved :: MIT License",
33+
"Programming Language :: Python :: 3",
34+
]
35+
36+
[project.optional-dependencies]
37+
dev = ["pytest", "black", "mypy", "coverage", "isort"]
38+
39+
[project.scripts]
40+
pyobfuscate = "python_obfuscator.cli:cli"
41+
42+
[tool.isort]
43+
profile = "black"
44+
line_length = 88
45+
46+
[tool.pytest.ini_options]
47+
testpaths = ["tests"]
48+
49+
[tool.coverage.run]
50+
branch = true
51+
source = ["python_obfuscator"]
52+
omit = ["tests/*"]

python_obfuscator/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
from .obfuscator import obfuscator
2+
from .version import __version__
3+
4+
__all__ = ["obfuscator", "__version__"]

python_obfuscator/version.py

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

setup.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[bumpversion]
2+
current_version = 0.0.2
3+
4+
[bumpversion:file:pyproject.toml]
5+
search = version = "{current_version}"
6+
replace = version = "{new_version}"
7+
8+
[bumpversion:file:python_obfuscator/version.py]
9+
search = __version__ = "{current_version}"
10+
replace = __version__ = "{new_version}"

0 commit comments

Comments
 (0)