modernpackage 0.0.1.dev2__tar.gz → 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: modernpackage
3
- Version: 0.0.1.dev2
4
- Summary: Example package configuration using bleeding edge toolset
3
+ Version: 0.0.3
4
+ Summary: Package configuration example using bleeding edge toolset.
5
5
  Project-URL: homepage, https://github.com/albertas/modernpackage
6
- Author-email: Albertas Gimbutas <albertasgim@gmail.com>
6
+ Author-email: Name Surname <email@example.com>
7
7
  Classifier: Development Status :: 3 - Alpha
8
8
  Classifier: License :: OSI Approved :: MIT License
9
9
  Classifier: Natural Language :: English
@@ -22,16 +22,18 @@ Requires-Dist: ruff; extra == 'test'
22
22
  Description-Content-Type: text/markdown
23
23
 
24
24
  # modernpackage
25
- This package is configured using bleeding edge toolset and serves as an
26
- example/starting point for another new packages.
25
+ This is a boilerplate with bleeding edge linters for a new python package, just run:
26
+ - `git clone git@github.com:albertas/modernpackage.git <your-package-name>`
27
+ - `cd <your-package-name>`
28
+ - `make init <your-package-name>` - to start your modern package.
27
29
 
28
30
  ## Development
29
31
  Commonly used commands for package development:
30
- `make check` - run unit tests and linters.
31
- `make fix` - format code and fix detected fixable issues.
32
- `make publish` - publishes current package version to pypi.org.
33
- `make compile` - bump and freeze dependency versions in requirements*.txt files
34
- `make sync` - upgrade installed dependencies in Virtual Environment (executed after `make compile`)
32
+ - `make check` - run unit tests and linters.
33
+ - `make fix` - format code and fix detected fixable issues.
34
+ - `make publish` - publishes current package version to pypi.org.
35
+ - `make compile` - bump and freeze dependency versions in requirements*.txt files
36
+ - `make sync` - upgrade installed dependencies in Virtual Environment (executed after `make compile`)
35
37
 
36
38
  ## Toolset
37
39
  This package uses these cutting edge tools:
@@ -45,3 +47,12 @@ This package uses these cutting edge tools:
45
47
  - uv - for Python virtual environment and dependency management
46
48
  - pyproject.toml - configuration file for all tools
47
49
  - Makefile - aliases for commonly used command line commands
50
+
51
+ ## Feature requests:
52
+ - make a cli command: this package should be installable. Ideally this flow should work:
53
+ - `pip install modernpackage`
54
+ - `modernpackage mynewpackage`
55
+ - `cd mynewpackage` && `make check` && `make publish`
56
+ - Enable github and gitlab pipeline files to run `make check` in the pipeline.
57
+ - Add pre-commit hooks with all the tools enabled.
58
+ - codspeed.io could be considered for Continuous integration pipeline
@@ -0,0 +1,35 @@
1
+ # modernpackage
2
+ This is a boilerplate with bleeding edge linters for a new python package, just run:
3
+ - `git clone git@github.com:albertas/modernpackage.git <your-package-name>`
4
+ - `cd <your-package-name>`
5
+ - `make init <your-package-name>` - to start your modern package.
6
+
7
+ ## Development
8
+ Commonly used commands for package development:
9
+ - `make check` - run unit tests and linters.
10
+ - `make fix` - format code and fix detected fixable issues.
11
+ - `make publish` - publishes current package version to pypi.org.
12
+ - `make compile` - bump and freeze dependency versions in requirements*.txt files
13
+ - `make sync` - upgrade installed dependencies in Virtual Environment (executed after `make compile`)
14
+
15
+ ## Toolset
16
+ This package uses these cutting edge tools:
17
+ - ruff - for linting and code formatting
18
+ - mypy - for type checking
19
+ - pip-audit - for known vulnerability detection in dependencies
20
+ - deadcode - for unused code detection
21
+ - pytest - for collecting and running unit tests
22
+ - coverage - for code coverage by unit tests
23
+ - hatch - for publishing package to pypi.org
24
+ - uv - for Python virtual environment and dependency management
25
+ - pyproject.toml - configuration file for all tools
26
+ - Makefile - aliases for commonly used command line commands
27
+
28
+ ## Feature requests:
29
+ - make a cli command: this package should be installable. Ideally this flow should work:
30
+ - `pip install modernpackage`
31
+ - `modernpackage mynewpackage`
32
+ - `cd mynewpackage` && `make check` && `make publish`
33
+ - Enable github and gitlab pipeline files to run `make check` in the pipeline.
34
+ - Add pre-commit hooks with all the tools enabled.
35
+ - codspeed.io could be considered for Continuous integration pipeline
@@ -1 +1,3 @@
1
1
  """Example package configuration using bleeding edge toolset."""
