Skip to content

Commit

Permalink
Merge pull request #48 from DataChefHQ/feat/python-poetry
Browse files Browse the repository at this point in the history
refactor: switch main package manager to Poetry.
  • Loading branch information
shahinism committed Sep 10, 2024
2 parents 3936573 + 3d92ccf commit f921259
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 51 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ ipython_config.py
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# Poetry
poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

Expand Down
10 changes: 9 additions & 1 deletion copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ python_version:
type: str
help: "Required Python version:"
default: ">=3.11"
when: "{{ language == 'Python' }}"
when: "{{ language == 'Python' }}"

python_package_manager:
type: str
help: "Package Manager:"
choices:
- Poetry
- PDM
when: "{{ language == 'Python' }}"

project_license:
type: str
Expand Down
30 changes: 15 additions & 15 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1720853497,
"lastModified": 1725637114,
"owner": "cachix",
"repo": "devenv",
"rev": "7f569a0f2473b9f6000fd9e4c32511fd1b0d37c1",
"treeHash": "4d452ecc8223834e39d507f9ea92308f007ee05d",
"rev": "c31e347a96dbb7718a0279afa993752a7dfc6a39",
"treeHash": "e0dfcbbfb0974603336900406b364bd4d1308fa4",
"type": "github"
},
"original": {
Expand Down Expand Up @@ -95,11 +95,11 @@
]
},
"locked": {
"lastModified": 1720642556,
"lastModified": 1724996935,
"owner": "nlewo",
"repo": "nix2container",
"rev": "3853e5caf9ad24103b13aa6e0e8bcebb47649fe4",
"treeHash": "a9c2f1d3f52f288515ca0fb11f9aed970fd869b6",
"rev": "fa6bb0a1159f55d071ba99331355955ae30b3401",
"treeHash": "a934d246fadcf8b36d28f3577fad413f5ab3f7d3",
"type": "github"
},
"original": {
Expand All @@ -110,11 +110,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725194671,
"lastModified": 1725816686,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b833ff01a0d694b910daca6e2ff4a3f26dee478c",
"treeHash": "bb5efa178da5cad3d41f9557a800b8fa3033c1f5",
"rev": "add0443ee587a0c44f22793b8c8649a0dbc3bb00",
"treeHash": "621fcf9b0d86811bd99b99447146defeb8f41ca0",
"type": "github"
},
"original": {
Expand All @@ -126,11 +126,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720954236,
"lastModified": 1725693463,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "53e81e790209e41f0c1efa9ff26ff2fd7ab35e27",
"treeHash": "ca1f1273cf201da604f7c704535d4b7fac62cdb2",
"rev": "68e7dce0a6532e876980764167ad158174402c6f",
"treeHash": "ee872ee4d2426a6c3e1e4b3fa844550ce1b52b29",
"type": "github"
},
"original": {
Expand All @@ -150,11 +150,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1721042469,
"lastModified": 1725513492,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
"treeHash": "91f40b7a3b9f6886bd77482cba5b5cd890415a2e",
"rev": "7570de7b9b504cfe92025dd1be797bf546f66528",
"treeHash": "4b46d77870afecd8f642541cb4f4927326343b59",
"type": "github"
},
"original": {
Expand Down
32 changes: 18 additions & 14 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
...
}:

let
python-packages =
p: with p; [
pip
python-lsp-server
epc
black
];
in
{
name = "inception";

Expand All @@ -19,6 +28,9 @@
bat
jq
tealdeer

# Python Dependencies
(python3.withPackages python-packages)
];

# This script is temporary due to two problems:
Expand All @@ -40,31 +52,23 @@

languages.python = {
enable = true;
venv = {
poetry = {
enable = true;
requirements = ''
pdm
python-lsp-server[all]
pylint
importmagic
epc
'';
activate.enable = true;
install.enable = true;
install.allExtras = true;
install.groups = [ "dev" ];
};
};

enterShell = ''
pdm install --no-self
'';

# Make diffs fantastic
difftastic.enable = true;

# https://devenv.sh/pre-commit-hooks/
pre-commit.hooks = {
black.enable = true;
nixfmt = {
nixfmt-rfc-style = {
enable = true;
package = pkgs.nixfmt-rfc-style;
excludes = [ ".devenv.flake.nix" ];
};
yamllint = {
Expand Down
38 changes: 17 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
[project]
[tool.poetry]
name = "inception"
description = "Default template for PDM package"
authors = [
{name = "Reza (Shahin) Khanipour", email = "shahin@DataChef.co"},
]
dependencies = [
"copier>=9.3.1",
]
requires-python = ">=3.11.0"
version = "0.1.0"
description = "DataChef's project kickstarter! Reproducible, Declarative and Reliable development environments."
authors = ["Reza (Shahin) Khanipour <Shahin@DataChef.co>"]
readme = "README.md"
license = {text = "MIT"}
dynamic = ["version"]
packages = [
{ include = "iception", from = "src" },
]

[tool.pdm]
distribution = false
path = "src/inception/__init__.py"
[tool.poetry.dependencies]
python = ">=3.11"
copier = "^9.3.1"

[tool.pdm.version]
source = "scm"
[tool.poetry.group.dev.dependencies]
commitizen = "^3.29.0"
pdbpp = "^0.10.3"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pdm.dev-dependencies]
dev = [
"Commitizen>=3.28.0",
"pdbpp>=0.10.3",
]
[tool.commitizen]
version = "1.0.0"
update_changelog_on_bump = true
Expand Down
Loading

0 comments on commit f921259

Please sign in to comment.