Skip to content

Commit

Permalink
Merge pull request #30 from miraisolutions/issue-25/switch-to-pyproje…
Browse files Browse the repository at this point in the history
…ct-toml

Initial commit for switching to pyproject.toml
  • Loading branch information
mirai-mjelavic authored Jan 23, 2024
2 parents 68eb350 + 77307e7 commit 69de0fb
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 136 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python3 -m build
twine upload dist/*
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,23 +348,19 @@ If you install the package, you can use the CLI tool as designed for the end use
```bash
python -m pip install --upgrade pip

pip install --upgrade setuptools wheel
pip install --upgrade build

python setup.py sdist bdist_wheel # creates build and dist directories
python -m build # creates build and dist directories

# Windows:
pip install .\dist\secretsanta-0.1.0-py3-none-any.whl -e
pip install .\dist\secretsanta-0.1.0-py3-none-any.whl
# if already installed, use below to force re-installation:
pip install --force-reinstall .\dist\secretsanta-0.1.0-py3-none-any.whl -e
pip install --force-reinstall .\dist\secretsanta-0.1.0-py3-none-any.whl

# Ubuntu:
pip install ./dist/secretsanta-0.1.0.tar.gz -e
pip install ./dist/secretsanta-0.1.0.tar.gz
# if already installed, use below to force re-installation:
pip install --force-reinstall ./dist/secretsanta-0.1.0.tar.gz -e

# Note the `-e` flag which stands for "editable mode" and will install the
# package in the repository, which means that one can adjust the code
# and test the updated command line without having to re-install.
pip install --force-reinstall ./dist/secretsanta-0.1.0.tar.gz

# now you can use the CLI tool properly as below:
santa --help
Expand Down
56 changes: 56 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "secretsanta"
description = "Secret Santa randomizer"
readme = "README.md"
authors = [
{ name = "Mirai Solutions", email = "opensource@mirai-solutions.com" },
]
urls = { Homepage = "https://github.com/miraisolutions/secretsanta" }
classifiers = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Games/Entertainment',
]
license = { text = "MIT" }
version = "0.1.dev1"
keywords = ["secret", "santa"]

[project.scripts]
santa = "secretsanta.cli.cli:santa"

[tool.setuptools.packages.find]
include = ["secretsanta"]

[tool.setuptools_scm]

[tool.coverage.html]
# Directory where coverage report should be written.
directory = "coverage"

[tool.coverage.report]
# Show which lines were missed in summary report.
show_missing = true

[tool.coverage.run]
# Measure branch coverage in addition to statement coverage.
branch = true
# The source directory to measure. This is already in 'tox.ini'.
#source = secretsanta

[tool.pytest.ini_options]
norecursedirs = [
"bin",
"include",
"lib",
"lib64",
"share",
".tox",
".git",
"docs"
]
1 change: 0 additions & 1 deletion secretsanta/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = '0.1.0'
114 changes: 0 additions & 114 deletions setup.py

This file was deleted.

9 changes: 0 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ setenv =
COV_CORE_CONFIG={toxinidir}/.coveragerc
COVERAGE_FILE={toxinidir}/.coverage.{envname}

[pytest]
# this could also be inside setup.cfg, but then the section must be named [tool:pytest]
# https://docs.pytest.org/en/latest/example/pythoncollection.html
# don't look for tests inside these directories:
norecursedirs = bin include lib lib64 share .tox .git docs
#addopts = --cov=secretsanta --cov-report html
# Note a warning like "PytestWarning: Module already imported so cannot be rewritten: pytest_cov" is expected:
# https://github.com/pytest-dev/pytest-cov/issues/148

[flake8]
# ignore lines longer than 79 chars
ignore = E501
Expand Down

0 comments on commit 69de0fb

Please sign in to comment.