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

Update build to use exclusively pyproject.toml #5836

Merged
merged 2 commits into from
Sep 5, 2023
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade --upgrade-strategy=eager pip setuptools wheel twine
python -m pip install --upgrade --upgrade-strategy=eager pip setuptools build wheel twine
python -m pip install -e . --upgrade
python -m pipenv install --dev
env:
PIPENV_DEFAULT_PYTHON_VERSION: "3.10"

- name: Build wheels
run: |
python -m pipenv run python setup.py sdist bdist_wheel
python -m pipenv run python -m build

# to upload to test pypi, pass repository_url: https://test.pypi.org/legacy/ and use secrets.TEST_PYPI_TOKEN
- name: Publish a Python distribution to PyPI
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ venv_dir := $(get_venv_dir)/pipenv_venv
venv_file := $(CURDIR)/.test_venv
get_venv_path =$(file < $(venv_file))
# This is how we will build tag-specific wheels, e.g. py36 or py37
PY_VERSIONS:= 3.7 3.8 3.9 3.10
PY_VERSIONS:= 3.7 3.8 3.9 3.10 3.11
BACKSLASH = '\\'
# This is how we will build generic wheels, e.g. py2 or py3
INSTALL_TARGETS := $(addprefix install-py,$(PY_VERSIONS))
Expand Down Expand Up @@ -96,7 +96,7 @@ retest: virtualenv submodules test-install

.PHONY: build
build: install-virtualenvs.stamp install.stamp
PIPENV_PYTHON=3.7 pipenv run python setup.py sdist bdist_wheel
PIPENV_PYTHON=3.7 pipenv run python -m build

.PHONY: update-version
update-version:
Expand Down
4 changes: 4 additions & 0 deletions news/5837.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Updates build to use exclusively ``pyproject.toml``
---------------------------------------------------

Modernizes the build process by consolidating all of ``setuptools`` metadata within ``pyproject.toml`` and removing deprecated ``setup.cfg`` and ``setup.py``.
221 changes: 159 additions & 62 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,92 @@
[build-system]
requires = ["setuptools", "wheel"]
kalebmckale marked this conversation as resolved.
Show resolved Hide resolved
requires = ["setuptools>=67.0.0"]
build-backend = "setuptools.build_meta"


[project]
name = "pipenv"
authors = [
{name = "Pipenv maintainer team", email = "[email protected]"},
kalebmckale marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The email is wrong. Please correct the email address. @matteius should our email adresses be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. I've been working on this PR for two weeks now and rebased multiple times. Someone else is welcome to take this on, but I've surpassed the amount of work I'm willing to put in at this time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will update the email address outside this PR -- thanks for your effort on this @kalebmckale

]
description = "Python Development Workflow for Humans."
readme = "README.md"
requires-python = ">=3.7"
license = {file = "LICENSE"}
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"certifi",
"setuptools>=67.0.0",
"virtualenv>=20.24.2",
]
dynamic = ["version"]


[project.optional-dependencies]
dev = [
"towncrier",
"beautifulsoup4",
"sphinx",
"flake8>=3.3.0,<4.0",
"black==23.3.0",
"parver",
"invoke",
]
tests = [
"pytest>=5.0",
"pytest-timeout",
"pytest-xdist",
"flaky",
"mock",
]


[project.scripts]
pipenv = "pipenv:cli"
pipenv-resolver = "pipenv.resolver:main"


[project.urls]
Homepage = "https://github.com/pypa/pipenv"
Documentation = "https://pipenv.pypa.io/en/latest/"
Source = "https://github.com/pypa/pipenv.git"


[tool.setuptools.packages.find]
where = ["."]
exclude = ["tests*", "tests.*", "tasks*", "tasks.*"]


[tool.setuptools.package-data]
"*" = ["LICENSE", "NOTICES"]
"pipenv.patched.safety" = ["VERSION", "safety-policy-template.yml"]
"pipenv.patched.pip._vendor.certifi" = ["*.pem"]
"pipenv.patched.pip._vendor.requests" = ["*.pem"]
"pipenv.patched.pip._vendor.distlib" = [
"t32.exe",
"t64.exe",
"w32.exe",
"w64.exe",
]
"pipenv.vendor.ruamel" = ["yaml"]


[tool.setuptools.dynamic]
version = {attr = "pipenv.__version__"}

kalebmckale marked this conversation as resolved.
Show resolved Hide resolved

## TESTING AND DEVELOPER CONFIGURATION BELOW ##

[tool.black]
line-length = 90
include = '\.pyi?$'
Expand All @@ -28,108 +113,119 @@ exclude = '''
)
'''


[tool.coverage.run]
parallel = true


[tool.mypy]
ignore_missing_imports = true
follow_imports = "skip"
html_report = "mypyhtml"
python_version = "3.7"
mypy_path = "typeshed/pyi:typeshed/imports"


