accsyn-python-api 3.1.0__tar.gz → 3.2.1__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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accsyn-python-api
3
- Version: 3.1.0
3
+ Version: 3.2.1
4
4
  Summary: A Python API for accsyn programmable fast and secure data delivery software
5
5
  Home-page: https://accsyn.com
6
6
  License: Apache-2.0
@@ -93,8 +93,55 @@ poetry run black .
93
93
 
94
94
  ```
95
95
 
96
- Building and Publishing:
97
- -----------------------
96
+ Testing:
97
+ --------
98
+
99
+ The test suite requires role-specific credential files to test different user permissions,
100
+ Tests will be skipped if the required .env files are not present.
101
+ The tests also requires active accsyn clients running on behalf of the users, to be able to fully
102
+ test file transfers and compute. This requires all tests to run interactively, to be able to action
103
+ prompts that may appear during execution.
104
+
105
+ **Prepare test credentials:**
106
+
107
+ Create three `.env` files in the project root directory, one for each role:
108
+
109
+ 1. `.env.admin` - Admin role credentials
110
+ 2. `.env.employee` - Employee role credentials
111
+ 3. `.env.standard` - Standard (restricted end user) role credentials
112
+
113
+ Each `.env` file should contain:
114
+
115
+ ```bash
116
+ ACCSYN_WORKSPACE=your_workspace
117
+ ACCSYN_API_USER=user@example.com
118
+ ACCSYN_API_KEY=your_api_key
119
+ ```
120
+
121
+ **Run tests:**
122
+
123
+ ```bash
124
+ # Run all tests
125
+ poetry run pytest -x -s
126
+
127
+ # Run with coverage report
128
+ poetry run pytest -x -s --cov=accsyn_api --cov-report=term-missing
129
+
130
+ # Run a specific test file
131
+ poetry run pytest -x -s tests/test_find_entitytypes.py
132
+
133
+ # Some tests have dependencies in form of running clients, run interactively:
134
+ poetry run pytest -x -s tests/test_find_entitytypes.py
135
+
136
+ ```
137
+
138
+ **Categories:** Use `@pytest.mark.base` for tests that create entities; use `@pytest.mark.extended` and `@pytest.mark.order(2)` (or higher) for tests that depend on those entities. Run `pytest -m "base or extended"` to run both in order in one session.
139
+
140
+ **Note:** Tests that require a specific role will be skipped if the corresponding `.env` file is missing.
141
+
142
+
143
+ Building and publishing to PyPi:
144
+ --------------------------------
98
145
 
99
146
  ```bash
100
147
  # Build the package
@@ -108,6 +155,8 @@ poetry config repositories.testpypi https://test.pypi.org/legacy/
108
155
  poetry publish -r testpypi
