Skip to main content

Small tool to sync package from different machines

Project description

PythonPackageSyncTool

PythonPackageSyncTool is a Python utility to "fix" requirements.txt.

It is used to make manipulation on requirements.txt that is produces by 'pip freeze'

Getting Help

QuickStart

First of all you should install alex_ber_utils (this dependency is used in setup.py).

pip3 install -U alex_ber_utils

Than:

pip3 install -U python-package-sync-tool

cd /opt/anaconda3/lib/python3.7/site-packages/alexber/reqsync/data/

Note: This is Path where you're actually install my utility, it can be different in your machine.

If you use venv it will look something like:

cd /opt/MyProject/venv/Lib/site-packages/alexber/reqsync

Alternatively you can create sctipt file for yourself, named, say, driver.py:

#!/usr/bin/python3

import alexber.reqsync.app as app

if __name__ == "__main__":
   app.main()

Than create file config.yml near your script (see data/config.yml) or provide all parameter using command line argruments. Use ':' in places where you should naturally write '==' (see explanation below).

Parammeters 'source' and 'destination' are required. You should also provide (requirements) file for 'source'.

mutual_exclusion has default value True.

Now, type

python3 -m alexber.reqsync.data --add=some_new_package:1.0.0

or if you're using script (driver.py) go the directory with the script and type

./driver.py --add=some_new_package:1.0.0

or if you install my tool to Anaconda/Python/venv that has it's bin folder is in the Path you can run

python_package_sync_tool --add=some_new_package:1.0.0

or alternativley

you can run

reqsync --add=some_new_package:1.0.0

This will run quick check whether package is not in remove list. If it is, the utility will fail. You can override this beahivor by supplying --mutual_exclusion=False.

Then, this will add some_new_package with version 1.0.0 to the requirements-dest.txt

Note:

Semicolomn and not equal sign is used here due to Python limitaion of usage of equal sign in the value in the command line.

You can specified multiple packages using comma delimiter.

You can specifiy path to your config file using --config_file.

It can be absolute or relative. If you're running using script (driver.py), that it can be relative to the directory whether you put your script. If you're running as the module (python3 -m), it can be relative to /opt/anaconda3/lib/python3.7/site-packages/alexber/reqsync/data/ (exact path can be different, see above).

You can supplied multiply packages by using comma:

python3 -m alexber.reqsync.data --add=some_new_package:1.0.0,another_new_package:2.0.0

or if you're using script (driver.py) go the directory with the script and type

./driver.py --add=some_new_package:1.0.0,another_new_package:2.0.0

Installing from Github

python3 -m pip install -U https://github.com/alex-ber/PythonPackageSyncTool/archive/master.zip

Optionally installing tests requirements.

python3 -m pip install -U https://github.com/alex-ber/PythonPackageSyncTool/archive/master.zip#egg=alex-ber-utils[tests]

Or explicitly:

wget https://github.com/alex-ber/PythonPackageSyncTool/archive/master.zip -O master.zip; unzip master.zip; rm master.zip

And then installing from source (see below).

Installing from source

python3 -m pip install . # only installs "required"
python3 -m pip install .[test] # installs dependencies for tests

From the directory with setup.py

python3 setup.py test #run all tests
pytest

Requirements

PythonPackageSyncTool requires the following modules.

  • Python 3.7+

  • PyYAML==5.1

Changelog

All notable changes to this project will be documented in this file.

#https://pypi.org/manage/project/python-package-sync-tool/releases/

[Unrelased]

@ Enhanced test @ Non-sorted requirements-src @ Empty add and remove

Add test

  • --add=zzzzzzzzzzzzzzzzzz,
  • --add=awscli
  • --add=awscli,
  • --add=not_exists
  • --add=not_exists,
  • --add=aaaaaaaaaaaaaaaaaaa
  • Change assert to more thoroguh
  • --remove=zzzzzzzzzzzzzzzzzz,
  • --remove=awscli
  • --remove=awscli,
  • --remove=not_exists
  • --remove=not_exists,

  • Test mutual exclusion

  • Test & fix use of buffer

[0.2.9] - 2019-05-22

  • Dependency alex-ber-utils bumped up to 0.2.5.

[0.2.8] - 2019-05-22

  • Dependency alex-ber-utils bumped up to 0.2.4.

[0.2.6] - 2019-05-22

  • Dependency alex-ber-utils bumped up to 0.2.3.

[0.2.5] - 2019-05-22

Changed

  • Fixed bug in setup.py, incorrect order between VERSION and UploadCommand (no tag was created on upload)
  • Dependency alex-ber-utils bumped up to 0.2.2.

[0.2.4] - 2019-05-22

Changed

  • Adding dependency alex-ber-utils 0.2.1 to README.md.

[0.2.3] - 2019-05-22

Changed

  • Upgrading urllib3, SQLAlchemy, pycrypto dependenies beacause of volnurabilities issues.

[0.2.2] - 2019-05-22

Changed

  • Fixing python-package-sync-tool.
  • Creating alias reqsync to python-package-sync-tool.
  • Some minour fixed.

[0.2.1] - 2019-05-22

Changed

  • Changing dependency version of alex-ber-utils to 0.2.1.

[0.2.0] - 2019-05-22

Changed

  • Only bumping up version.

[0.1.9] - 2019-05-22

Changed

  • Added alex-ber-utils as dependency.
  • Deleting old README-old.rst file.
  • requirements-src.txt updated.
  • Clarification added to README.md that alex_ber_utils should be installed first.
  • formatting CHANGELOG.MD (minor fix)
  • Added alternative of usage of python_package_sync_tool to README.md
  • Fixing bug that --add is empty
  • Factor out tests_data to seperate folder, use importlib.resources API.
  • Updated README-old.rst

[0.1.8] - 2019-05-20

Changed

  • README.md change, key '-U' added to pip3 install.

[0.1.7] - 2019-05-20

Removed

  • Some project cleanup.

Changed

  • CHANGELOG and REAMDE now use Markdown format.
  • REAMDE totally rewritten.
  • Fixing bugs in the core algorithm. Simplifying code.
  • Fixing correct handling of package adding to the buttom of the list.

[0.1.6] - 2019-05-20

Added

  • __init__.py file added to alexber.reqsync.data.

[0.1.5] - 2019-05-20

Added

  • Small tool to sync package from different machines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_package_sync_tool-0.2.9.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_package_sync_tool-0.2.9-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file python_package_sync_tool-0.2.9.tar.gz.

File metadata

  • Download URL: python_package_sync_tool-0.2.9.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for python_package_sync_tool-0.2.9.tar.gz
Algorithm Hash digest
SHA256 945e10ce0b0a6c92df87eb357c6962f76bab57fbdc5a5c80d25483c36cd91dad
MD5 065b25b15e5d045e44715e64f677c68a
BLAKE2b-256 613b0c8f4b24b0b8b8eb0a1c0e35bb88f3ec07144d47d91ab65abc79dcdc9e8c

See more details on using hashes here.

File details

Details for the file python_package_sync_tool-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: python_package_sync_tool-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for python_package_sync_tool-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 808b248f9d31282e2aaeafa45dba2d8185f737148a864e4402db0a7e18dc543d
MD5 d16f1c1a4bd63577d04852a03abc251f
BLAKE2b-256 81eb4c3320e364885a24b78d110f223d52c1441b60528636978883030b7ffda1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page