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

Use Poetry in awssh #26

Draft
wants to merge 6 commits into
base: develop
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
4 changes: 4 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
}
1,160 changes: 1,160 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[tool.poetry]
name = "awssh"
version = "1.1.0"
description = "A tool that simplifies secure shell connections over AWS Systems Manager"
authors = ["Cybersecurity and Infrastructure Security Agency"]
license = "CC0 1.0 Universal (CC0 1.0) Public Domain Dedication"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.9"
boto3 = "^1.28.6"
docopt = "^0.6.2"
schema = "^0.7.5"

[tool.poetry.group.dev.dependencies]
boto3-stubs = "^1.28.5"
coverage = "^7.2.7"
coveralls = "!= 1.11.0"
pre-commit = "^3.3.3"
pytest-cov = "^4.1.0"
pytest = "^7.4.0"
types-docopt = "^0.6.11.3"
types-requests = "^2.31.0.1"
Comment on lines +15 to +23
Copy link
Member

@jsf9k jsf9k Jul 20, 2023

Choose a reason for hiding this comment

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

We previously had (via the requirements*.txt files and setup.py) installation, testing, and development modes. (Dev packages are a superset of the testing packages which are themselves a superset of the installation packages.) Is that not possible in Poetry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How does poetry compare with pipenv? Do we have an indication as to what will likely become the standard tool?
Poetry will create and manage a virtual env for you. It's faster than pipenv and is better at resolving dependencies. https://python-poetry.org/docs/managing-environments/

We previously had (via the requirements*.txt files and setup.py) installation, testing, and development installations. (Dev packages are a superset of the testing packages which are themselves a superset of the installation packages.) Is that not possible in Poetry?

Yes this is possible. We can group them just like the above. Something like: poetry add pytest@latest --group dev And then it will create a section in the toml for dev dependencies or testing if you want based on specification.



[tool.poetry.scripts]
awssh = 'awssh.awssh:main'
_awssh-completer = 'awssh.autocompleter:main'

[tool.pytest.ini_options]
addopts = "-v -ra --cov"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
2 changes: 0 additions & 2 deletions pytest.ini

This file was deleted.

4 changes: 0 additions & 4 deletions requirements-dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements-test.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

193 changes: 0 additions & 193 deletions setup-env

This file was deleted.

122 changes: 0 additions & 122 deletions setup.py

This file was deleted.

10 changes: 10 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {

buildInputs = [
pkgs.python3
pkgs.poetry
];

}