Skip to content

Commit 76bd807

Browse files
Merge pull request #51 from byteskeptical/bbl_drop-py
Bump & Build
2 parents 97318c2 + cdaf4a8 commit 76bd807

18 files changed

Lines changed: 296 additions & 196 deletions

.github/workflows/document.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: true
1717
matrix:
1818
os: [ubuntu-latest]
19-
python-version: ['3.11']
19+
python-version: ['3.12']
2020

2121
steps:
2222
- name: Clone Repository
@@ -27,7 +27,7 @@ jobs:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Build
2929
run: |
30-
python -m pip install paramiko Sphinx sphinx_rtd_theme
30+
python -m pip install -e .[doc]
3131
mkdir _static
3232
make clean
3333
make html

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: true
1515
matrix:
1616
os: [ubuntu-latest]
17-
python-version: ['3.11']
17+
python-version: ['3.12']
1818

1919
steps:
2020
- name: Clone Repository
@@ -30,7 +30,7 @@ jobs:
3030
python -m pip install --upgrade pip
3131
pip install build paramiko
3232
- name: Build
33-
run: python -m build --sdist --wheel .
33+
run: python -m build --sdist --verbose --wheel .
3434
- name: Publish to Test PyPI
3535
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
3636
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
15+
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
16+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
17+
exclude:
18+
- os: macos-latest
19+
python-version: 3.7
1720

