Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: replace setup.py and setup.cfg with pyproject.toml #740

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ jobs:
- name: Run codespell
run: |
make test-codespell
- name: Run flake8
run: |
make test-flake8
- name: Run mypy
run: |
make test-mypy
- name: Run pydocstyle
run: |
make test-pydocstyle
- name: Run pyright
run: |
sudo snap watch --last=install
Expand Down
16 changes: 3 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ autoformat: ## Run automatic code formatters.
ifndef RUFF
$(error "Ruff not installed. Install it with `sudo snap install ruff` or using the official installation instructions: https://docs.astral.sh/ruff/installation/")
endif
autoflake rockcraft/ tests/
black .
ruff check --fix-only rockcraft tests

Expand Down Expand Up @@ -61,8 +60,7 @@ rundocs: ## start a documentation runserver

.PHONY: dist
dist: clean ## Build python package.
python setup.py sdist
python setup.py bdist_wheel
python -m build
ls -l dist

.PHONY: freeze-requirements
Expand All @@ -71,10 +69,10 @@ freeze-requirements: ## Re-freeze requirements.

.PHONY: install
install: clean ## Install python package.
python setup.py install
pip install -e .

.PHONY: lint
lint: test-black test-codespell test-flake8 test-mypy test-pydocstyle test-pyright test-ruff test-sphinx-lint test-shellcheck ## Run all linting tests.
lint: test-black test-codespell test-mypy test-pyright test-ruff test-sphinx-lint test-shellcheck ## Run all linting tests.

.PHONY: release
release: dist ## Release with twine.
Expand All @@ -88,10 +86,6 @@ test-black:
test-codespell:
codespell rockcraft tests

.PHONY: test-flake8
test-flake8:
flake8 rockcraft tests

.PHONY: test-ruff
test-ruff:
ifndef RUFF
Expand All @@ -107,10 +101,6 @@ test-integrations: ## Run integration tests.
test-mypy:
mypy rockcraft tests

.PHONY: test-pydocstyle
test-pydocstyle:
pydocstyle rockcraft

.PHONY: test-pylint
test-pylint:
echo "rockcraft has replaced pylint with ruff. Please use `make test-ruff` instead."
Expand Down
113 changes: 112 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,116 @@
[project]
name = "rockcraft"
dynamic = ["version"]
description = "Create rocks"
license = {file = "LICENSE"}
readme = "README.rst"
requires-python = ">= 3.10"
authors = [
{ name = "Canonical Ltd.", email = "[email protected]" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
]
dependencies = [
"craft-application>=4.0.0",
"craft-archives>=2.0.0",
"craft-cli",
"craft-parts>=2.1.2",
"craft-platforms~=0.3",
"craft-providers>=2.0.4",
"overrides",
"spdx-lookup",
"tabulate>=0.8.10",
]

[project.scripts]
rockcraft = "rockcraft.cli:run"

[project.optional-dependencies]
dev = [
"black",
"canonical-sphinx[full]",
"codespell",
"coverage",
"mccabe<0.7.0",
"mypy",
"pyspelling",
"pytest",
"pytest-check>=2.0",
"pytest-mock",
"pytest-subprocess",
"sphinx-autobuild",
"sphinx-autodoc-typehints",
"sphinx-lint",
"sphinx-toolbox",
"sphinxcontrib-details-directive",
"tox",
"twine",
"types-pyyaml",
"types-requests",
"types-setuptools",
"types-tabulate>=0.9.0.2",
"wheel",
]
doc = [
"canonical-sphinx[full]",
"pyspelling",
"sphinx-autobuild",
"sphinx-autodoc-typehints",
"sphinx-lint",
"sphinx-toolbox",
"sphinxcontrib-details-directive",
]
release = [
"twine",
"wheel",
]
test = [
"black",
"codespell",
"coverage",
"mccabe<0.7.0",
"mypy",
"pytest",
"pytest-check>=2.0",
"pytest-mock",
"pytest-subprocess",
"tox",
"types-pyyaml",
"types-requests",
"types-setuptools",
"types-tabulate>=0.9.0.2",
]

[project.urls]
Documentation = "https://rockcraft.readthedocs.io/en/latest/"
Homepage = "https://github.com/canonical/rockcraft"
Issues = "https://github.com/canonical/rockcraft/issues"
Source = "https://github.com/canonical/rockcraft.git"

[build-system]
requires = [
"setuptools~=70.0.0",
"setuptools>=69.0",
"setuptools_scm[toml]>=7.1"
]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
readme = {file = "README.rst"}

[tool.setuptools.packages.find]
include = ["rockcraft"]
namespaces = false

[tool.setuptools.package-data]
"share.rockcraft" = ["extensions"]

[tool.setuptools_scm]
write_to = "rockcraft/_version.py"
# the version comes from the latest annotated git tag formatted as 'X.Y.Z'
Expand Down Expand Up @@ -35,6 +141,11 @@ line_length = 88
# are not overwritten.
extend-exclude = "docs/sphinx-starter-pack"

[tool.codespell]
quiet-level = 3
skip = "./docs/_build,.direnv,.git,.mypy_cache,.pytest_cache,.venv,__pycache__,venv"
ignore-words-list = "warmup,buildd,astroid"

[tool.pyright]
ignore = [
"docs/sphinx-starter-pack",
Expand Down
12 changes: 0 additions & 12 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ apeye-core==1.1.5
# via apeye
autodocsumm==0.2.13
# via sphinx-toolbox
autoflake==1.7.8
# via rockcraft (setup.py)
babel==2.16.0
# via sphinx
backports-tarfile==1.2.0
Expand Down Expand Up @@ -130,8 +128,6 @@ filelock==3.16.1
# sphinx-toolbox
# tox
# virtualenv
flake8==4.0.1
# via rockcraft (setup.py)
furo==2024.8.6
# via canonical-sphinx
gitdb==4.0.11
Expand Down Expand Up @@ -208,7 +204,6 @@ markupsafe==3.0.1
# sphinx-jinja2-compat
mccabe==0.6.1
# via
# flake8
# rockcraft (setup.py)
mdit-py-plugins==0.4.2
# via myst-parser
Expand Down Expand Up @@ -267,8 +262,6 @@ pluggy==1.5.0
# tox
polib==1.2.0
# via sphinx-lint
pycodestyle==2.8.0
# via flake8
pycparser==2.22
# via cffi
pydantic==2.9.2
Expand All @@ -282,10 +275,6 @@ pydantic-core==2.23.4
# via pydantic
pydocstyle==6.3.0
# via rockcraft (setup.py)
pyflakes==2.4.0
# via
# autoflake
# flake8
pygit2==1.14.1
# via craft-application
pygments==2.18.0
Expand Down Expand Up @@ -455,7 +444,6 @@ tabulate==0.9.0
# sphinx-toolbox
tomli==2.0.2
# via
# autoflake
# black
# mypy
# pyproject-api
Expand Down
127 changes: 0 additions & 127 deletions setup.cfg

This file was deleted.

Loading
Loading