2
+
3
+ __version__ = '0.0.3'
@@ -0,0 +1,42 @@
1
+ """Example package configuration using bleeding edge toolset."""
2
+
3
+ from argparse import ArgumentParser, Namespace
4
+ from modernpackage import __version__
5
+ from subprocess import Popen, PIPE
6
+ import os
7
+
8
+
9
+ def parse_args() -> Namespace:
10
+ parser = ArgumentParser()
11
+ parser.add_argument('-v', '--version', help='Show package version.',
12
+ action='store_true', default=False)
13
+ parser.add_argument('package_name', help='Name of a new pacakge to initialise in a local directory.', nargs='?')
14
+ parsed_args = parser.parse_args()
15
+ return parsed_args
16
+
17
+
18
+ def init_new_package(package_name: str) -> None:
19
+ """Copy this package file to current dir as `package_name` and run `make init` in it."""
20
+
21
+ from_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
22
+ new_package_path = os.path.join(os.getcwd(), package_name)
23
+
24
+ print("Copying files from", from_path, "to", new_package_path, "..")
25
+ pipe = Popen(["cp", "-r", from_path, new_package_path], stdin=PIPE, stdout=PIPE)
26
+ pipe.communicate()[0]
27
+
28
+ pipe = Popen(["make", "init", package_name], stdin=PIPE, stdout=PIPE, cwd=new_package_path)
29
+ output = pipe.communicate()[0].decode()
30
+ print(output)
31
+
32
+
33
+ def main() -> None:
34
+ """Return 'Hello world!' or package version if -v option is provided."""
35
+
36
+ parsed_args = parse_args()
37
+
38
+ if parsed_args.version:
39
+ print(f"modernpackage {__version__}")
40
+
41
+ elif parsed_args.package_name:
42
+ init_new_package(package_name=parsed_args.package_name)
@@ -1,10 +1,9 @@
1
1
  [project]
2
2
  name = "modernpackage"
3
- version = "0.0.1.dev2"
4
3
  authors = [
5
- {name = "Albertas Gimbutas", email = "albertasgim@gmail.com"},
4
+ {name = "Name Surname", email = "email@example.com"},
6
5
  ]
7
- description = "Example package configuration using bleeding edge toolset"
6
+ description = "Package configuration example using bleeding edge toolset."
8
7
  readme = "README.md"
9
8
  requires-python = ">= 3.11"
10
9
  classifiers = [
@@ -15,13 +14,15 @@ classifiers = [
15
14
  "Programming Language :: Python",
16
15
  "Programming Language :: Python :: 3.11",
17
16
  ]
18
- dependencies = [
19
- ]
20
-
17
+ dynamic = ["version"]
18
+ dependencies = []
21
19
 
22
20
  [project.urls]
23
21
  homepage = "https://github.com/albertas/modernpackage"
24
22
 
23
+ [project.scripts]
24
+ modernpackage = "modernpackage.main:main"
25
+
25
26
  [project.optional-dependencies]
26
27
  test = [
27
28
  "hatch",
@@ -33,6 +34,8 @@ test = [
33
34
  "pytest-cov",
34
35
  ]
35
36
 
37
+ [tool.pytest.ini_options]
38
+ addopts = "--cov=. --no-cov-on-fail --cov-fail-under=90.0"
36
39
 
37
40
  [build-system]
38
41
  requires = ["hatchling"]
@@ -42,6 +45,8 @@ build-backend = "hatchling.build"
42
45
  include = ["**/*.py"]
43
46
  exclude = ["tests/**"]
44
47
 
48
+ [tool.hatch.version]
49
+ path = "modernpackage/__init__.py"
45
50
 
46
51
  [tool.ruff] # https://docs.astral.sh/ruff/settings/
47
52
  line-length = 88
@@ -56,18 +61,18 @@ docstring-code-format = true
56
61
  [tool.ruff.lint]
57
62
  select = ["ALL"]
58
63
  ignore = [
59
- "D203", # one-blank-line-before-class
60
- "D213", # multi-line-summary-second-line
61
- "COM812", # missing-trailing-comma
62
- "ISC001", # single-line-implicit-string-concatenation
64
+ "D203", # one blank line before class
65
+ "D213", # multi line summary second line
66
+ "COM812", # missing trailing comma
67
+ "ISC001", # single line implicit string concatenation
63
68
  "ANN101", # deprecated requirement to annotate self
64
69
  ]
65
70
 
66
71
  [tool.ruff.lint.per-file-ignores]
67
- "tests/*" = ["S101", "D"] # allow asserts and no docs in tests
72
+ "tests/*" = ["S101", "D"] # allow assert and no docs in tests
68
73
 
69
74
  [tool.mypy]
70
- exclude = ["build", "dist", ".venv", "tests"]
75
+ exclude = ["build", "dist", ".venv"]
71
76
  python_version = "3.11"
72
77
  strict = true
73
78
  pretty = true
@@ -76,9 +81,6 @@ show_error_codes = true
76
81
  warn_return_any = true
77
82
  warn_unused_configs = true
78
83
 
79
- [tool.pytest.ini_options]
80
- addopts = "--cov=. --no-cov-on-fail --cov-fail-under=90.0"
81
-
82
84
  [tool.deadcode]
83
85
  ignore_names = [
84
86
  "main",
@@ -1,24 +0,0 @@
1
- # modernpackage
2
- This package is configured using bleeding edge toolset and serves as an
3
- example/starting point for another new packages.
4
-
5
- ## Development
6
- Commonly used commands for package development:
7
- `make check` - run unit tests and linters.
8
- `make fix` - format code and fix detected fixable issues.
9
- `make publish` - publishes current package version to pypi.org.
10
- `make compile` - bump and freeze dependency versions in requirements*.txt files
11
- `make sync` - upgrade installed dependencies in Virtual Environment (executed after `make compile`)
12
-
13
- ## Toolset
14
- This package uses these cutting edge tools:
15
- - ruff - for linting and code formatting
16
- - mypy - for type checking
17
- - pip-audit - for known vulnerability detection in dependencies
18
- - deadcode - for unused code detection
19
- - pytest - for collecting and running unit tests
20
- - coverage - for code coverage by unit tests
21
- - hatch - for publishing package to pypi.org
22
- - uv - for Python virtual environment and dependency management
23
- - pyproject.toml - configuration file for all tools
24
- - Makefile - aliases for commonly used command line commands
@@ -1,6 +0,0 @@
1
- """Example package configuration using bleeding edge toolset."""
2
-
3
-
4
- def main() -> str:
5
- """Return 'Hello world'."""
6
- return 'Hello world'