Skip to content

Commit 22ab7f6

Browse files
authored
Converted project from using pipenv to poetry (#98)
* Added pyyaml package to Pipfile Encountered an issue using `pipenv` after installing the packages associated with the project for a missing package. * Converted from pipenv to poetry The Dockerfiles have also been modified using the recommended install directions from the Poetry docs versus using pip to install poetry. * Updated Makefile for builds * Traced remaining references to pipenv in project Updated workflows in project to use Poetry. Changed portions of documentation to reflect change to poetry. * Updated workflows to use poetry post-install While poetry was successfully installing during the build, it was not loaded into the current environment's `PATH`s so this adds the command to load `poetry` into the active environment. * Updated linter to use modules imported via poetry `pipenv` with the `--system` argument was allowing for the packages to be installed at the system level versus in a virtualenv which resulted in `isort` throwing an error that the command did not exist. The workflow has been modified to invoke poetry to utilize `isort` and `black`. Additionally, the `setup.py` and `setup.cfg` files have been re-added back into this branch for compatibility. * Changed poetry to export requirements.txt for builds Using `pip` to install packages from poetry during build steps versus trying to use the venv since the venv is not being used post-install of packages through `poetry` * Linter modified cloudendure.py formatting * Fixed version and author information Added the appropriate `authors` and `version` to the `pyproject.toml` file for the project. * Versioned to 0.2.0 Bumped the version to `0.2.0` with the assumption that moving from `pipenv` to `poetry` is an impactful change to the project but not a breaking change to how the `cloudendure` module functions. The above context is driven using [Semantic Versioning](https://semver.org/). * Fixed poetry build and other recommendations applied - Cleaned up `setup.py` and `setup.cfg` - This was cruft left for mid-troubleshoot to resolve testing - Updated `Makefile` to use `poetry build` and `poetry publish` for project builds - Updated `API_README.md` in `docs` to reflect the change to the `poetry` from `pipenv` * Ported items from original config to toml file - Added `include`s for: - `CHANGELOG.md` - `CODE_OF_CONDUCT.md` - `REFERENCE.md` - `SECURITY.md` - Cleaned up error in `tool.poetry.dependencies` attempting to reference the project itself - `console scripts` have been ported for `cloudendure` and `ce` commands - `tool.isort` and `tool.yapf` sections from the original `setup.cfg` have been ported to the toml file * Added trailing comma to list in toml file * Preparation for moving to poetry from pipenv
1 parent 6c07fa0 commit 22ab7f6

16 files changed

Lines changed: 2331 additions & 1597 deletions

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ jobs:
2020
if: success()
2121
run: |
2222
python -m pip install --upgrade pip
23-
pip install pipenv
24-
pipenv install --dev --pre --system --deploy
23+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
24+
source $HOME/.poetry/env
25+
poetry export -f requirements.txt -o requirements.txt --dev
26+
pip install -r requirements.txt
2527
- name: Build with MkDocs
2628
if: success()
2729
run: pydocmd build

.github/workflows/lint-python.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
pip install setuptools wheel twine pipenv
26-
pipenv install --dev --pre --system --deploy
25+
pip install setuptools wheel twine
26+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
27+
source $HOME/.poetry/env
28+
poetry export -f requirements.txt -o requirements.txt --dev
29+
pip install -r requirements.txt
2730
- name: Check python imports with isort
2831
run: |
2932
isort --version-number

.github/workflows/pypi-publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ jobs:
2020
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
2121
run: |
2222
python -m pip install --upgrade pip
23-
pip install pipenv
24-
pipenv install --dev --pre --system --deploy
23+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
24+
source $HOME/.poetry/env
25+
poetry export -f requirements.txt -o requirements.txt --dev
26+
pip install -r requirements.txt
2527
- name: Build and publish the pypi package
2628
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
2729
run: python3 setup.py upload

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- stage: publish
1616
python: '3.7'
1717
script:
18-
- pipenv install --dev
18+
- poetry install
1919
- pydocmd build
2020
deploy:
2121
- provider: pages

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ RUN apt-get -qq install ${SYSTEM_PACKAGES}
1212
COPY . /app
1313

1414
RUN pip install --upgrade pip
15-
RUN pip install --upgrade wheel setuptools twine pipenv
16-
RUN pipenv install --dev --system --deploy
15+
RUN pip install --upgrade wheel setuptools twine
16+
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
17+
RUN source $HOME/.poetry/env
18+
RUN poetry install
1719

1820
RUN apt-get clean autoclean && \
1921
apt-get autoremove --yes && \

Dockerfile-py38

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ RUN apt-get -qq install ${SYSTEM_PACKAGES}
1010
COPY . /app
1111

1212
RUN pip install --upgrade pip
13-
RUN pip install --upgrade wheel setuptools twine pipenv
14-
RUN pipenv install --dev --system --deploy
13+
RUN pip install --upgrade wheel setuptools twine
14+
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
15+
RUN source $HOME/.poetry/env
16+
RUN poetry install
1517

1618
RUN apt-get clean autoclean && \
1719
apt-get autoremove --yes && \

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

Makefile

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,42 +55,43 @@ push: ## Push the Docker image to the Docker Hub repository.
5555
docker: build build_py38 ## Build and publish Docker images.
5656

5757
lint: isort ## Lint the CloudEndure project with Black.
58-
@pipenv run black --target-version py37 .
58+
@poetry run black --target-version py37 .
5959

6060
update_prereqs: ## Update the local development pre-requisite packages.
61-
@pip install --upgrade pipenv wheel setuptools pip
61+
@pip install --upgrade wheel setuptools pip
6262

6363
install-py-deps: update_prereqs ## Install the Python dependencies specified in the Pipfile.lock.
6464
@echo "Installing Python project dependencies..."
65-
@pipenv install --dev --pre
65+
@poetry install
6666
@echo "Python dependencies installed!"
6767

6868
init: ## Initialize the project.
69-
@pip install --upgrade pipenv wheel setuptools pip
70-
@pipenv install --dev --pre
69+
@pip install --upgrade wheel setuptools pip
70+
@curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
71+
@source $HOME/.poetry/env
72+
@poetry install
7173

7274
ci: ## Run the CI specific tests.
73-
@pipenv run py.test -n 8 --boxed --junitxml=report.xml
75+
@poetry run py.test -n 8 --boxed --junitxml=report.xml
7476

7577
flake8: ## Run Flake8 against the project.
76-
@pipenv run flake8 --ignore=E501,F401,E128,E402,E731,F821 cloudendure
78+
@poetry run flake8 --ignore=E501,F401,E128,E402,E731,F821 cloudendure
7779

7880
yapf: ## Run YAPF against the project.
79-
@pipenv run yapf cloudendure
81+
@poetry run yapf cloudendure
8082

8183
isort: ## Run isort against the project.
82-
@pipenv run isort -sp=setup.cfg -rc .
84+
@poetry run isort -sp=setup.cfg -rc .
8385

8486
coverage: ## Generate a test coverage report.
85-
pipenv run py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=cloudendure tests
87+
poetry run py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=cloudendure tests
8688

8789
publish: ## Publish the package to PyPi.
88-
pipenv run python3 setup.py sdist bdist_wheel
89-
pipenv run twine upload dist/*
90-
rm -fr build dist .egg requests.egg-info
90+
poetry build
91+
poetry publish
9192

9293
docs: ## Build the documentation.
93-
pipenv run pydocmd build
94+
poetry run pydocmd build
9495

9596
update_fork: ## Update the current fork master branch with upstream master.
9697
@echo "Updating the current fork with the upstream master branch..."
@@ -103,14 +104,14 @@ update_fork: ## Update the current fork master branch with upstream master.
103104
gen_client: ## Generate the swagger client from the API config.
104105
@swagger-codegen generate -i https://console.cloudendure.com/api_doc/apis.json -l python --model-name-prefix CloudEndure --git-user-id mbeacom --git-repo-id cloudendure-python -c reference/swagger_config.json -o gen/
105106

106-
update_deps: update_prereqs ## Update the package dependencies via pipenv.
107-
@pipenv update --pre --dev
107+
update_deps: update_prereqs ## Update the package dependencies via poetry.
108+
@poetry update
108109

109110
install: isort build_py ## Install the local development version of the module.
110-
@pipenv install .
111+
@poetry install .
111112

112113
build_py: update_deps ## Build and package the project for PyPi source and wheel distribution.
113-
@pipenv run python3 setup.py sdist bdist_wheel
114+
@poetry build
114115

115116
help: ## Show this help information.
116117
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-25s\033[0m %s\n", $$1, $$2}'

Pipfile

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

0 commit comments

Comments
 (0)