sharex-cli 0.0.2__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.
@@ -17,3 +17,4 @@ coverage.xml
17
17
  /site/
18
18
  /tests/files
19
19
  /tests/fake.json
20
+ *.spec
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sharex-cli
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: CLI to Upload Files to a ShareX Server using a ShareX Custom Uploader (.sxcu) Configuration File.
5
5
  Project-URL: Changelog, https://github.com/cssnr/sharex-cli/releases
6
6
  Project-URL: Discord, https://discord.gg/wXy6m2X8wY
@@ -105,6 +105,13 @@ uv tool install git+https://github.com/cssnr/sharex-cli.git
105
105
 
106
106
  [![View Install Guide](https://img.shields.io/badge/view_install_guide-blue?style=for-the-badge&logo=googledocs&logoColor=white)](https://cssnr.github.io/sharex-cli/cli/#install)
107
107
 
108
+ Download a Binary: https://github.com/cssnr/sharex-cli/releases/latest
109
+
110
+ - [windows-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-amd64.zip)
111
+ - [macos-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-amd64.zip)
112
+ - [linux-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-amd64.zip)
113
+ - [linux-arm64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-arm64.zip)
114
+
108
115
  ## Configure<a id="configure"></a>
109
116
 
110
117
  To configure you need your server's ShareX Custom Uploader `*.sxcu` configuration JSON.
@@ -78,6 +78,13 @@ uv tool install git+https://github.com/cssnr/sharex-cli.git
78
78
 
79
79
  [![View Install Guide](https://img.shields.io/badge/view_install_guide-blue?style=for-the-badge&logo=googledocs&logoColor=white)](https://cssnr.github.io/sharex-cli/cli/#install)
80
80
 
81
+ Download a Binary: https://github.com/cssnr/sharex-cli/releases/latest
82
+
83
+ - [windows-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-amd64.zip)
84
+ - [macos-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-amd64.zip)
85
+ - [linux-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-amd64.zip)
86
+ - [linux-arm64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-arm64.zip)
87
+
81
88
  ## Configure<a id="configure"></a>
82
89
 
83
90
  To configure you need your server's ShareX Custom Uploader `*.sxcu` configuration JSON.
@@ -42,9 +42,12 @@ dev = [
42
42
  "hatch>=1.16.2",
43
43
  "isort>=7.0.0",
44
44
  "mypy>=1.19.1",
45
+ "pyinstaller>=6.17.0",
46
+ "pyinstaller-versionfile>=3.0.1",
45
47
  "pytest>=9.0.2",
46
48
  "ruff>=0.14.10",
47
49
  "tombi>=0.7.8",
50
+ "toml-run>=0.0.1",
48
51
  "ty>=0.0.4",
49
52
  "typer>=0.20.1",
50
53
  "types-pyperclip>=1.9.0.20250801",
@@ -64,7 +67,7 @@ build-backend = "hatchling.build"
64
67
  # Bandit
65
68
  # https://bandit.readthedocs.io/en/latest/config.html
66
69
  [tool.bandit]
67
- exclude_dirs = [".venv"]
70
+ exclude_dirs = [".venv", "tests"]
68
71
  skips = ["B105", "B107"]
69
72
 
70
73
  # Black
@@ -76,7 +79,7 @@ extend-exclude = '(\.github)'
76
79
  # Coverage
77
80
  # https://coverage.readthedocs.io/en/latest/
78
81
  [tool.coverage.run]
79
- omit = ["_version.py", "utils.py", "cli.py"]
82
+ omit = ["_version.py", "app.py", "utils.py", "cli.py"]
80
83
  source = ["src"]
81
84
 
82
85
  # Hatchling
@@ -117,3 +120,25 @@ extend-exclude = [".github"]
117
120
 
118
121
  [tool.ruff.lint]
119
122
  select = ["E4", "E7", "E9", "F", "B", "Q"]
123
+
124
+ [tool.scripts]
125
+ version = "pyivf-make_version --source-format yaml --metadata-source .github/files/win-version.yaml --outfile win-version.txt"
126
+ install = "pyinstaller -F -n sharex -i docs/favicon.ico src/app.py"
127
+ build = "uv run hatch build"
128
+ predocs = "rm -rf .cache site"
129
+ docs = "zensical serve --open"
130
+ format = ["black .", "tombi format .", "ruff format ."]
131
+ lint = """
132
+ black --check .
133
+ run bandit
134
+ run mypy
135
+ run ruff
136
+ run validate
137
+ tombi lint .
138
+ ty check -v .
139
+ yamllint -c .github/yamllint.yaml .
140
+ """
141
+ bandit = "bandit -c pyproject.toml -r ."
142
+ mypy = "mypy ."
143
+ ruff = "ruff check ."
144
+ validate = "validate-pyproject pyproject.toml"
@@ -0,0 +1,5 @@
1
+ from sharex.cli import app
2
+
3
+
4
+ if __name__ == "__main__":
5
+ app()
@@ -0,0 +1,2 @@
1
+ # The string "0.0.1" is used in .github/workflows/build.yaml
2
+ __version__ = "0.0.3"
@@ -17,7 +17,7 @@ session = requests.Session()
17
17
  session.headers.update({"user-agent": f"requests/sharex-{__version__}"})
18
18
 
19
19
 
20
- def upload_file(config, file_name: str, file_data: IO) -> str:
20
+ def upload_file(config, file_name: str, file_data: IO, path: Optional[Path] = None) -> str:
21
21
  """Upload a File from an SXCU Config"""
22
22
  url = config["RequestURL"]
23
23
  # print(f"{url=}")
@@ -26,7 +26,7 @@ def upload_file(config, file_name: str, file_data: IO) -> str:
26
26
  headers = config["Headers"]
27
27
  key = config["URL"]
28
28
 
29
- path = Path(file_name)
29
+ # path = Path(file_name)
30
30
  mime_type = get_type(path)
31
31
  # print(f"{mime_type=}")
32
32
 
@@ -71,7 +71,7 @@ def get_config(config_path: Optional[Path] = None, env_var: str = "", create_emp
71
71
  return None
72
72
 
73
73
 
74
- def get_type(file_path: Path) -> str: # NOSONAR
74
+ def get_type(path: Optional[Path] = None) -> str: # NOSONAR
75
75
  """
76
76
  Get MIME type from guess_type or by reading magic headers
77
77
  https://en.wikipedia.org/wiki/List_of_file_signatures
@@ -79,14 +79,17 @@ def get_type(file_path: Path) -> str: # NOSONAR
79
79
  Deprecated since version 3.13: Passing a file path instead of URL is soft deprecated. Use guess_file_type() for this.
80
80
  https://docs.python.org/3/library/mimetypes.html#mimetypes.guess_type
81
81
  """
82
- mime_type, _ = mimetypes.guess_type(file_path, strict=False)
82
+ if not path:
83
+ return "text/plain"
84
+
85
+ mime_type, _ = mimetypes.guess_type(path, strict=False)
83
86
  if mime_type:
84
87
  return mime_type
85
88
 
86
- if not file_path.is_file():
89
+ if not path.is_file():
87
90
  return "text/plain"
88
91
 
89
- with open(file_path, "rb") as file:
92
+ with open(path, "rb") as file:
90
93
  chunk = file.read(512)
91
94
 
92
95
  # print(f"chunk: {type(chunk)} - {chunk[:20]}")
@@ -124,7 +124,7 @@ def archive_dir(config, params: Dict[str, Any], dir_path: Path):
124
124
  f"Uploading File: [green bold]{click.format_filename(final_path.name)}[/green bold] - [yellow bold]{size}"
125
125
  ):
126
126
  with open(final_path, "rb") as f:
127
- url = api.upload_file(config, final_path.name, f)
127
+ url = api.upload_file(config, final_path.name, f, final_path)
128
128
  print(url)
129
129
  copy_text(url)
130
130
  raise typer.Exit()
@@ -263,7 +263,7 @@ def main( # NOSONAR
263
263
  ):
264
264
  file_name = _name if _name and len(_files) == 1 else file.name
265
265
  with open(file, "rb") as f:
266
- url = api.upload_file(config, file_name, f)
266
+ url = api.upload_file(config, file_name, f, file)
267
267
  print(url)
268
268
  copy_text(url)
269
269
  if _launch and len(_files) == 1 and url:
@@ -1,2 +0,0 @@
1
- # The string "0.0.2" is used in .github/workflows/build.yaml
2
- __version__ = "0.0.2"
File without changes