Skip to content

Commit 928966c

Browse files
author
Miłosz Skaza
authored
use poetry to build and publish, add entrypoint for pipx and recommend to use it (#131)
1 parent c385e70 commit 928966c

File tree

8 files changed

+23
-116
lines changed

8 files changed

+23
-116
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
name: Build wheels
1+
---
2+
name: Build and Publish
23

34
on:
45
release:
56
types: [published]
67
pull_request:
78
types: [opened, reopened, edited, synchronize]
89

9-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1010
jobs:
11-
# This workflow contains a single job called "build"
1211
build:
1312
# The type of runner that the job will run on
1413
runs-on: ubuntu-latest
@@ -21,31 +20,28 @@ jobs:
2120
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2221
- uses: actions/checkout@v2
2322

24-
# Set up Python environment
2523
- name: Set up Python
2624
uses: actions/setup-python@v4
2725
with:
2826
python-version: 3.11
2927

30-
# Install dependencies
3128
- name: Install dependencies
3229
run: |
3330
pip install poetry
3431
poetry install
3532
36-
# Build wheels
37-
- name: Build wheels
38-
run: poetry run python setup.py sdist bdist_wheel
33+
- name: Build package
34+
run: poetry build
3935

4036
- uses: actions/upload-artifact@v2
4137
with:
4238
path: |
4339
./dist/*.tar.gz
4440
45-
# Publish to pypi
46-
- name: Publish to pypi
41+
- name: Publish to PYPI
4742
env:
48-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
49-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
50-
if: ${{ github.event_name == 'release' && env.TWINE_USERNAME != null }}
51-
run: twine upload --repository pypi dist/*
43+
PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD }}
44+
if: ${{ github.event_name == 'release' && env.PYPI_TOKEN != null }}
45+
run: |
46+
poetry config pypi-token.pypi "$PYPI_TOKEN"
47+
poetry publish

MANIFEST.in

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

Makefile

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,8 @@ format:
1111
test:
1212
pytest --cov=ctfcli tests
1313

14-
install:
15-
python3 setup.py install
16-
17-
build:
18-
python3 setup.py sdist bdist_wheel
19-
2014
clean:
21-
rm -rf build/
2215
rm -rf dist/
23-
rm -rf ctfcli.egg-info/
2416
rm -rf .ruff_cache
17+
rm -rf .pytest_cache
2518
rm -f .coverage
26-
27-
publish-test:
28-
@echo "Publishing to TestPyPI"
29-
@echo "Are you sure? [y/N] " && read ans && [ $${ans:-N} == y ]
30-
python3 setup.py sdist bdist_wheel
31-
twine upload --repository test dist/*
32-
33-
publish-pypi:
34-
@echo "Publishing to PyPI"
35-
@echo "ARE YOU ABSOLUTELY SURE? [y/N] " && read ans && [ $${ans:-N} == y ]
36-
python3 setup.py sdist bdist_wheel
37-
twine upload --repository pypi dist/*

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010

1111
# Installation and Usage
1212

13-
ctfcli can be installed with `pip install ctfcli`
13+
ctfcli can be installed with [`pipx`](https://github.com/pypa/pipx) as an executable command:
14+
15+
`pipx install ctfcli`
16+
17+
Alternatively, you can always install it with `pip` as a python module:
18+
19+
`pip install ctfcli`
1420

1521
## 1. Create an Event
1622

poetry.lock

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

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ description = "ctfcli is a tool to manage Capture The Flag events and challenges
55
authors = ["Kevin Chung <[email protected]>", "Miłosz Skaza <[email protected]>"]
66
readme = "README.md"
77

8+
[tool.poetry.scripts]
9+
ctf = "ctfcli.__main__:main"
10+
811
[tool.poetry.dependencies]
912
python = "^3.8"
1013
python-frontmatter = "^1.0.0"
@@ -24,7 +27,6 @@ isort = "^5.12.0"
2427
pytest = "^7.4.0"
2528
pytest-sugar = "^0.9.7"
2629
pytest-cov = "^4.1.0"
27-
wheel = "^0.41.2"
2830

2931
[tool.ruff]
3032
line-length = 120

requirements.in

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

setup.py

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

0 commit comments

Comments
 (0)