[tool.pytest.ini_options]
addopts = "-ra"
plugins = "xdist"
testpaths = ["tests"]
# Add vendor and patched in addition to the default list of ignored dirs
# Additionally, ignore tasks, news, test subdirectories and peeps directory
norecursedirs = [
".*", "build",
"dist",
"CVS",
"_darcs",
"{arch}",
"*.egg",
"vendor",
"patched",
"news",
"tasks",
"docs",
"tests/test_artifacts",
"tests/pypi",
"peeps",
".*",
"build",
"dist",
"CVS",
"_darcs",
"{arch}",
"*.egg",
"vendor",
"patched",
"news",
"tasks",
"docs",
"tests/test_artifacts",
"tests/pypi",
"peeps",
]
filterwarnings = []
# These are not all the custom markers, but most of the ones with repeat uses
# `pipenv run pytest --markers` will list all markers including these
markers = [
"install: tests having to do with `pipenv install`",
"update: tests having to do with `pipenv update`",
"needs_internet: integration tests that require internet to pass",
"basic: basic pipenv tests grouping",
"dev: tests having to do with dev and dev packages",
"system: related or interacting with the os",
"utils: grouping of pipenv utility functions",
"cli: test grouping that relate to command line like `pipenv --flag args`",
"requirements: tests that save and alter pip requirements",
"run: tests that run or execute python through pipenv",
"script: grouping of tests that execute scripts",
"keep_outdated: when an activity is supposed to keep something out of date",
"lock: tests that interact with pipenv lock",
"markers: pipenv environment markers",
"vcs: tests integration with pipenv and vertsion control systems",
"project: tests with the project object",
"sync: related to `pipenv sync`",
"rrule: relating to rrules (as in recurring time)",
"tzoffset: timezone offset",
"gettz: tests with gettz (get timezone) from dateutil lib",
"tzstr: timezone string",
"extras",
"extended",
"ext: extra non-categorized tests",
"install: tests having to do with `pipenv install`",
"update: tests having to do with `pipenv update`",
"needs_internet: integration tests that require internet to pass",
"basic: basic pipenv tests grouping",
"dev: tests having to do with dev and dev packages",
"system: related or interacting with the os",
"utils: grouping of pipenv utility functions",
"cli: test grouping that relate to command line like `pipenv --flag args`",
"requirements: tests that save and alter pip requirements",
"run: tests that run or execute python through pipenv",
"script: grouping of tests that execute scripts",
"keep_outdated: when an activity is supposed to keep something out of date",
"lock: tests that interact with pipenv lock",
"markers: pipenv environment markers",
"vcs: tests integration with pipenv and vertsion control systems",
"project: tests with the project object",
"sync: related to `pipenv sync`",
"rrule: relating to rrules (as in recurring time)",
"tzoffset: timezone offset",
"gettz: tests with gettz (get timezone) from dateutil lib",
"tzstr: timezone string",
"extras",
"extended",
"ext: extra non-categorized tests",
]


[tool.ruff]
exclude = [
"pipenv/patched/*",
"pipenv/vendor/*",
"pipenv/patched/*",
"pipenv/vendor/*",
]
select = [
"ASYNC",
"B",
"C4",
"C90",
"E",
"F",
"FLY",
"G",
"I",
"ISC",
"PERF",
"PIE",
"PL",
"TID",
"UP",
"W",
"YTT"
"ASYNC",
"B",
"C4",
"C90",
"E",
"F",
"FLY",
"G",
"I",
"ISC",
"PERF",
"PIE",
"PL",
"TID",
"UP",
"W",
"YTT"
]
ignore = [
"B904",
"PIE790",
"PLR5501",
"PLW2901",
"B904",
"PIE790",
"PLR5501",
"PLW2901",
]
line-length = 137
target-version = "py37"


[tool.ruff.mccabe]
max-complexity = 44


[tool.ruff.pylint]
allow-magic-value-types = ["int", "str"]
max-args = 20
max-branches = 38
max-returns = 9
max-statements = 155


[tool.ruff.per-file-ignores]
"docs/conf.py" = ["E402", "E501"]
"get-pipenv.py" = ["E402"]
Expand All @@ -144,6 +240,7 @@ max-statements = 155
"tests/unit/test_funktools.py" = ["B015"]
"tests/unit/test_utils.py" = ["F811"]


[tool.towncrier]
package = "pipenv"
filename = "CHANGELOG.rst"
Expand Down
4 changes: 2 additions & 2 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ echo "pipenv run pypi-server run -v --host=0.0.0.0 --port=8080 --hash-algo=sha25

pipenv run pypi-server run -v --host=0.0.0.0 --port=8080 --hash-algo=sha256 --disable-fallback ./tests/pypi/ ./tests/fixtures &

echo "$pipenv run pytest -v -ra -n auto --cov-config setup.cfg --fulltrace tests"
echo "$pipenv run pytest -v -ra -n auto --cov-config pyproject.toml --fulltrace tests"

PIPENV_PYTHON=${PIPENV_PYTHON} ${PYTHON} -m pipenv run pytest -v -ra -n auto --cov-config setup.cfg --fulltrace tests
PIPENV_PYTHON=${PIPENV_PYTHON} ${PYTHON} -m pipenv run pytest -v -ra -n auto --cov-config pyproject.toml --fulltrace tests
7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

Loading