Skip to content

Commit 99cacc3

Browse files
committed
Added Python typing hints to most of the code
* Updated README about compatibility with Python 2.x * Created LICENSE and CONTRIBUTING files * Update CI pipeline to allow building only last commit and cancel builds in progress * Added more unit tests for Build
1 parent b1af616 commit 99cacc3

40 files changed

+836
-739
lines changed

.github/workflows/python-package.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,52 @@ name: CI_TEST
55

66
on:
77
push:
8+
paths:
9+
- 'requirements.txt'
10+
- '**.py'
11+
- '**.yml'
812
pull_request:
913
branches: [ "master" ]
1014

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1119
jobs:
1220
build:
1321

1422
runs-on: ubuntu-latest
1523
strategy:
1624
fail-fast: false
1725
matrix:
18-
python-version: ["3.8", "3.9", "3.10"]
26+
python-version: ["3.8", "3.9", "3.10", "3.11"]
1927
token: ["stable", "latest"]
2028

2129
steps:
22-
- uses: actions/checkout@v3
30+
- name: Harden Runner
31+
uses: step-security/harden-runner@1f99358870fe1c846a3ccba386cc2b2246836776 # v2.2.1
32+
with:
33+
egress-policy: block
34+
allowed-endpoints: >
35+
azure.archive.ubuntu.com:80
36+
esm.ubuntu.com:443
37+
files.pythonhosted.org:443
38+
ftp-chi.osuosl.org:443
39+
ftp-nyc.osuosl.org:443
40+
get.jenkins.io:443
41+
github.com:443
42+
mirror.xmission.com:443
43+
motd.ubuntu.com:443
44+
packages.microsoft.com:443
45+
ppa.launchpadcontent.net:443
46+
pypi.org:443
47+
updates.jenkins-ci.org:80
48+
updates.jenkins.io:443
49+
updates.jenkins.io:80
50+
51+
- name: Checkout
52+
uses: actions/checkout@v3
53+
2354
- name: Set up Python ${{ matrix.python-version }}
2455
uses: actions/setup-python@v3
2556
with:
@@ -51,9 +82,8 @@ jobs:
5182
5283
- name: Lint with flake8
5384
run: |
54-
# stop the build if there are Python syntax errors or undefined names
55-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
56-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics
85+
flake8 jenkinsapi/ --count --select=E9,F63,F7,F82 --ignore F821,W503,W504 --show-source --statistics
86+
flake8 jenkinsapi/ --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics
5787
5888
- name: Test with pytest
5989
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ coverage.xml
3030
*.war
3131
venv/
3232
tags
33+
.pytype/

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,3 @@ repos:
3232
- id: debug-statements
3333
- id: check-yaml
3434
files: .*\.(yaml|yml)$
35-
- repo: https://github.com/PyCQA/flake8
36-
rev: 5.0.4
37-
hooks:
38-
- id: flake8

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 PyContribs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ Python versions
4646

4747
The project has been tested against Python versions:
4848

49-
* 2.7
50-
* 3.4
51-
* 3.5
52-
* 3.6
53-
* 3.7
49+
* 2.7 - last version compatible with Python 2.7 is tagged Py2 in repository and available on PyPi as version 0.3.13
50+
* 3.8 - 3.11
5451

5552
Jenkins versions
5653
----------------
@@ -146,25 +143,26 @@ missing test dependencies:
146143
147144
virtualenv
148145
source .venv/bin/active
149-
(venv) python setup.py test
146+
(.venv) pip install -r requirements.txt
147+
(.venv) python setup.py test
150148
151149
Development
152150
-----------
153151

154-
* Make sure that you have Java_ installed.
152+
* Make sure that you have Java_ installed. Jenkins will be automatically
153+
downloaded and started during tests.
155154
* Create virtual environment for development
156155
* Install package in development mode
157156

158157
.. code-block:: bash
159158
160-
(venv) pip install -e .
161-
(venv) pip install -r test-requirements.txt
159+
(.venv) pip install -r test-requirements.txt
162160
163161
* Make your changes, write tests and check your code
164162

165163
.. code-block:: bash
166164
167-
(venv) tox
165+
(.venv) pytest
168166
169167
170168
Project Contributors

doc/source/rules_for_contributors.rst renamed to doc/CONTRIBUTING.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ The JenkinsAPI project welcomes contributions via GitHub. Please bear in mind th
66
Python compatibility
77
--------------------
88

9-
The project currently targets Python 2.6 and Python 2.7. Support for Python 3.x will be introduced soon. Please do not add any features which
10-
will break our supported Python 2.x versions or make it harder for us to migrate to Python 3.x
9+
The project currently targets Python 3.8+. Last version compatible with Python 2.7 is tagged as Py2.
10+
11+
Code formatting
12+
---------------
13+
14+
The project follows strict PEP8 guidelines. Please use a tool like black to format your code before submitting a pull request. Tell black to use 79 characters per line (black -l 79).
1115

1216
Test Driven Development
1317
-----------------------
1418

15-
Please do not submit pull requests without tests. That's really important. Our project is all about test-driven development. It would be
16-
embarrasing if our project failed because of a lack of tests!
19+
Please do not submit pull requests without tests. That's really important. Our project is all about test-driven development. It would be embarrasing if our project failed because of a lack of tests!
1720

1821
You might want to follow a typical test driven development cycle: http://en.wikipedia.org/wiki/Test-driven_development
1922

@@ -24,7 +27,7 @@ Features implemented without tests will be removed. Unmaintained features (which
2427
Check the CI status before comitting
2528
------------------------------------
2629

27-
We have a Travis CI account - please verify that your branch works before making a pull request.
30+
Project uses Github Actions, please verify that your branch passes all tests before making a pull request.
2831

2932
Any problems?
3033
-------------

0 commit comments

Comments
 (0)