Skip to content

Commit fb4560c

Browse files
firilisinofalan-barzilay
authored andcommitted
Migrating the packaging system to poetry with pyproject.toml
- Deleted old setup files `requirements.txt`, `setup.cfg`, `setup.py`, `MANIFEST.in` - Added poetry files `poetry.toml`, `pyproject.toml`, `poetry.lock` - Added `.pyenv-version` and `.tool-versions` for `pyenv` and `asdf` - Updated `Makefile`, `CONTRIBUTING.rst`, `tox.ini`
1 parent 368e9ae commit fb4560c

12 files changed

+887
-105
lines changed

.python-version

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
3.11
2+
3.10
3+
3.9
4+
3.8
5+
pypy3.9-7.3.12

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python 3.11 3.10 3.9 3.8 pypy3.9-7.3.12
2+

CONTRIBUTING.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ Ready to contribute? Here's how to set up `pipreqs` for local development.
6161
2. Clone your fork locally::
6262

6363
$ git clone [email protected]:your_name_here/pipreqs.git
64+
$ cd pipreqs/
6465

65-
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
66+
3. Pipreqs is developed using Poetry. Refer to the `documentation <https://python-poetry.org/docs/>`_ to install Poetry in your local environment. Next, you should install pipreqs's dependencies::
6667

67-
$ mkvirtualenv pipreqs
68-
$ cd pipreqs/
69-
$ python setup.py develop
68+
$ poetry install --with dev
7069

7170
4. Create a branch for local development::
7271

@@ -76,11 +75,11 @@ Ready to contribute? Here's how to set up `pipreqs` for local development.
7675

7776
5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
7877

79-
$ flake8 pipreqs tests
80-
$ python setup.py test
81-
$ tox
82-
83-
To get flake8 and tox, just pip install them into your virtualenv.
78+
$ poetry run flake8 pipreqs tests
79+
$ poetry run python -m unittest discover
80+
$ poetry run tox
81+
82+
To test all versions of python using tox you need to have them installed and for this two options are recommended: `pyenv` or `asdf`.
8483

8584
6. Commit your changes and push your branch to GitHub::
8685

@@ -99,7 +98,7 @@ Before you submit a pull request, check that it meets these guidelines:
9998
2. If the pull request adds functionality, the docs should be updated. Put
10099
your new functionality into a function with a docstring, and add the
101100
feature to the list in README.rst.
102-
3. The pull request should work for Python 3.7 to 3.11, and PyPy. Check
101+
3. The pull request should work for currently supported Python and PyPy versions. Check
103102
https://travis-ci.org/bndr/pipreqs/pull_requests and make sure that the
104103
tests pass for all supported Python versions.
105104

@@ -108,4 +107,4 @@ Tips
108107

109108
To run a subset of tests::
110109

111-
$ python -m unittest tests.test_pipreqs
110+
$ poetry run python -m unittest tests.test_pipreqs

MANIFEST.in

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

Makefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ help:
66
@echo "clean-pyc - remove Python file artifacts"
77
@echo "clean-test - remove test and coverage artifacts"
88
@echo "lint - check style with flake8"
9-
@echo "test - run tests quickly with the default Python"
9+
@echo "test - run tests quickly using the default Python"
1010
@echo "test-all - run tests on every Python version with tox"
1111
@echo "coverage - check code coverage quickly with the default Python"
1212
@echo "docs - generate Sphinx HTML documentation, including API docs"
13-
@echo "release - package and upload a release"
14-
@echo "dist - package"
15-
@echo "install - install the package to the active Python's site-packages"
13+
@echo "publish - package and upload a release"
14+
@echo "publish-to-test - package and upload a release to test-pypi"
15+
@echo "build - build the package"
16+
@echo "install - install the dependencies into the Poetry virtual environment"
1617

1718
clean: clean-build clean-pyc clean-test
1819

@@ -35,14 +36,13 @@ clean-test:
3536
rm -fr htmlcov/
3637

3738
lint:
38-
flake8 pipreqs tests
39+
poetry run flake8 pipreqs tests
3940

4041
test:
41-
pip install -r requirements.txt
42-
python setup.py test
42+
poetry run python -m unittest discover
4343

4444
test-all:
45-
tox
45+
poetry run tox
4646

4747
coverage:
4848
coverage run --source pipreqs setup.py test
@@ -58,13 +58,14 @@ docs:
5858
$(MAKE) -C docs html
5959
open docs/_build/html/index.html
6060

61-
release: clean
62-
python setup.py sdist bdist_wheel upload -r pypi
61+
publish: build
62+
poetry publish
6363

64-
dist: clean
65-
python setup.py sdist
66-
python setup.py bdist_wheel
67-
ls -l dist
64+
publish-to-test: build
65+
poetry publish --repository test-pypi
66+
67+
build: clean
68+
poetry build
6869

6970
install: clean
70-
python setup.py install
71+
poetry install --with dev

poetry.lock

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

poetry.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[virtualenvs]
2+
prefer-active-python = true

pyproject.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[tool.poetry]
2+
name = "pipreqs"
3+
version = "0.4.13"
4+
description = "Pip requirements.txt generator based on imports in project"
5+
authors = ["Vadim Kravcenko <[email protected]>"]
6+
license = "Apache-2.0"
7+
readme = ["README.rst", "HISTORY.rst"]
8+
packages = [{include = "pipreqs"}]
9+
repository = "https://github.com/bndr/pipreqs"
10+
keywords = ["pip", "requirements", "imports"]
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Intended Audience :: Developers",
14+
"License :: OSI Approved :: Apache Software License",
15+
"Natural Language :: English",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11"
21+
]
22+
23+
[tool.poetry.scripts]
24+
pipreqs = "pipreqs.pipreqs:main"
25+
26+
[tool.poetry.dependencies]
27+
python = ">=3.8.1,<3.12"
28+
yarg = "0.1.9"
29+
docopt = "0.6.2"
30+
31+
[tool.poetry.group.dev.dependencies]
32+
flake8 = "^6.1.0"
33+
tox = "^4.11.3"
34+
coverage = "^7.3.2"
35+
sphinx = { version = "^7.2.6", python = ">=3.9" }
36+
37+
[build-system]
38+
requires = ["poetry-core"]
39+
build-backend = "poetry.core.masonry.api"

requirements.txt

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

setup.cfg

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

setup.py

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

tox.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[tox]
2+
isolated_build = true
23
envlist = py38, py39, py310, py311, pypy3, flake8
34

45
[gh-actions]
@@ -12,9 +13,7 @@ python =
1213
[testenv]
1314
setenv =
1415
PYTHONPATH = {toxinidir}:{toxinidir}/pipreqs
15-
commands = python setup.py test
16-
deps =
17-
-r{toxinidir}/requirements.txt
16+
commands = python -m unittest discover
1817

1918
[flake8]
2019
exclude =

0 commit comments

Comments
 (0)