Skip to content

Commit

Permalink
use poetry to build and publish, add entrypoint for pipx and recommen…
Browse files Browse the repository at this point in the history
…d to use it
  • Loading branch information
Miłosz Skaza committed Aug 24, 2023
1 parent c385e70 commit a86c4bd
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 116 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Build wheels
---
name: Build and Publish

on:
release:
types: [published]
pull_request:
types: [opened, reopened, edited, synchronize]

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

# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

# Install dependencies
- name: Install dependencies
run: |
pip install poetry
poetry install
# Build wheels
- name: Build wheels
run: poetry run python setup.py sdist bdist_wheel
- name: Build package
run: poetry build

- uses: actions/upload-artifact@v2
with:
path: |
./dist/*.tar.gz
# Publish to pypi
- name: Publish to pypi
- name: Publish to PYPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: ${{ github.event_name == 'release' && env.TWINE_USERNAME != null }}
run: twine upload --repository pypi dist/*
PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD }}
if: ${{ github.event_name == 'release' && env.PYPI_TOKEN != null }}
run: |
poetry config pypi-token.pypi "$PYPI_TOKEN"
poetry publish
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

21 changes: 1 addition & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,8 @@ format:
test:
pytest --cov=ctfcli tests

install:
python3 setup.py install

build:
python3 setup.py sdist bdist_wheel

clean:
rm -rf build/
rm -rf dist/
rm -rf ctfcli.egg-info/
rm -rf .ruff_cache
rm -rf .pytest_cache
rm -f .coverage

publish-test:
@echo "Publishing to TestPyPI"
@echo "Are you sure? [y/N] " && read ans && [ $${ans:-N} == y ]
python3 setup.py sdist bdist_wheel
twine upload --repository test dist/*

publish-pypi:
@echo "Publishing to PyPI"
@echo "ARE YOU ABSOLUTELY SURE? [y/N] " && read ans && [ $${ans:-N} == y ]
python3 setup.py sdist bdist_wheel
twine upload --repository pypi dist/*
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@

# Installation and Usage

ctfcli can be installed with `pip install ctfcli`
ctfcli can be installed with [`pipx`](https://github.com/pypa/pipx) as an executable command:

`pipx install ctfcli`

Alternatively, you can always install it with `pip` as a python module:

`pip install ctfcli`

## 1. Create an Event

Expand Down
18 changes: 2 additions & 16 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ description = "ctfcli is a tool to manage Capture The Flag events and challenges
authors = ["Kevin Chung <[email protected]>", "Miłosz Skaza <[email protected]>"]
readme = "README.md"

[tool.poetry.scripts]
ctf = "ctfcli.__main__:main"

[tool.poetry.dependencies]
python = "^3.8"
python-frontmatter = "^1.0.0"
Expand All @@ -24,7 +27,6 @@ isort = "^5.12.0"
pytest = "^7.4.0"
pytest-sugar = "^0.9.7"
pytest-cov = "^4.1.0"
wheel = "^0.41.2"

[tool.ruff]
line-length = 120
Expand Down
9 changes: 0 additions & 9 deletions requirements.in

This file was deleted.

49 changes: 0 additions & 49 deletions setup.py

This file was deleted.

0 comments on commit a86c4bd

Please sign in to comment.