109
156
  ```
110
157
 
158
+ Poetry can use saved credentials (`poetry config pypi-token.pypi <token>`) or username/password flags such as `poetry publish --username <user> --password <pass>`.
159
+
111
160
  accsyn(r) - secure high speed file delivery and workflow sync
112
161
  https://accsyn.com
113
162
  https://support.accsyn.com
@@ -0,0 +1,133 @@
1
+ # accsyn-python-api
2
+ Official accsyn fast and secure file delivery Python API
3
+
4
+ Python API support can be found [here](https://support.accsyn.com/workflows/python-api).
5
+
6
+
7
+ Changelog:
8
+ ----------
9
+
10
+ See doc/release_notes.rst
11
+
12
+
13
+ Documentation:
14
+ --------------
15
+
16
+ [https://accsyn-python-api.readthedocs.io/en/latest](https://accsyn-python-api.readthedocs.io/en/latest)
17
+
18
+
19
+ Development Setup:
20
+ ------------------
21
+
22
+ This project uses Poetry for dependency management. To get started:
23
+
24
+ ```bash
25
+ # Install Poetry (if not already installed)
26
+ curl -sSL https://install.python-poetry.org | python3 -
27
+
28
+ # Install dependencies
29
+ poetry install
30
+
31
+ # Install with documentation dependencies
32
+ poetry install --with docs
33
+
34
+ # Activate the virtual environment
35
+ poetry shell
36
+ ```
37
+
38
+ Building Documentation:
39
+ ----------------------
40
+
41
+ To build the documentation locally:
42
+
43
+ ```bash
44
+ # Install with docs dependencies
45
+ poetry install --with docs
46
+
47
+ # Build docs
48
+ cd doc
49
+ poetry run sphinx-build -T -E -b html -d _build/doctrees -D language=en . ../dist/doc
50
+ ```
51
+
52
+ Or use the shorter command:
53
+ ```bash
54
+ poetry run sphinx-build -b html doc dist/doc
55
+ ```
56
+
57
+ Development Tools:
58
+ -----------------
59
+
60
+ ```bash
61
+ # Format code
62
+ poetry run black .
63
+
64
+ ```
65
+
66
+ Testing:
67
+ --------
68
+
69
+ The test suite requires role-specific credential files to test different user permissions,
70
+ Tests will be skipped if the required .env files are not present.
71
+ The tests also requires active accsyn clients running on behalf of the users, to be able to fully
72
+ test file transfers and compute. This requires all tests to run interactively, to be able to action
73
+ prompts that may appear during execution.
74
+
75
+ **Prepare test credentials:**
76
+
77
+ Create three `.env` files in the project root directory, one for each role:
78
+
79
+ 1. `.env.admin` - Admin role credentials
80
+ 2. `.env.employee` - Employee role credentials
81
+ 3. `.env.standard` - Standard (restricted end user) role credentials
82
+
83
+ Each `.env` file should contain:
84
+
85
+ ```bash
86
+ ACCSYN_WORKSPACE=your_workspace
87
+ ACCSYN_API_USER=user@example.com
88
+ ACCSYN_API_KEY=your_api_key
89
+ ```
90
+
91
+ **Run tests:**
92
+
93
+ ```bash
94
+ # Run all tests
95
+ poetry run pytest -x -s
96
+
97
+ # Run with coverage report
98
+ poetry run pytest -x -s --cov=accsyn_api --cov-report=term-missing
99
+
100
+ # Run a specific test file
101
+ poetry run pytest -x -s tests/test_find_entitytypes.py
102
+
103
+ # Some tests have dependencies in form of running clients, run interactively:
104
+ poetry run pytest -x -s tests/test_find_entitytypes.py
105
+
106
+ ```
107
+
108
+ **Categories:** Use `@pytest.mark.base` for tests that create entities; use `@pytest.mark.extended` and `@pytest.mark.order(2)` (or higher) for tests that depend on those entities. Run `pytest -m "base or extended"` to run both in order in one session.
109
+
110
+ **Note:** Tests that require a specific role will be skipped if the corresponding `.env` file is missing.
111
+
112
+
113
+ Building and publishing to PyPi:
114
+ --------------------------------
115
+
116
+ ```bash
117
+ # Build the package
118
+ poetry build
119
+
120
+ # Publish to PyPI (requires authentication)
121
+ poetry publish
122
+
123
+ # Or publish to test PyPI first
124
+ poetry config repositories.testpypi https://test.pypi.org/legacy/
125
+ poetry publish -r testpypi
126
+ ```
127
+
128
+ Poetry can use saved credentials (`poetry config pypi-token.pypi <token>`) or username/password flags such as `poetry publish --username <user> --password <pass>`.
129
+
130
+ accsyn(r) - secure high speed file delivery and workflow sync
131
+ https://accsyn.com
132
+ https://support.accsyn.com
133
+
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "accsyn-python-api"
7
- version = "3.1.0"
7
+ version = "3.2.1"
8
8
  description = "A Python API for accsyn programmable fast and secure data delivery software"
9
9
  authors = ["Henrik Norin <support@accsyn.com>"]
10
10
  license = "Apache-2.0"
@@ -29,6 +29,9 @@ classifiers = [
29
29
  ]
30
30
  packages = [{include = "accsyn_api", from = "source"}]
31
31
 
32
+ [tool.poetry.scripts]
33
+ test = "accsyn_api._devtools:test"
34
+
32
35
  [tool.poetry.dependencies]
33
36
  python = "^3.8"
34
37
  requests = "^2.25.0"
@@ -43,6 +46,7 @@ flake8 = "^5.0.0"
43
46
  mypy = "^1.0.0"
44
47
  pytest = "^7.0.0"
45
48
  pytest-cov = "^4.0.0"
49
+ pytest-order = "^1.0.0"
46
50
 
47
51
  [tool.poetry.group.docs]
48
52
  optional = true
@@ -76,4 +80,8 @@ disallow_untyped_defs = true
76
80
  [tool.pytest.ini_options]
77
81
  testpaths = ["tests"]
78
82
  python_files = ["test_*.py", "*_test.py"]
79
- addopts = "--cov=accsyn_api --cov-report=term-missing"
83
+ addopts = "--cov=accsyn_api --cov-report=term-missing -x"
84
+ markers = [
85
+ "base: Phase 1 tests that create entities (run first).",
86
+ "extended: Phase 2 tests that depend on entities created by base (run after base).",
87
+ ]
@@ -0,0 +1,30 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import sys
5
+ from pathlib import Path
6
+ from typing import Optional, Sequence
7
+
8
+
9
+ def run_pytest(argv: Optional[Sequence[str]] = None) -> int:
10
+ """
11
+ Run pytest from the repository root, regardless of current working directory.
12
+
13
+ This makes `poetry run test` work even if invoked from e.g. `doc/`.
14
+ """
15
+ repo_root = Path(__file__).resolve().parents[2]
16
+ os.chdir(repo_root)
17
+
18
+ args = list(sys.argv[1:] if argv is None else argv)
19
+ # Ensure we always pick up the project's pytest settings.
20
+ if "-c" not in args and "--config-file" not in args:
21
+ args = ["-c", str(repo_root / "pyproject.toml"), *args]
22
+
23
+ import pytest
24
+
25
+ return pytest.main(args)
26
+
27
+
28
+ def test() -> None:
29
+ """Poetry script entrypoint: `poetry run test [pytest-args...]`."""
30
+ raise SystemExit(run_pytest())
@@ -1,4 +1,4 @@
1
1
  # :coding: utf-8
2
2
  # :copyright: Copyright (c) 2015-2023 accsyn/HDR AB
3
3
 
4
- __version__ = "3.1.0-1"
4
+ __version__ = "3.2.1-0"