1821
steps:
1922
- name: Clone Repository
@@ -54,7 +57,6 @@ jobs:
5457
Set-Service -Name sshd -StartupType Automatic -Status Running
5558
Set-Service -Name ssh-agent -StartupType Automatic -Status Running
5659
ssh-keygen -f $Key --% -N "" -p -P ${{ secrets.PRIVATE_KEY }}
57-
ssh-add $Key
5860
if (!(Get-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
5961
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
6062
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
@@ -72,7 +74,6 @@ jobs:
7274
run: |
7375
python -m pip install --upgrade pip
7476
python -m pip install flake8
75-
python -m pip install -r requirements-dev.txt
7677
- name: Lint Trap
7778
run: |
7879
# stop the build if there are Python syntax errors or undefined names
@@ -81,7 +82,7 @@ jobs:
8182
flake8 . --count --exit-zero --max-complexity=14 --max-line-length=80 --statistics
8283
- name: SFTPretty
8384
run: |
84-
python -m pip install -e .
85+
python -m pip install -e .[dev,lint,test]
8586
- name: Tests
8687
run: |
8788
pytest -l -v --tb=long

.pytest.ini

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,36 @@ Example
107107
exceptions=socket.timeout, preserve_mtime=True, tries=11)
108108
109109
110+
+-------------------+--------------------------+
111+
| API Diff |
112+
+-------------------+--------------------------+
113+
| pysftp | sftpretty |
114+
+===================+==========================+
115+
| cwd | cd [#]_ |
116+
+-------------------+--------------------------+
117+
| makedirs | mkdir_p |
118+
+-------------------+--------------------------+
119+
| walktree | {local,remote}tree [#]_ |
120+
+-------------------+--------------------------+
121+
122+
.. [#] cwd() is a synonym for chdir(), use cd it's shorter and does the same thing.
123+
.. [#] Connection.walktree & sftp.walktree with explicit naming.
124+
.. [*] [path_advance, path_retreat, reparent] no longer needed.
125+
126+
110127
Additional Information
111128
----------------------
112-
* Project: https://github.com/byteskeptical/sftpretty
113-
* Download: https://pypi.python.org/pypi/sftpretty
114129
* Documentation: https://docs.sftpretty.com
130+
* Download: https://pypi.python.org/pypi/sftpretty
115131
* License: BSD
132+
* Project: https://github.com/byteskeptical/sftpretty
116133

117134
Requirements
118135
------------
119136
paramiko >= 1.17.0
120137

121138
Supports
122139
--------
123-
Tested on Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11
140+
Tested on Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12
124141

125142

docs/changes.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
Change Log
22
==========
33

4-
1.1.4 (current, released 2024-1-04)
4+
1.1.5 (current, released 2024-6-30)
55
-----------------------------------
6+
* added API diff table
7+
* added CnOpts.get_agentkey
8+
* adding support/testing for python 3.12
9+
* switched to pyproject.toml from setup.py
10+
11+
1.1.4 (released 2024-1-04)
12+
--------------------------
613
* missed the console logger in previous behavior change
714

815
1.1.3 (released 2023-12-11)
@@ -36,16 +43,16 @@ Change Log
3643
* test clean-up and major refactor
3744

3845
1.0.7 (released 2023-02-27)
39-
------------------------------------
46+
---------------------------
4047
* fix regression in put_d
4148

4249
1.0.6 (released 2023-01-15)
43-
------------------------------------
50+
---------------------------
4451
* allow CnOpts knownhost to be set to None directly
4552
* standardize on using is for None checks
4653

4754
1.0.5 (released 2022-11-29)
48-
------------------------------------
55+
---------------------------
4956
* added log_level to connection options
5057
* added compression security option for Transport
5158
* code optimizations in _start_transport() and _set_authentication()
@@ -54,7 +61,7 @@ Change Log
5461
* switched to using native logging module instead of paramiko util
5562

5663
1.0.4 (released 2022-09-24)
57-
------------------------------------
64+
---------------------------
5865
* added Windows Pure Path logic in put_d() and put_r() through localtree()
5966
* fix for regression in _sftp_channel() causing UnboundLocalError
6067
* improved support for dot notation in known_hosts and private key file

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
# built documents.
5555
#
5656
# The short X.Y version.
57-
version = '1.1.4'
57+
version = '1.1.5'
5858
# The full version, including alpha/beta/rc tags.
59-
release = '1.1.4'
59+
release = '1.1.5'
6060

6161
# The language for content autogenerated by Sphinx. Refer to documentation
6262
# for a list of supported languages.
@@ -172,7 +172,7 @@
172172
# If true, the index is split into individual pages for each letter.
173173
# html_split_index = False
174174

175-
# If true, links to the reST sources are added to the pages.
175+
# If true, links to the REST sources are added to the pages.
176176
# html_show_sourcelink = True
177177

178178
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.

docs/cookbook.rst

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
Getting Started
22
===============
33

4-
While in many ways, sftpretty is just a thin wrapper over paramiko's SFTPClient,
5-
there are a number of ways that we make it more productive and easier to
6-
accomplish common, higher-level tasks. The following snippets show where we
7-
add value to this great module. See the :doc:`sftpretty` docs for a complete
8-
listing.
4+
While in many ways, sftpretty is just a thin wrapper around paramiko's
5+
SFTPClient, there are a number of ways that we make it more productive
6+
to accomplish common, higher-level tasks. The following snippets show
7+
where we add value to this great module. See the :doc:`sftpretty` docs
8+
for a complete listing.
99

1010

1111
:meth:`sftpretty.Connection`
1212
----------------------------
1313
The Connection object is the base of sftpretty. It supports connections via
14-
username and password.
14+
username and password or private key.
1515

1616
.. code-block:: python
1717
@@ -65,21 +65,25 @@ How about a ``paramiko.AgentKey``? No problem, just set the private_key equal to
6565
6666
import sftpretty
6767
68-
with sftpretty.Connection('hostname', username='me', private_key=my_agentkey) as sftp:
68+
cnopts = sftpretty.CnOpts()
69+
keys = cnopts.get_agentkey()
70+
71+
with sftpretty.Connection('hostname', username='me', private_key=keys[1]) as sftp:
6972
#
7073
# ... do sftp operations
7174
#
7275
73-
The connection object allows the use of an IP address for the ``host`` and the
74-
ability to optionally set the ``port``, which defaults to 22, otherwise.
76+
The connection object allows the use of a hostname, IP address, or alias for
77+
the ``host`` and the ability to optionally set the ``port``, which defaults
78+
to 22, otherwise.
7579

7680

7781
:meth:`sftpretty.CnOpts`
7882
------------------------
79-
You can specify additional connection options using the sftpretty.CnOpts
80-
object. These options are advanced and not applicable to most uses, because of
81-
this they have been segmented from the Connection parameter list and made
82-
available via the CnOpts obj/parameter.
83+
Additional connection options can be configured using the sftpretty.CnOpts
84+
object. These are advanced options and are not applicable to most use cases.
85+
Due to this they have been segmented from the Connection object parameter list
86+
and made available via a modular object.
8387

8488
OpenSSH-style config objects are supported. The user's default home location
8589
``~/.ssh/config`` is always checked though not required unless an alternative
@@ -96,7 +100,7 @@ private key or password authentication.
96100
97101
Config options always take precedence over parameters if both exist. Keep in
98102
mind there will more than likely be a delta between the security option
99-
algorithms your verion of SSH supports and those supported by our underlying
103+
algorithms your verion of SSH supports and those supported by the underlying
100104
paramiko dependency.
101105

102106
AVAILABLE OPENSSH CONFIG OPTIONS:
@@ -327,7 +331,7 @@ want to return to later.
327331
:meth:`sftpretty.Connection.chmod`
328332
----------------------------------
329333
:meth:`.chmod` is a wrapper around paramiko's except for the fact it will
330-
takes an integer representation of the octal mode. No leading 0 or 0o
334+
take an integer representation of the octal mode. No leading 0 or 0o
331335
wanted. We know it's suppose to be an octal, but who really remembers that?
332336

333337
This way it is just like a command line ``chmod 644 readme.txt``
@@ -348,15 +352,16 @@ This way it is just like a command line ``chmod 644 readme.txt``
348352
349353
:meth:`sftpretty.Connection.chown`
350354
----------------------------------
351-
Allows you to specify just, gid, uid or both. If either gid or uid is None
352-
*default*, then sftpretty does a stat to get the current ids and uses that to
353-
fill in the missing parameter because the underlying paramiko method requires
354-
that you explicitly set both.
355+
Allows you to specify just, gid, uid or both as integers. If either gid or uid
356+
is None *default*, then sftpretty does a stat to get the current ids and uses
357+
that to fill in the missing parameter because the underlying paramiko method
358+
requiers that you explicitly set both.
355359

356-
**NOTE** uid and gid are integers and relative to each system. Just because you
357-
are uid 102 on your local system, a uid of 102 on the remote system most likely
358-
won't be your login. You will need to do some homework to make sure that you
359-
are setting these values as you intended.
360+
.. WARNING::
361+
uid and gid are relative to each system. A uid of 102 on your local system,
362+
is no assurance of a remote system's user uid even when the usernames
363+
match. You will need to do some homework to make sure that you are setting
364+
these values as you intended.
360365

361366

362367
:attr:`sftpretty.Connection.pwd`
@@ -418,7 +423,7 @@ number to use. Just like the unix cmd, `chmod` you use 744 not 0744 or 0o744.
418423
-------------------------------------
419424
A common scenario where you need to create all directories in a path as
420425
needed, setting their mode, if created. Mode argument works just like
421-
:meth:`.chmod`, that is an integer representation of the mode you want.
426+
:meth:`.chmod`, that is an integer representation of the octal mode you want.
422427

423428
.. code-block:: python
424429

docs/index.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,37 @@ Example
107107
exceptions=socket.timeout, preserve_mtime=True, tries=11)
108108
109109
110+
+-------------------+--------------------------+
111+
| API Diff |
112+
+-------------------+--------------------------+
113+
| pysftp | sftpretty |
114+
+===================+==========================+
115+
| cwd | cd [#]_ |
116+
+-------------------+--------------------------+
117+
| makedirs | mkdir_p |
118+
+-------------------+--------------------------+
119+
| walktree | {local,remote}tree [#]_ |
120+
+-------------------+--------------------------+
121+
122+
.. [#] cwd() is a synonym for chdir(), use cd it's shorter and does the same thing.
123+
.. [#] Connection.walktree & sftp.walktree with explicit naming.
124+
.. [*] [path_advance, path_retreat, reparent] no longer needed.
125+
126+
110127
Additional Information
111128
----------------------
112-
* Project: https://github.com/byteskeptical/sftpretty
113-
* Download: https://pypi.python.org/pypi/sftpretty
114129
* Documentation: https://docs.sftpretty.com
130+
* Download: https://pypi.python.org/pypi/sftpretty
115131
* License: BSD
132+
* Project: https://github.com/byteskeptical/sftpretty
116133

117134
Requirements
118135
------------
119136
paramiko >= 1.17.0
120137

121138
Supports
122139
--------
123-
Tested on Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11
140+
Tested on Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12
124141

125142
Contents
126143
--------

0 commit comments

Comments
 (0)