netlite 1.0.1__tar.gz → 1.0.2__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.
Files changed (28) hide show
  1. {netlite-1.0.1 → netlite-1.0.2}/PKG-INFO +1 -1
  2. netlite-1.0.2/package_build.py +34 -0
  3. netlite-1.0.2/package_run_tests.py +11 -0
  4. netlite-1.0.2/package_upload.py +77 -0
  5. {netlite-1.0.1 → netlite-1.0.2}/pyproject.toml +1 -1
  6. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/layers.py +4 -3
  7. netlite-1.0.1/package_build.py +0 -27
  8. netlite-1.0.1/package_run_tests.sh +0 -1
  9. netlite-1.0.1/package_upload.py +0 -44
  10. {netlite-1.0.1 → netlite-1.0.2}/.gitignore +0 -0
  11. {netlite-1.0.1 → netlite-1.0.2}/LICENSE +0 -0
  12. {netlite-1.0.1 → netlite-1.0.2}/README.md +0 -0
  13. {netlite-1.0.1 → netlite-1.0.2}/examples/netlite_example_fit_regression_line.py +0 -0
  14. {netlite-1.0.1 → netlite-1.0.2}/examples/netlite_example_lenet_cifar10.py +0 -0
  15. {netlite-1.0.1 → netlite-1.0.2}/examples/netlite_example_lenet_mnist.py +0 -0
  16. {netlite-1.0.1 → netlite-1.0.2}/examples/netlite_example_xor_classifier.py +0 -0
  17. {netlite-1.0.1 → netlite-1.0.2}/images/lenet_mnist_acc_curves.svg +0 -0
  18. {netlite-1.0.1 → netlite-1.0.2}/images/logo_netlite.png +0 -0
  19. {netlite-1.0.1 → netlite-1.0.2}/requirements.txt +0 -0
  20. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/__init__.py +0 -0
  21. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/dataloader_cifar10.py +0 -0
  22. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/dataloader_mnist.py +0 -0
  23. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/loss_functions.py +0 -0
  24. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/neural_network.py +0 -0
  25. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/numba_optional.py +0 -0
  26. {netlite-1.0.1 → netlite-1.0.2}/src/netlite/optimizer.py +0 -0
  27. {netlite-1.0.1 → netlite-1.0.2}/tests/test_convolution.py +0 -0
  28. {netlite-1.0.1 → netlite-1.0.2}/tests/test_netlite.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: netlite
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A small white-box training framework for neural networks for education.
5
5
  Project-URL: Homepage, https://github.com/haho12/netlite
6
6
  Project-URL: Issues, https://github.com/haho12/netlite/issues
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env python
2
+ import tomllib
3
+ import requests
4
+ from packaging.version import Version
5
+ import sys
6
+ import subprocess
7
+
8
+ def build_package(require_new_version=True):
9
+ PACKAGE_NAME = "netlite"
10
+
11
+ # 1. Read local version from pyproject.toml
12
+ with open("pyproject.toml", "rb") as f:
13
+ pyproject = tomllib.load(f)
14
+
15
+ local_version = pyproject["project"]["version"]
16
+
17
+ # 2. Get latest version from PyPI
18
+ url = f"https://pypi.org/pypi/{PACKAGE_NAME}/json"
19
+ pypi_version = requests.get(url, timeout=10).json()["info"]["version"]
20
+
21
+ # 3. Compare
22
+ print("version in pyproject.toml: ", local_version)
23
+ print("version on pypi.org: ", pypi_version)
24
+ if Version(local_version) <= Version(pypi_version) and require_new_version:
25
+ print("Error: Local version must be increased for a new build")
26
+ return False
27
+
28
+ subprocess.run(['rm', '-rf', 'dist'])
29
+ subprocess.run(['python', '-m', 'build'])
30
+
31
+ return True
32
+
33
+ if __name__ == '__main__':
34
+ build_package(require_new_version=False)
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python
2
+ import subprocess
3
+ import sys
4
+
5
+ def run_tests():
6
+ result = subprocess.run([sys.executable, "-m", "pytest", "tests/", "-v"]) # ensures python interpreter in venv
7
+ return result.returncode == 0
8
+
9
+ if __name__ == '__main__':
10
+ success = run_tests()
11
+ print("Tests passed:", success)
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env python
2
+ import tomllib
3
+ import requests
4
+ from packaging.version import Version
5
+ import sys
6
+ import subprocess
7
+
8
+ from package_run_tests import run_tests
9
+ from package_build import build_package
10
+
11
+ PACKAGE_NAME = "netlite"
12
+
13
+ # Steps:
14
+ # - run pytest
15
+ # - build (with new release number)
16
+ # - push to github (with release tag)
17
+ # - upload to pipy
18
+
19
+ def git_tag_and_push():
20
+ # Check code is fully committed in git
21
+ status = subprocess.run(
22
+ ["git", "status", "--porcelain"],
23
+ capture_output=True,
24
+ text=True,
25
+ check=True
26
+ ).stdout.strip()
27
+
28
+ if status:
29
+ print("Error: Working tree is dirty. Commit or stash your changes first.")
30
+ print(status)
31
+ return False
32
+
33
+ subprocess.run(['git', 'push']) # push commits
34
+
35
+ # 1. Read local version from pyproject.toml
36
+ with open("pyproject.toml", "rb") as f:
37
+ pyproject = tomllib.load(f)
38
+
39
+ local_version = pyproject["project"]["version"]
40
+
41
+ # 2. Get latest version from PyPI
42
+ #url = f"https://pypi.org/pypi/{PACKAGE_NAME}/json"
43
+ #pypi_version = requests.get(url, timeout=10).json()["info"]["version"]
44
+
45
+ # 3. Get latest git tag
46
+ git_tag = subprocess.run(
47
+ ["git", "describe", "--tags", "--abbrev=0"],
48
+ capture_output=True,
49
+ text=True,
50
+ check=True
51
+ ).stdout.strip()
52
+ # strip leading "v" (v1.2.3 → 1.2.3)
53
+ git_version = git_tag.lstrip("v")
54
+
55
+ # 4. Compare
56
+ print("version in pyproject.toml: ", local_version)
57
+ print("version in git tag: ", git_version)
58
+ #print("version on pypi.org: ", pypi_version)
59
+ if Version(git_version) < Version(local_version):
60
+ git_tag_new = 'v' + local_version
61
+ print(f"Info: Updating git tag to '{git_tag_new}'")
62
+ subprocess.run(['git', 'tag', git_tag_new])
63
+ subprocess.run(['git', 'push', 'origin', git_tag_new]) # push new tag
64
+
65
+ success = run_tests()
66
+ if not success:
67
+ sys.exit()
68
+
69
+ success = build_package(require_new_version=True)
70
+ if not success:
71
+ sys.exit()
72
+
73
+ success = git_tag_and_push()
74
+ if not success:
75
+ sys.exit()
76
+
77
+ #subprocess.run(['twine', 'upload', 'dist/*'])
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "netlite"
7
- version = "1.0.1"
7
+ version = "1.0.2"
8
8
  authors = [
9
9
  { name="Hanno Homann", email="hanno.homann@example.com" },
10
10
  ]
