fts4 4.0.0a3__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.

Potentially problematic release.


This version of fts4 might be problematic. Click here for more details.

fts4-4.0.0a3/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ prune *
2
+ graft src/fts3
3
+ graft src/cli
4
+
5
+ include LICENSE README.md pyproject.toml setup.py setup.cfg
6
+ global-exclude __pycache__ *.py[cod] .* *.sh migration_docs.md pre-commit
fts4-4.0.0a3/PKG-INFO ADDED
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: fts4
3
+ Version: 4.0.0a3
4
+ Summary: FTS Python3 CLI and libraries
5
+ Home-page: https://gitlab.cern.ch/fts/fts
6
+ Author: CERN -- FTS team
7
+ Author-email: fts-devel@cern.ch
8
+ License: Apache License 2.0
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Environment :: Console
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: M2Crypto
20
+ Requires-Dist: requests
21
+ Requires-Dist: setuptools>=39
22
+ Dynamic: license-file
23
+
24
+ FTS4 Rest
25
+ ===============
26
+
27
+ FTS4 rest is the RESTful API for the FTS4 Service.
28
+
29
+ This is the front-facing component to communicate with the FTS4 Service,
30
+ allowing submission of transfers, querying transfer updates, as well as configuration management.
31
+
32
+ The project consists of an Apache module running Python3 + Flask.
33
+ It is also a direct continuation of the former [fts-rest][1], where the migration
34
+ decision and evaluation can be seen [here][2].
35
+
36
+ The officially supported platform is Alma9. The server part is provided via RPMs
37
+ for the official platform. The client is provided via EPEL for multiple platforms,
38
+ as well as via [PyPi/fts3][3].
39
+
40
+ ## Installation
41
+
42
+ The project should be installed via RPMs, provided via the FTS repository.
43
+
44
+ ### Installing the client
45
+
46
+ Make sure to have the FTS repositories enabled:
47
+ - [production][4] repository: official RPMs deemed ready for production
48
+ - [development][5] repository: RPMs built on the latest `develop` branch commit
49
+
50
+ #### Installing the client:
51
+ ```shell
52
+ $ dnf install -y fts-rest-client
53
+ ```
54
+
55
+ #### Installing the server
56
+
57
+ The project relies on `mod_wsgi` built for Python 3.9. Some of the dependencies
58
+ require the `crb` (CodeReady Linux Builder) repository to be enabled.
59
+ All requirements are specified and should be brought-in via the spec file.
60
+ ```shell
61
+ $ dnf config-manager --enable crb
62
+ $ dnf install -y fts-rest-server
63
+ ```
64
+
65
+ Configuring the server is done via the following two configuration files:
66
+ - `/etc/fts/fts-rest.ini`
67
+ - `/etc/httpd/conf.d/fts-rest.conf`
68
+
69
+ ## Development
70
+
71
+ The project is tracked using JIRA, under the [FTS Project][6] (requires CERN log-in).
72
+ Soon the project will be mirrored on GitHub, where issues and pull requests are also accepted (and encouraged!).
73
+
74
+ For development purposes, using a virtual environment is encouraged.
75
+
76
+ ### Git Workflow
77
+
78
+ This project follows a simplified [GitFlow][7] model. The main branch is the `develop` branch,
79
+ with `master` being reserved only for tagged released.
80
+
81
+ Feature branches are developed separately and merged into the `develop` branch.
82
+ When preparing a release, either `develop` is merged directly into `master`
83
+ or a release branch is created. Production hotfixes are allowed only in case of necessity.
84
+ Both release and hotfix branch changes must be merged back into `develop`.
85
+
86
+ ### Development workflow
87
+
88
+ When taking on a task, the following workflow model should be followed:
89
+ 1. Create a JIRA ticket for the identified problem
90
+ 2. Estimate the magnitude of the task:
91
+ - Small changes can go directly on the `develop` branch
92
+ - Larger changes must go into a separate feature branch
93
+ 3. Implement and test your changes
94
+ 4. Merge them into the `develop` branch:
95
+ - Merge large changes via merge requests and request code review
96
+ - Changes affecting the database must also be code reviewed!
97
+ 5. Close the JIRA ticket and mark the appropriate `fixVersion`
98
+
99
+ ### Continuous Integration
100
+
101
+ The project uses Gitlab-CI for CI/CD. The [pipeline][8] runs for every push, in every branch:
102
+ - black: checks code must be formatted with `black`
103
+ - pylint: checks for syntax errors (runs for every supported Python3 version)
104
+ - If you are sure that pylint is mistaken, add `# pylint: skip-file` at the beginning of the relevant file
105
+ - functional tests: run for every supported Python3 version
106
+ - bandit: detects potential security issues in the code
107
+ - Allowed to fail as it flags many false positives.
108
+ - To ignore a false positive, append `# nosec` to the offending line
109
+ - build: RPM for the client and server, plus `sdist` and `wheel` for the client
110
+ - deploy: upload client and server RPM to the FTS testing repository
111
+
112
+ Merge requests will proceed only if the pipeline succeeds.
113
+ In case of emergency the pipeline can be [skipped][9].
114
+
115
+ The pipeline runs in a container from the image tagged as `ci`. The dockerfile is in the `.gitlab-ci` directory and the
116
+ image is hosted in the container registry of this project. The image contains the pre-installed Python environment
117
+ in order to speed up CI execution. When new environment is desired (such as new or upgraded dependencies),
118
+ a new image must be created via the `.gitlab-ci/docker/create-ci-image.sh` script.
119
+
120
+ #### During development
121
+
122
+ Developers may add the `.gitlab-ci/pre-commit` hook to their local repository,
123
+ enabling the following checks before every commit:
124
+ - Run `black` to format the changed files
125
+ - Run `pylint` only on the changed files
126
+ - Note: As pylint works better when it is run on the full project, some rules have been disabled
127
+ - Run `radon` and `bandit` only on the changed files
128
+ - In case of false positives, the hook can be skipped with the commit option `--no-verify`
129
+
130
+ A convenience script is provided to install the `pre-commit` hook:
131
+ ```shell
132
+ $ cd .gitlab-ci/
133
+ $ ./precommit_install.sh
134
+ ```
135
+
136
+ ### Python dependencies
137
+
138
+ The project uses [pip-tools][10] to manage dependencies:
139
+ - `requirements.in`: list of dependencies for the production app
140
+ - `dev-requirements.in`: extra list of packages used for development (e.g. static code analysis)
141
+
142
+ ### Setting up the development environment with virtualenv
143
+
144
+ The `pipcompile.sh` script is provided to help set up a development environment:
145
+ ```shell
146
+ $ virtualenv venv
147
+ $ source venv/bin/activate
148
+ (venv) $ pip install --upgrade pip
149
+ (venv) $ pip install pip-tools
150
+ (venv) $ ./pipcompile.sh --sync
151
+ ```
152
+
153
+ Running `pipcompile.sh` will generate `requirements.txt`. Running the command with `--sync`
154
+ will also synchronize the virtual environment with the requirements.
155
+
156
+ ### Setting up the development environment with uv
157
+ ## This is an other way to setup the venv, you can skip this section if you used virtualenv
158
+
159
+ ```shell
160
+ $ uv venv venv
161
+ $ source ./venv/bin/activate
162
+ (venv) $ uv pip compile --generate-hashes --upgrade requirements.in -o requirements.txt
163
+ (venv) $ uv pip compile --generate-hashes --upgrade dev-requirements.in -o dev-requirements.txt
164
+ (venv) $ uv pip sync requirements.txt dev-requirements.txt
165
+ (venv) $ uv pip install . # Install the FTS CLI tools in the venv
166
+ ```
167
+
168
+ Additionally, you will need to configure the HTTPd config file.
169
+ A template version for development is offered at `src/ftsrest/fts-rest_dev_conf.in`.
170
+ To fill it with the right paths and install it, run the `install-httpd-dev.sh` script:
171
+ ```shell
172
+ $ cd src/ftsrest/
173
+ $ ./install-httpd-dev.sh
174
+ ```
175
+
176
+ ### Functional tests
177
+
178
+ The functional tests reside under `src/ftsrest/ftsrest/tests/functional`.
179
+
180
+ In oder to run the tests, a fully functional Postgres-compatible database is required.
181
+ The database must have the appropriate FTS schema and the connection details configured
182
+ in the FTS3 REST config file.
183
+
184
+ Example on Centos 7 with locally installed `Postgres`:
185
+ ```shell
186
+ $ wget https://gitlab.cern.ch/fts/fts3/-/raw/v3.11.0/src/db/schema/mysql/fts-schema-7.0.0.sql
187
+ $ mysql -u root --execute "CREATE DATABASE ftsflask;"
188
+ $ mysql -u root --execute "CREATE USER 'fts3'@'%';"
189
+ $ mysql -u root --execute "GRANT ALL PRIVILEGES ON ftsflask.* TO 'fts3'@'%' IDENTIFIED BY 'ftsflaskpass';"
190
+ $ mysql -u fts3 --password=ftsflaskpass ftsflask
191
+ MariaDB [ftsflask]> source fts-schema-7.0.0.sql
192
+ ```
193
+
194
+ Before running the tests, make sure to include the `ftsrest` project in the `PYTHONPATH`.
195
+ Additionally, the `FTSTESTCONFIG` environment variable can also be set to use a different config file during testing:
196
+ ```shell
197
+ $ export PYTHONPATH="${PROJECT_DIR}/src:${PROJECT_DIR}/src/ftsrest"
198
+ $ export FTSTESTCONFIG="${PROJECT_DIR}/src/ftsrest/ftsrest/tests/fts-test.ini"
199
+ ```
200
+
201
+ Make sure you modify the `fts-test.ini` file to match your database connection details.
202
+
203
+ For ease-of-use, the `runtests.sh` script is provided:
204
+ ```shell
205
+ $ cd src/ftsrest
206
+ $ ./runtests.sh
207
+ ```
208
+
209
+ **Note**: OIDC tests are not run in the CI as the container would need a client registered and this has not yet been set up.
210
+ To run OIDC tests in a development environment, the environment variables `xdc_ClientId` and `xdc_ClientSecret` must be set.
211
+
212
+ ### Building packages
213
+
214
+ In order to build RPM packages, two utility scripts are provided
215
+ for the client and server: `fts-rest-client.sh` and `fts-rest-server.sh`.
216
+
217
+ The following example shows how to build server packages:
218
+ ```shell
219
+ $ ./packaging/server/fts-rest-server.sh
220
+ $ tree "build/server/RPMS"
221
+ ```
222
+
223
+ ## Useful links
224
+
225
+ - Documentation: https://fts3-docs.web.cern.ch/fts3-docs/fts-rest/docs/index.html
226
+ - FTS Repository: https://fts-repo.web.cern.ch/fts-repo/
227
+ - Apache License, version 2.0: https://www.apache.org/licenses/LICENSE-2.0
228
+ - Support channels: fts-support@cern.ch
229
+ - Development team contact: fts-devel@cern.ch
230
+
231
+
232
+ [1]: https://gitlab.cern.ch/fts/fts-rest
233
+ [2]: https://its.cern.ch/jira/browse/FTS-1496
234
+ [3]: https://pypi.org/project/fts3/
235
+ [4]: https://fts-repo.web.cern.ch/fts-repo/el9/x86_64/
236
+ [5]: https://fts-repo.web.cern.ch/fts-repo/testing/el9/x86_64/
237
+ [6]: https://its.cern.ch/jira/projects/FTS/issues
238
+ [7]: https://nvie.com/posts/a-successful-git-branching-model/
239
+ [8]: https://gitlab.cern.ch/fts/fts-rest-flask/-/pipelines
240
+ [9]: https://docs.gitlab.com/ee/ci/yaml/#skipping-jobs
241
+ [10]: https://github.com/jazzband/pip-tools
fts4-4.0.0a3/README.md ADDED
@@ -0,0 +1,218 @@
1
+ FTS4 Rest
2
+ ===============
3
+
4
+ FTS4 rest is the RESTful API for the FTS4 Service.
5
+
6
+ This is the front-facing component to communicate with the FTS4 Service,
7
+ allowing submission of transfers, querying transfer updates, as well as configuration management.
8
+
9
+ The project consists of an Apache module running Python3 + Flask.
10
+ It is also a direct continuation of the former [fts-rest][1], where the migration
11
+ decision and evaluation can be seen [here][2].
12
+
13
+ The officially supported platform is Alma9. The server part is provided via RPMs
14
+ for the official platform. The client is provided via EPEL for multiple platforms,
15
+ as well as via [PyPi/fts3][3].
16
+
17
+ ## Installation
18
+
19
+ The project should be installed via RPMs, provided via the FTS repository.
20
+
21
+ ### Installing the client
22
+
23
+ Make sure to have the FTS repositories enabled:
24
+ - [production][4] repository: official RPMs deemed ready for production
25
+ - [development][5] repository: RPMs built on the latest `develop` branch commit
26
+
27
+ #### Installing the client:
28
+ ```shell
29
+ $ dnf install -y fts-rest-client
30
+ ```
31
+
32
+ #### Installing the server
33
+
34
+ The project relies on `mod_wsgi` built for Python 3.9. Some of the dependencies
35
+ require the `crb` (CodeReady Linux Builder) repository to be enabled.
36
+ All requirements are specified and should be brought-in via the spec file.
37
+ ```shell
38
+ $ dnf config-manager --enable crb
39
+ $ dnf install -y fts-rest-server
40
+ ```
41
+
42
+ Configuring the server is done via the following two configuration files:
43
+ - `/etc/fts/fts-rest.ini`
44
+ - `/etc/httpd/conf.d/fts-rest.conf`
45
+
46
+ ## Development
47
+
48
+ The project is tracked using JIRA, under the [FTS Project][6] (requires CERN log-in).
49
+ Soon the project will be mirrored on GitHub, where issues and pull requests are also accepted (and encouraged!).
50
+
51
+ For development purposes, using a virtual environment is encouraged.
52
+
53
+ ### Git Workflow
54
+
55
+ This project follows a simplified [GitFlow][7] model. The main branch is the `develop` branch,
56
+ with `master` being reserved only for tagged released.
57
+
58
+ Feature branches are developed separately and merged into the `develop` branch.
59
+ When preparing a release, either `develop` is merged directly into `master`
60
+ or a release branch is created. Production hotfixes are allowed only in case of necessity.
61
+ Both release and hotfix branch changes must be merged back into `develop`.
62
+
63
+ ### Development workflow
64
+
65
+ When taking on a task, the following workflow model should be followed:
66
+ 1. Create a JIRA ticket for the identified problem
67
+ 2. Estimate the magnitude of the task:
68
+ - Small changes can go directly on the `develop` branch
69
+ - Larger changes must go into a separate feature branch
70
+ 3. Implement and test your changes
71
+ 4. Merge them into the `develop` branch:
72
+ - Merge large changes via merge requests and request code review
73
+ - Changes affecting the database must also be code reviewed!
74
+ 5. Close the JIRA ticket and mark the appropriate `fixVersion`
75
+
76
+ ### Continuous Integration
77
+
78
+ The project uses Gitlab-CI for CI/CD. The [pipeline][8] runs for every push, in every branch:
79
+ - black: checks code must be formatted with `black`
80
+ - pylint: checks for syntax errors (runs for every supported Python3 version)
81
+ - If you are sure that pylint is mistaken, add `# pylint: skip-file` at the beginning of the relevant file
82
+ - functional tests: run for every supported Python3 version
83
+ - bandit: detects potential security issues in the code
84
+ - Allowed to fail as it flags many false positives.
85
+ - To ignore a false positive, append `# nosec` to the offending line
86
+ - build: RPM for the client and server, plus `sdist` and `wheel` for the client
87
+ - deploy: upload client and server RPM to the FTS testing repository
88
+
89
+ Merge requests will proceed only if the pipeline succeeds.
90
+ In case of emergency the pipeline can be [skipped][9].
91
+
92
+ The pipeline runs in a container from the image tagged as `ci`. The dockerfile is in the `.gitlab-ci` directory and the
93
+ image is hosted in the container registry of this project. The image contains the pre-installed Python environment
94
+ in order to speed up CI execution. When new environment is desired (such as new or upgraded dependencies),
95
+ a new image must be created via the `.gitlab-ci/docker/create-ci-image.sh` script.
96
+
97
+ #### During development
98
+
99
+ Developers may add the `.gitlab-ci/pre-commit` hook to their local repository,
100
+ enabling the following checks before every commit:
101
+ - Run `black` to format the changed files
102
+ - Run `pylint` only on the changed files
103
+ - Note: As pylint works better when it is run on the full project, some rules have been disabled
104
+ - Run `radon` and `bandit` only on the changed files
105
+ - In case of false positives, the hook can be skipped with the commit option `--no-verify`
106
+
107
+ A convenience script is provided to install the `pre-commit` hook:
108
+ ```shell
109
+ $ cd .gitlab-ci/
110
+ $ ./precommit_install.sh
111
+ ```
112
+
113
+ ### Python dependencies
114
+
115
+ The project uses [pip-tools][10] to manage dependencies:
116
+ - `requirements.in`: list of dependencies for the production app
117
+ - `dev-requirements.in`: extra list of packages used for development (e.g. static code analysis)
118
+
119
+ ### Setting up the development environment with virtualenv
120
+
121
+ The `pipcompile.sh` script is provided to help set up a development environment:
122
+ ```shell
123
+ $ virtualenv venv
124
+ $ source venv/bin/activate
125
+ (venv) $ pip install --upgrade pip
126
+ (venv) $ pip install pip-tools
127
+ (venv) $ ./pipcompile.sh --sync
128
+ ```
129
+
130
+ Running `pipcompile.sh` will generate `requirements.txt`. Running the command with `--sync`
131
+ will also synchronize the virtual environment with the requirements.
132
+
133
+ ### Setting up the development environment with uv
134
+ ## This is an other way to setup the venv, you can skip this section if you used virtualenv
135
+
136
+ ```shell
137
+ $ uv venv venv
138
+ $ source ./venv/bin/activate
139
+ (venv) $ uv pip compile --generate-hashes --upgrade requirements.in -o requirements.txt
140
+ (venv) $ uv pip compile --generate-hashes --upgrade dev-requirements.in -o dev-requirements.txt
141
+ (venv) $ uv pip sync requirements.txt dev-requirements.txt
142
+ (venv) $ uv pip install . # Install the FTS CLI tools in the venv
143
+ ```
144
+
145
+ Additionally, you will need to configure the HTTPd config file.
146
+ A template version for development is offered at `src/ftsrest/fts-rest_dev_conf.in`.
147
+ To fill it with the right paths and install it, run the `install-httpd-dev.sh` script:
148
+ ```shell
149
+ $ cd src/ftsrest/
150
+ $ ./install-httpd-dev.sh
151
+ ```
152
+
153
+ ### Functional tests
154
+
155
+ The functional tests reside under `src/ftsrest/ftsrest/tests/functional`.
156
+
157
+ In oder to run the tests, a fully functional Postgres-compatible database is required.
158
+ The database must have the appropriate FTS schema and the connection details configured
159
+ in the FTS3 REST config file.
160
+
161
+ Example on Centos 7 with locally installed `Postgres`:
162
+ ```shell
163
+ $ wget https://gitlab.cern.ch/fts/fts3/-/raw/v3.11.0/src/db/schema/mysql/fts-schema-7.0.0.sql
164
+ $ mysql -u root --execute "CREATE DATABASE ftsflask;"
165
+ $ mysql -u root --execute "CREATE USER 'fts3'@'%';"
166
+ $ mysql -u root --execute "GRANT ALL PRIVILEGES ON ftsflask.* TO 'fts3'@'%' IDENTIFIED BY 'ftsflaskpass';"
167
+ $ mysql -u fts3 --password=ftsflaskpass ftsflask
168
+ MariaDB [ftsflask]> source fts-schema-7.0.0.sql
169
+ ```
170
+
171
+ Before running the tests, make sure to include the `ftsrest` project in the `PYTHONPATH`.
172
+ Additionally, the `FTSTESTCONFIG` environment variable can also be set to use a different config file during testing:
173
+ ```shell
174
+ $ export PYTHONPATH="${PROJECT_DIR}/src:${PROJECT_DIR}/src/ftsrest"
175
+ $ export FTSTESTCONFIG="${PROJECT_DIR}/src/ftsrest/ftsrest/tests/fts-test.ini"
176
+ ```
177
+
178
+ Make sure you modify the `fts-test.ini` file to match your database connection details.
179
+
180
+ For ease-of-use, the `runtests.sh` script is provided:
181
+ ```shell
182
+ $ cd src/ftsrest
183
+ $ ./runtests.sh
184
+ ```
185
+
186
+ **Note**: OIDC tests are not run in the CI as the container would need a client registered and this has not yet been set up.
187
+ To run OIDC tests in a development environment, the environment variables `xdc_ClientId` and `xdc_ClientSecret` must be set.
188
+
189
+ ### Building packages
190
+
191
+ In order to build RPM packages, two utility scripts are provided
192
+ for the client and server: `fts-rest-client.sh` and `fts-rest-server.sh`.
193
+
194
+ The following example shows how to build server packages:
195
+ ```shell
196
+ $ ./packaging/server/fts-rest-server.sh
197
+ $ tree "build/server/RPMS"
198
+ ```
199
+
200
+ ## Useful links
201
+
202
+ - Documentation: https://fts3-docs.web.cern.ch/fts3-docs/fts-rest/docs/index.html
203
+ - FTS Repository: https://fts-repo.web.cern.ch/fts-repo/
204
+ - Apache License, version 2.0: https://www.apache.org/licenses/LICENSE-2.0
205
+ - Support channels: fts-support@cern.ch
206
+ - Development team contact: fts-devel@cern.ch
207
+
208
+
209
+ [1]: https://gitlab.cern.ch/fts/fts-rest
210
+ [2]: https://its.cern.ch/jira/browse/FTS-1496
211
+ [3]: https://pypi.org/project/fts3/
212
+ [4]: https://fts-repo.web.cern.ch/fts-repo/el9/x86_64/
213
+ [5]: https://fts-repo.web.cern.ch/fts-repo/testing/el9/x86_64/
214
+ [6]: https://its.cern.ch/jira/projects/FTS/issues
215
+ [7]: https://nvie.com/posts/a-successful-git-branching-model/
216
+ [8]: https://gitlab.cern.ch/fts/fts-rest-flask/-/pipelines
217
+ [9]: https://docs.gitlab.com/ee/ci/yaml/#skipping-jobs
218
+ [10]: https://github.com/jazzband/pip-tools
fts4-4.0.0a3/setup.cfg ADDED
@@ -0,0 +1,47 @@
1
+ [metadata]
2
+ name = fts4
3
+ version = attr: fts4.__version__
4
+ description = FTS Python3 CLI and libraries
5
+ long_description = file: README.md
6
+ long_description_content_type = text/markdown
7
+ url = https://gitlab.cern.ch/fts/fts
8
+ license = Apache License 2.0
9
+ license_files = LICENSE
10
+ classifiers =
11
+ Development Status :: 5 - Production/Stable
12
+ Environment :: Console
13
+ License :: OSI Approved :: Apache Software License
14
+ Operating System :: POSIX :: Linux
15
+ Programming Language :: Python :: 3.9
16
+ Programming Language :: Python :: 3.10
17
+ Programming Language :: Python :: 3.11
18
+ author = CERN -- FTS team
19
+ author_email = fts-devel@cern.ch
20
+
21
+ [options]
22
+ python_requires = >=3.9
23
+ package_dir =
24
+ =src
25
+ packages = find:
26
+ install_requires =
27
+ M2Crypto
28
+ requests
29
+ setuptools>=39
30
+ scripts =
31
+ src/cli/fts-rest-ban
32
+ src/cli/fts-rest-delegate
33
+ src/cli/fts-rest-delete-submit
34
+ src/cli/fts-rest-server-status
35
+ src/cli/fts-rest-transfer-cancel
36
+ src/cli/fts-rest-transfer-list
37
+ src/cli/fts-rest-transfer-status
38
+ src/cli/fts-rest-transfer-submit
39
+ src/cli/fts-rest-whoami
40
+
41
+ [options.packages.find]
42
+ where = src
43
+
44
+ [egg_info]
45
+ tag_build =
46
+ tag_date = 0
47
+
fts4-4.0.0a3/setup.py ADDED
@@ -0,0 +1,9 @@
1
+ """"
2
+ SYSTEM REQUIREMENTS:
3
+ The following Centos packages are required for M2Crypto:
4
+ python3-devel openssl-devel swig gcc-c++
5
+ """
6
+ from setuptools import setup
7
+
8
+ # This is required to allow editable pip installs while using the declarative configuration (setup.cfg)
9
+ setup()
@@ -0,0 +1,4 @@
1
+ [Main]
2
+ endpoint: None
3
+ ukey: None
4
+ ucert: None
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import Banning
7
+
8
+
9
+ def main():
10
+ try:
11
+ banning = Banning()
12
+ banning(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import Delegator
7
+
8
+
9
+ def main():
10
+ try:
11
+ delegator = Delegator()
12
+ delegator(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import JobDeletionSubmitter
7
+
8
+
9
+ def main():
10
+ try:
11
+ submitter = JobDeletionSubmitter()
12
+ submitter(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import ServerStatus
7
+
8
+
9
+ def main():
10
+ try:
11
+ banning = ServerStatus()
12
+ sys.exit(banning(sys.argv[1:]))
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import JobCanceller
7
+
8
+
9
+ def main():
10
+ try:
11
+ canceller = JobCanceller()
12
+ canceller(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import JobLister
7
+
8
+
9
+ def main():
10
+ try:
11
+ lister = JobLister()
12
+ lister(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import JobShower
7
+
8
+
9
+ def main():
10
+ try:
11
+ shower = JobShower()
12
+ shower(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import JobSubmitter
7
+
8
+
9
+ def main():
10
+ try:
11
+ submitter = JobSubmitter()
12
+ submitter(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ import logging
3
+ import sys
4
+ import traceback
5
+
6
+ from fts4.cli import WhoAmI
7
+
8
+
9
+ def main():
10
+ try:
11
+ whoami = WhoAmI()
12
+ whoami(sys.argv[1:])
13
+ except Exception as e:
14
+ logging.critical(str(e))
15
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
16
+ traceback.print_exc()
17
+ sys.exit(1)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ setup.cfg
5
+ setup.py
6
+ src/cli/fts-client.ini
7
+ src/cli/fts-rest-ban
8
+ src/cli/fts-rest-delegate
9
+ src/cli/fts-rest-delete-submit
10
+ src/cli/fts-rest-server-status
11
+ src/cli/fts-rest-transfer-cancel
12
+ src/cli/fts-rest-transfer-list
13
+ src/cli/fts-rest-transfer-status
14
+ src/cli/fts-rest-transfer-submit
15
+ src/cli/fts-rest-whoami