rsrc
In what follows
pythonis an alias forpython3.5or any later version (python3.6and so on),pypyis an alias forpypy3.5or any later version (pypy3.6and so on).
Installation
Install the latest pip & setuptools packages versions:
- with
CPythonpython -m pip install --upgrade pip setuptools
- with
PyPypypy -m pip install --upgrade pip setuptools
User
Download and install the latest stable version from PyPI repository:
- with
CPythonpython -m pip install --upgrade rsrc
- with
PyPypypy -m pip install --upgrade rsrc
Developer
Download the latest version from GitHub repository
git clone https://github.com/lycantropos/rsrc.git
cd rsrc
Install dependencies:
- with
CPythonpython -m pip install --force-reinstall -r requirements.txt
- with
PyPypypy -m pip install --force-reinstall -r requirements.txt
Install:
- with
CPythonpython setup.py install
- with
PyPypypy setup.py install
Usage
The main idea is to use setuptools feature
called "Dynamic Discovery of Services and Plugins".
Assuming we have a package rsrc_ftp with structure
|_ rsrc_ftp.py
|_ setup.py
which adds support for URLs with ftp scheme
rsrc_ftp.py
from rsrc.models import Resource
def deserialize(string: str) -> Resource:
...
to make it available for rsrc package
we should register its entry point
(rsrc_ftp::deserialize function in our case)
setup.py
from setuptools import setup
from rsrc import plugins
plugins_entry_points = [
plugins.to_entry_point(id_=plugins.to_id('ftp'),
module_name='rsrc_ftp',
function_name='deserialize'),
]
setup(name='rsrc_ftp',
py_modules=['rsrc_ftp'],
entry_points={plugins.__name__: plugins_entry_points},
install_requires=['rsrc'])
After that the installation of rsrc_ftp package
will register rsrc_ftp::deserialize function in rsrc package
as an entry point for resources with ftp scheme
>>> from rsrc.base import deserialize
>>> ftp_resource = deserialize('ftp://path/to/resource')
>>> ftp_resource.url
URL('ftp', 'path', '/to/resource', '', '', '')
Plugins
rsrc_local-- adds support for local/local network resources.rsrc_web-- adds support for web resources (bothhttp&httpsschemes).
Development
Bumping version
Preparation
Install bump2version.
Pre-release
Choose which version number category to bump following semver specification.
Test bumping version
bump2version --dry-run --verbose $CATEGORY
where $CATEGORY is the target version number category name, possible
values are patch/minor/major.
Bump version
bump2version --verbose $CATEGORY
This will set version to major.minor.patch-alpha.
Release
Test bumping version
bump2version --dry-run --verbose release
Bump version
bump2version --verbose release
This will set version to major.minor.patch.
Notes
To avoid inconsistency between branches and pull requests,
bumping version should be merged into master branch
as separate pull request.
Running tests
Install dependencies:
- with
CPythonpython -m pip install --force-reinstall -r requirements-tests.txt
- with
PyPypypy -m pip install --force-reinstall -r requirements-tests.txt
Plain
pytest
Inside Docker container:
- with
CPythondocker-compose --file docker-compose.cpython.yml up
- with
PyPydocker-compose --file docker-compose.pypy.yml up
Bash script (e.g. can be used in Git hooks):
-
with
CPython./run-tests.sh
or
./run-tests.sh cpython -
with
PyPy./run-tests.sh pypy
PowerShell script (e.g. can be used in Git hooks):
- with
CPython.\run-tests.ps1
or.\run-tests.ps1 cpython
- with
PyPy.\run-tests.ps1 pypy
Release files for rsrc 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rsrc-0.1.3.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rsrc-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / rsrc-0.1.3.tar.gz
| Download URL | rsrc-0.1.3.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bba4e58b4947db30cd5c6ac8f888f84d9deb1e1b8889c0d1b040f51d5b89996b
|
|
BLAKE2b-256 checksum How to use checksums |
c31a13dba27b96a2d6e95a454f1053d980e50513bb8283f6f449712a3b3d9635
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.6
|
Release files / rsrc-0.1.3-py3-none-any.whl
| Download URL | rsrc-0.1.3-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
388d8c66b418fac33d19eb610bf40e5b49628b4af87a870b872f8507b4b9897a
|
|
BLAKE2b-256 checksum How to use checksums |
ddbddbf959fd955653902548e73cfbf965f18f2bb195eb0aac6fce1c18c78e6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.6
|