jrpyprogramming 0.2.2__tar.gz → 0.2.5__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 (27) hide show
  1. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/PKG-INFO +4 -5
  2. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/__init__.py +0 -1
  3. jrpyprogramming-0.2.5/jrpyprogramming/__version__.py +1 -0
  4. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data.py +14 -6
  5. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/pyproject.toml +4 -4
  6. jrpyprogramming-0.2.2/jrpyprogramming/__version__.py +0 -1
  7. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/practical1.pdf +0 -0
  8. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/practical2.pdf +0 -0
  9. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/practical3.pdf +0 -0
  10. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/practical4.pdf +0 -0
  11. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/practical5.pdf +0 -0
  12. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/solutions1.pdf +0 -0
  13. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/solutions2.pdf +0 -0
  14. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/solutions3.pdf +0 -0
  15. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/solutions4.pdf +0 -0
  16. jrpyprogramming-0.2.2/jrpyprogramming/vignettes/solutions5.pdf +0 -0
  17. jrpyprogramming-0.2.2/jrpyprogramming/vignettes.py +0 -42
  18. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/data1.csv +0 -0
  19. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/data2.csv +0 -0
  20. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/data2.xlsx +0 -0
  21. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/data3.csv +0 -0
  22. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/data3.txt +0 -0
  23. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/data4.csv +0 -0
  24. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/data5.csv +0 -0
  25. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/experiment.csv +0 -0
  26. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/genome.csv +0 -0
  27. {jrpyprogramming-0.2.2 → jrpyprogramming-0.2.5}/jrpyprogramming/data/movies.zip +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jrpyprogramming
3
- Version: 0.2.2
3
+ Version: 0.2.5
4
4
  Summary: Jumping Rivers: Programming with Python
5
5
  Author: Jumping Rivers
6
6
  Author-email: info@jumpingrivers.com
@@ -10,8 +10,7 @@ Classifier: Programming Language :: Python :: 3.9
10
10
  Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
- Classifier: Programming Language :: Python :: 3.13
14
- Requires-Dist: jrpyintroduction (>=0.2.2)
13
+ Requires-Dist: jrpyintroduction (>=0.3.8)
15
14
  Requires-Dist: matplotlib (>=3.5,<4.0)
16
- Requires-Dist: numpy (>=1.26,<2.0)
17
- Requires-Dist: pandas (>=1.5,<2.0)
15
+ Requires-Dist: numpy (>=2.0,<3.0)
16
+ Requires-Dist: pandas (>=2.2.0,<3.0.0)
@@ -1,4 +1,3 @@
1
1
  from .__version__ import __version__ # noqa: F401
2
2
 
3
3
  from . import data # noqa: F401
4
- from . import vignettes # noqa: F401
@@ -0,0 +1 @@
1
+ __version__ = "0.2.5"
@@ -1,11 +1,16 @@
1
- import pandas as pd
2
- import pkg_resources
1
+ from importlib import resources
3
2
  from shutil import copyfile
3
+ import os
4
+
5
+ import pandas as pd
4
6
 
5
7
 
6
8
  def load(file):
9
+ # Get absolute path to data
10
+ data_path = resources.files("jrpyprogramming") / "data"
11
+
7
12
  # List data sources in package
8
- files = pkg_resources.resource_listdir(__name__, "data")
13
+ files = os.listdir(data_path)
9
14
 
10
15
  # Map from filename (without) extension, to file name with extension
11
16
  files_w_ext = {data.split(".")[0]: data for data in files}
@@ -21,20 +26,23 @@ def load(file):
21
26
  file_w_ext = files_w_ext[file]
22
27
 
23
28
  # Get absolute path to file
24
- abs_path = pkg_resources.resource_filename(__name__, f"data/{file_w_ext}")
29
+ abs_path = data_path / file_w_ext
25
30
 
26
31
  return pd.read_csv(abs_path)
27
32
 
28
33
 
29
34
  def populate_examples():
35
+ # Get absolute path to data
36
+ data_path = resources.files("jrpyprogramming") / "data"
37
+
30
38
  # Get path to files relative to package
31
- pkg_data = pkg_resources.resource_listdir(__name__, 'data')
39
+ pkg_data = os.listdir(data_path)
32
40
 
33
41
  # Only list files which have a name which starts with "data"
34
42
  files = [file for file in pkg_data if file.startswith('data')]
35
43
 
36
44
  # Copy files to current dir
37
45
  for file in files:
38
- abs_path = pkg_resources.resource_filename(__name__, f'data/{file}')
46
+ abs_path = data_path / file
39
47
  copyfile(abs_path, file)
40
48
  print(f'\nCreated file {file} in current directory.\n')
@@ -1,15 +1,15 @@
1
1
  [tool.poetry]
2
2
  name = "jrpyprogramming"
3
- version = "0.2.2"
3
+ version = "0.2.5"
4
4
  description = "Jumping Rivers: Programming with Python"
5
5
  authors = ["Jumping Rivers <info@jumpingrivers.com>"]
6
6
 
7
7
  [tool.poetry.dependencies]
8
8
  python = ">=3.9"
9
- pandas = "^1.5"
10
- numpy = "^1.26"
9
+ pandas = "^2.2.0"
10
+ numpy = "^2.0"
11
11
  matplotlib = "^3.5"
12
- jrpyintroduction = ">=0.2.2"
12
+ jrpyintroduction = ">=0.3.8"
13
13
 
14
14
  [build-system]
15
15
  requires = ["poetry-core>=1.0.0"]
@@ -1 +0,0 @@
1
- __version__ = "0.2.2"
@@ -1,42 +0,0 @@
1
- import webbrowser
2
- from pkg_resources import resource_listdir
3
- from pkg_resources import resource_filename
4
-
5
-
6
- def browse():
7
- """
8
- List all of the vignettes available for this package.
9
- """
10
- outs = _get_vignette_titles()
11
-
12
- if len(outs) > 0:
13
- print("\nAvailable documents: \n")
14
- print("\n".join(outs))
15
- print(f"\nTo open use e.g load('{outs[0]}')\n")
16
- else:
17
- print("\nNo documents available\n")
18
-
19
-
20
- def load(name):
21
- """
22
- Open a particular vignette from the package.
23
- """
24
- outs = _get_vignette_titles()
25
- if name in outs:
26
- path = resource_filename("jrpyprogramming", f"vignettes/{name}")
27
- webbrowser.open_new(path)
28
- else:
29
- print(f"\nVignette '{name}' not found")
30
- browse()
31
-
32
-
33
- def _get_vignette_titles():
34
- x = resource_listdir("jrpyprogramming", "vignettes")
35
- # grab only those which are pdfs or html
36
- pdfs = [file for file in x if file.endswith(".pdf")]
37
- htmls = [file for file in x if file.endswith(".html")]
38
- # Concat pdfs and htmls
39
- outs = pdfs + htmls
40
- # Return in some legible order
41
- outs.sort()
42
- return outs