@@ -18,9 +18,10 @@ class Layer(ABC):
18
18
  def print(self, Xin):
19
19
  '''Print layer properties.'''
20
20
  Xout = self.forward(Xin)
21
- print(f'- {self.__class__.__name__}:')
22
- print(f' - in =(:, {', '.join(str(s) for s in Xin.shape[1:])})')
23
- print(f' - out=(:, {', '.join(str(s) for s in Xout.shape[1:])})')
21
+ print(f"- {self.__class__.__name__}:")
22
+ print(f" - in =(:, {', '.join(str(s) for s in Xin.shape[1:])})")
23
+ print(f" - out=(:, {', '.join(str(s) for s in Xout.shape[1:])})")
24
+
24
25
  return Xout
25
26
 
26
27
  def get_weights(self):
@@ -1,27 +0,0 @@
1
- import tomllib
2
- import requests
3
- from packaging.version import Version
4
- import sys
5
- import subprocess
6
-
7
- PACKAGE_NAME = "netlite"
8
-
9
- # 1. Read local version from pyproject.toml
10
- with open("pyproject.toml", "rb") as f:
11
- pyproject = tomllib.load(f)
12
-
13
- local_version = pyproject["project"]["version"]
14
-
15
- # 2. Get latest version from PyPI
16
- url = f"https://pypi.org/pypi/{PACKAGE_NAME}/json"
17
- pypi_version = requests.get(url, timeout=10).json()["info"]["version"]
18
-
19
- # 3. Compare
20
- print("version in pyproject.toml: ", local_version)
21
- print("version on pypi.org: ", pypi_version)
22
- if Version(local_version) <= Version(pypi_version):
23
- print("Error: Local version must be increased for a new build")
24
- sys.exit()
25
-
26
- subprocess.run(['rm', '-rf', 'dist'])
27
- subprocess.run(['python', '-m', 'build'])
@@ -1 +0,0 @@
1
- pytest tests/ -v
@@ -1,44 +0,0 @@
1
- import tomllib
2
- import requests
3
- from packaging.version import Version
4
- import sys
5
- import subprocess
6
-
7
- PACKAGE_NAME = "netlite"
8
-
9
- # 1. Read local version from pyproject.toml
10
- with open("pyproject.toml", "rb") as f:
11
- pyproject = tomllib.load(f)
12
-
13
- local_version = pyproject["project"]["version"]
14
-
15
- # 2. Get latest version from PyPI
16
- url = f"https://pypi.org/pypi/{PACKAGE_NAME}/json"
17
- pypi_version = requests.get(url, timeout=10).json()["info"]["version"]
18
-
19
- # 3. Get latest git tag
20
- git_tag = subprocess.run(
21
- ["git", "describe", "--tags", "--abbrev=0"],
22
- capture_output=True,
23
- text=True,
24
- check=True
25
- ).stdout.strip()
26
- # strip leading "v" (v1.2.3 → 1.2.3)
27
- git_version = git_tag.lstrip("v")
28
-
29
- # 4. Compare
30
- print("version in pyproject.toml: ", local_version)
31
- print("version in git tag: ", git_version)
32
- print("version on pypi.org: ", pypi_version)
33
- if Version(git_version) < Version(local_version):
34
- git_tag_new = 'v' + local_version
35
- print(f"Info: Updating git tag to '{git_tag_new}'")
36
- subprocess.run(['git', 'tag', git_tag_new])
37
-
38
- sys.exit()
39
-
40
- #subprocess.run(['rm', '-rf', 'dist'])
41
- subprocess.run(['python', '-m', 'build'])
42
-
43
-
44
- #twine upload dist/*
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes