Giter VIP home page Giter VIP logo

wlc's People

Contributors

adriandiazgar avatar amab avatar deepsource-autofix[bot] avatar dependabot-preview[bot] avatar dependabot[bot] avatar dragosv avatar eighthave avatar fsoedjede avatar iburnette avatar jojurajan avatar kamilgrymuza avatar m-aciek avatar nijel avatar pre-commit-ci[bot] avatar renovate[bot] avatar sbesedkov avatar superdross avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wlc's Issues

Batch download

Add support for downloading all translations from component/project, with option to specify it's parameters (for example file format).


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

exception when no commandline arguments passed

➔ wlc version
version: 0.5

➔ wlc 
Traceback (most recent call last):
  File "/usr/bin/wlc", line 9, in <module>
    load_entry_point('wlc==0.5', 'console_scripts', 'wlc')()
  File "/usr/share/python3.5/site-packages/wlc/main.py", line 545, in main
    command = COMMANDS[args.cmd](args, config, stdout)
KeyError: None
➔ 

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

dockerfile
Dockerfile
  • python 3.12.4-alpine
github-actions
.github/workflows/closing.yml
  • peter-evans/create-or-update-comment v4
  • peter-evans/create-or-update-comment v4
  • ubuntu 22.04
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
  • ubuntu 22.04
.github/workflows/dockerimage.yml
  • actions/checkout v4
  • docker/setup-buildx-action v3.6.1
  • actions/cache v4
  • actions/checkout v4
  • docker/setup-qemu-action v3.2.0
  • docker/setup-buildx-action v3.6.1
  • actions/cache v4
  • actions/checkout v4
  • docker/setup-buildx-action v3.6.1
  • actions/cache v4
  • actions/checkout v4
  • docker/setup-buildx-action v3.6.1
  • actions/cache v4
  • actions/checkout v4
  • anchore/scan-action v4
  • github/codeql-action v3
  • actions/upload-artifact v4
  • actions/checkout v4
  • docker/setup-buildx-action v3.6.1
  • actions/cache v4
  • actions/checkout v4
  • aquasecurity/trivy-action 0.24.0
  • github/codeql-action v3
  • actions/upload-artifact v4
  • actions/checkout v4
  • docker/setup-qemu-action v3.2.0
  • docker/setup-buildx-action v3.6.1
  • actions/cache v4
  • actions/cache v4
  • actions/cache v4
  • actions/checkout v4
  • docker/setup-qemu-action v3.2.0
  • docker/setup-buildx-action v3.6.1
  • actions/cache v4
  • actions/cache v4
  • actions/cache v4
  • docker/login-action v3
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
.github/workflows/label-sync.yml
  • actions/checkout v4
  • srealmoreno/label-sync-action v1
  • ubuntu 22.04
.github/workflows/labels.yml
  • peter-evans/create-or-update-comment v4
  • peter-evans/create-or-update-comment v4
  • peter-evans/create-or-update-comment v4
  • peter-evans/create-or-update-comment v4
  • peter-evans/create-or-update-comment v4
  • ubuntu 22.04
.github/workflows/pre-commit.yml
  • actions/checkout v4
  • actions/cache v4
  • actions/setup-python v5
  • ubuntu 22.04
.github/workflows/pull_requests.yaml
  • peter-evans/enable-pull-request-automerge v3
.github/workflows/readme-sync.yml
  • actions/checkout v4
  • peter-evans/dockerhub-description v4
  • ubuntu 22.04
.github/workflows/setup.yml
  • actions/checkout v4
  • actions/setup-python v5
  • ubuntu 22.04
.github/workflows/stale.yml
  • actions/stale v9
  • ubuntu 22.04
.github/workflows/super-linter.yml
  • actions/checkout v4
  • github/super-linter v5.0.0
  • ubuntu 22.04
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-python v5
  • codecov/codecov-action v4
pep621
pyproject.toml
  • requests >=2.25.0
  • urllib3 >=1.26
  • lint/pre-commit ==3.8.0
  • test/responses >=0.10.1,<0.26.0
  • test/build ==1.2.1
  • test/twine ==5.1.1
  • setuptools >=61.2
pre-commit
.pre-commit-config.yaml
  • pre-commit/pre-commit-hooks v4.6.0
  • adrienverge/yamllint v1.35.1
  • astral-sh/ruff-pre-commit v0.5.5
  • asottile/blacken-docs 1.18.0
  • macisamuele/language-formatters-pre-commit-hooks v2.14.0
  • executablebooks/mdformat 0.7.17
  • igorshubovych/markdownlint-cli v0.41.0
  • fsfe/reuse-tool v4.0.3
regex
.pre-commit-config.yaml
  • mdformat-gfm 0.3.6
  • mdformat-black 0.1.1
  • mdformat-shfmt 0.1.0
.github/workflows/dockerimage.yml
  • docker/buildx v0.16.2
  • docker/buildx v0.16.2
  • docker/buildx v0.16.2
  • docker/buildx v0.16.2
  • docker/buildx v0.16.2
  • docker/buildx v0.16.2
  • docker/buildx v0.16.2

  • Check this box to trigger a request for Renovate to run again on this repository

Expose category in Python API

Describe the problem

I'd like to programmatically access the category name, to be able to filter components by category later on.

Describe the solution you'd like

wlc exposing the category endpoints in Python API.

Describe alternatives you've considered

HTTP requests not using the wlc, but some other general library.

Screenshots

No response

Additional context

No response

CERTIFICATE_VERIFY_FAILED running wlc

Describe the issue

When running wlc I get an SSL error stating the certificate verification failed.

My Weblate installation is running on a server with a valid ssl certificate. Accessing the API using e.g. Chrome or Postman works.

I've installed certifi and ran the Install\ Certificates.command I've found while searching for a solution. The error when running wlc remains.

Running the WLC docker image results in the same error.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

Run wlc list-projects

Expected behavior

Working API output

Screenshots

Full output:

wlc --url https://..../api list-projects
Request failed: HTTPSConnectionPool(host='....', port=443): Max retries exceeded with url: /api/projects/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)')))

Exception traceback

No response

Additional context

No response

Docker tag latest is missing

WeblateOrg/weblate@cd388b0

williamdes@williamdes:/mnt/Dev/@phpmyadmin/theREALphpMyAdminREPO$ docker run --rm weblate/wlc
Unable to find image 'weblate/wlc:latest' locally
docker: Error response from daemon: manifest for weblate/wlc:latest not found: manifest unknown: manifest unknown.
See 'docker run --help'.
williamdes@williamdes:/mnt/Dev/@phpmyadmin/theREALphpMyAdminREPO$ docker pull weblate/wlc
Using default tag: latest
Error response from daemon: manifest for weblate/wlc:latest not found: manifest unknown: manifest unknown

Why: there is no latest tag on docker hub

Fix: replace weblate/wlc by weblate/wlc:edge in docs

Please also document how to bind a local config file .weblate using docker

docker run -v $(pwd):/home/weblate --rm weblate/wlc:edge show

Source for /home/weblate:

wlc/Dockerfile

Line 13 in e2139fb

WORKDIR /home/weblate

Feel free to add this example

$ docker run -v $(pwd):/home/weblate --rm weblate/wlc:edge show
branch: QA_5_1
file_format: po
filemask: po/*.po
git_export: https://hosted.weblate.org/git/phpmyadmin/5-1/
license: GPL-3.0-or-later
license_url: https://www.gnu.org/licenses/gpl-3.0-standalone.html
name: 5.1
new_base: po/phpmyadmin.pot
project: phpmyadmin
repo: https://github.com/phpmyadmin/phpmyadmin.git
slug: 5-1
source_language: en
template: 
url: https://hosted.weblate.org/api/components/phpmyadmin/5-1/
vcs: git
web_url: https://hosted.weblate.org/projects/phpmyadmin/5-1/

Creating projects and components

Creating projects and components is now supported by the API, so it would be great to have this supported in the wlc as well.

Add support for file downloads

Moved from https://github.com/nijel/weblate/issues/1293

We would like to establish a workflow where we have more control over the time when translations are pulled into the main project and would find it handy to use wlc to download the files.

Right now, we use a seperate git repo that is included through a submodule, but submodules always need a bit more attention than a simple folder would.

How are the ideas on implementing this?

Filter components and translations

While the API offer filtering of components that are part of a project (GET /api/projects/(string: project)/components/) and translations that are part of a component (GET /api/components/(string:project)/(string:component)/translations/) the command line does not supports it.

All methods returns an empty dict

Hi,
I'm currently writing a Python script to automatically download translation files from Weblate but all methods returns an empty dict.
For example this code:

import wlc
import wlc.config
config = wlc.config.WeblateConfig('weblate')
config.load('.weblate')

w = wlc.Weblate(config=config)
for i in w.list_projects():
    print(i)

with this .weblate file:

[weblate]
url = https://translate.maicol07.it/api/
key = MY_API_KEY
project = scheduled-exams
component = webapp
translation = scheduled-exams/webapp

[keys]
https://translate.maicol07.it/api/ = MY_API_KEY

returns:

{}
{}
{}
{}

What is wrong?
Thanks

Python error when trying to run a weblate command

Describe the issue

When I try to use the wlc executable after a pip install, I got the following error:

Traceback (most recent call last):
  File "/home/agacon/.local/bin/wlc", line 8, in <module>
    sys.exit(main())
  File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 829, in main
    command = COMMANDS[args.command](args, config, stdout, stdin)
  File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 143, in __init__
    self.wlc = wlc.Weblate(config=config)
  File "/home/agacon/.local/lib/python3.8/site-packages/wlc/__init__.py", line 105, in __init__
    self.retries = Retry(
TypeError: __init__() got an unexpected keyword argument 'allowed_methods'

The command I run the following:
wlc --url https://weblate.osgeo.org/api --key MYAPIKEY ls
If I run the same command using the docker image, it works. What did I miss?

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. Go to '...'
  2. Scroll down to '...'
  3. Click on '...'
  4. See error

Expected behavior

No response

Screenshots

No response

Exception traceback

Traceback (most recent call last):
  File "/home/agacon/.local/bin/wlc", line 8, in <module>
    sys.exit(main())
  File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 829, in main
    command = COMMANDS[args.command](args, config, stdout, stdin)
  File "/home/agacon/.local/lib/python3.8/site-packages/wlc/main.py", line 143, in __init__
    self.wlc = wlc.Weblate(config=config)
  File "/home/agacon/.local/lib/python3.8/site-packages/wlc/__init__.py", line 105, in __init__
    self.retries = Retry(
TypeError: __init__() got an unexpected keyword argument 'allowed_methods'


### Additional context

_No response_

Requirements issue

Hi.

Noticing these issues in the build process.

===>  Configuring for py36-wlc-1.1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 25, in <module>
    VERSION = __import__("wlc").__version__
  File "/wrkdirs/usr/ports/devel/py-wlc/work-py36/wlc-1.1/wlc/__init__.py", line 23, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
*** Error code 1\
===>  Configuring for py36-wlc-1.2
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 26, in <module>
    VERSION = __import__("wlc").__version__
  File "/wrkdirs/usr/ports/devel/py-wlc/work-py36/wlc-1.2/wlc/__init__.py", line 25, in <module>
    import dateutil.parser
ModuleNotFoundError: No module named 'dateutil'
*** Error code 1

As they are called in __init__.py, they need to be on setup_requires(), not only on install_requires(), or the init code needs to be moved to another place.

Regards.

Error: the following arguments are required: cmd

I just installed wlc 1.5 on Windows 10.
It's hard for me to understand how to proceed.
The help at https://docs.weblate.org/en/latest/wlc.html is not helping a Windows user.

Anyway, I have created a weblate.ini file.
When I run in PowerShell:

wlc --config "C:\Users\Michele\Documents\app\weblate.ini"

the answer is always:

usage: wlc [-h] [--format {text,csv,json,html}] [--version] [--debug] [--config CONFIG] [--config-section CONFIG_SECTION] [--key KEY] [--url URL]
           {version,list-projects,list-components,list-languages,list-translations,show,delete,ls,commit,push,pull,reset,cleanup,repo,changes,stats,lock-status,lock,unlock,download,upload}
           ...
wlc: error: the following arguments are required: cmd

Warning about deprecation license_file parameter

Describe the issue

SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. Try to install with python/setuptools
  2. See error

Additional context

Python 3.10, setuptools 63.4.3

Provide root access to the docker image

Describe the issue

Comment at https://github.com/WeblateOrg/wlc/pull/44/files#r828286201

One good reason to provide root access within the container is to give GitLab/Github/... users a root access to install additional packages before using weblate.
In my case I just need to apk add make (because I have to run one wlc download command per language) which is not possible if I've no root access within the container.

See also the limitation of GitLab wrt override the image selected user: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2750

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. docker run -ti --entrypoint=/bin/sh weblate/wlc -c whoami

Expected behavior

root
(So that apk works too)

Screenshots

No response

Exception traceback

weblate

Additional context

No response

Transifex importer

For projects migrating from Transifex it would be useful to have migration tool to import translations from Transifex into Weblate.

There is API for the download: https://docs.transifex.com/api/translations

Example curl snippet to download colorhug-client Czech translation:

curl -L --user api:TOKEN https://www.transifex.com/api/2/project/colorhug-client/resource/master/translation/cs/?file

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

"pip3 install wlc" fails with OSError "No such file or directory"

Describe the issue

I already tried

Describe the steps you tried to solve the problem yourself.

  • I've read and searched the docs and did not find the answer there.
    If you didn’t try already, try to search there what you wrote above.

To Reproduce the issue

Steps to reproduce the behavior:

  1. Open a windows command prompt admin or non-admin doesn't make a difference
  2. run "pip3 install wlc"
  3. pip installs all requirements and fails on "Installing collected packages: wlc"

Expected behavior

No Error

Output after the second run

The first run just shows the additional downloads.

Collecting wlc
  Using cached wlc-1.10-py3-none-any.whl (84 kB)
Requirement already satisfied: pyxdg in c:\program files\python39\lib\site-packages (from wlc) (0.27)
Requirement already satisfied: python-dateutil in c:\program files\python39\lib\site-packages (from wlc) (2.8.1)
Requirement already satisfied: argcomplete in c:\program files\python39\lib\site-packages (from wlc) (1.12.2)
Requirement already satisfied: requests in c:\program files\python39\lib\site-packages (from wlc) (2.25.1)
Requirement already satisfied: six>=1.5 in c:\program files\python39\lib\site-packages (from python-dateutil->wlc) (1.15.0)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\program files\python39\lib\site-packages (from requests->wlc) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\program files\python39\lib\site-packages (from requests->wlc) (2020.12.5)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\program files\python39\lib\site-packages (from requests->wlc) (1.26.3)
Requirement already satisfied: idna<3,>=2.5 in c:\program files\python39\lib\site-packages (from requests->wlc) (2.10)
Installing collected packages: wlc
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\programme\\python39\\Lib\\site-packages\\wlc\\test_data\\api\\projects-hello-components--POST--branch=master--file_format=po--filemask=po--.po--git_export=--license=--license_url=--name=Weblate--slug=weblate--repo=file----home-nijel-work-weblate-hello--template=--new_base=--vcs=git'

The file with the endless name in fact doesn't exist.

KeyError: 'source_language'

wlc list-projects fails with:

name: Freeplane
slug: freeplane
Traceback (most recent call last):
  File "/usr/bin/wlc", line 11, in <module>
    load_entry_point('wlc==1.2', 'console_scripts', 'wlc')()
  File "/usr/lib/python3/dist-packages/wlc/main.py", line 703, in main
    command.run()
  File "/usr/lib/python3/dist-packages/wlc/main.py", line 336, in run
    self.print(list(self.wlc.list_projects()))
  File "/usr/lib/python3/dist-packages/wlc/main.py", line 225, in print
    self.print_text(value, header)
  File "/usr/lib/python3/dist-packages/wlc/main.py", line 203, in print_text
    "{0}: {1}".format(key, self.format_value(getattr(item, key)))
  File "/usr/lib/python3/dist-packages/wlc/__init__.py", line 245, in __getattr__
    return self._data[name]
KeyError: 'source_language'

Reported version (wlc --version):
wlc 1.2

This was installed via Ubuntu 20.10 official package

Docker image for wlc

It would be very handy to have a docker image for wlc. I this way the client machine does not need to have python, pip or other software specific tooling installed.

Being able to run something as:

docker run --rm weblate/wlc  commit

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Test seems broken

Describe the issue

Traceback (most recent call last):
File "XXX/wlc-1.13/wlc/test_main.py", line 31, in
from .test_base import APITest
ImportError: attempted relative import with no known parent package

Traceback (most recent call last):
File "XXX/wlc-1.13/wlc/test_wlc.py", line 37, in
from .test_base import APITest
ImportError: attempted relative import with no known parent package

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. Run test
  2. See first error
  3. Replace "from .test_base import APITest" to "from wlc.test_base import APITest" in test_main.py
  4. Run test again
  5. See second error

Expected behavior

No response

Screenshots

No response

Exception traceback

No response

Additional context

No response

Warning about test_data/* installing

Describe the issue

Installing 'wlc.test_data' as data is deprecated, please list it in packages.
Installing 'wlc.test_data.api' as data is deprecated, please list it in packages.
Installing 'wlc.test_data.mock' as data is deprecated, please list it in packages.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. Try to install
  2. See warning

Expected behavior

No response

Screenshots

No response

Exception traceback

No response

Additional context

Changes described: https://setuptools.pypa.io/en/latest/userguide/datafiles.html

I fix in setup.cfg:

 [options]
-packages = wlc
-python_requires = >=3.6
+packages =
+    wlc
+    wlc.test_data
+    wlc.test_data.api
+    wlc.test_data.mock
 package_dir = wlc=wlc
-include_package_data = 1
+python_requires = >=3.6
+include_package_data = True

Upload silently fails

$ cat po/merch.json 
{
    "merch": "Material promocional"
}
$ wlc upload habitica/merch/gl -i po/merch.json --overwrite
$ wlc download habitica/merch/gl -o po/merch.json
$ cat po/merch.json 
{
    "merch": "Material de promoción"
}

I can reproduce this with 1.13 and with 71e636d. I can also reproduce it if I use GNU Gettext (PO) as exchange format instead.

This is against https://translate.habitica.com/ (Weblate 4.15.2).

API result within the wlc code is {'not_found': 0, 'skipped': 1, 'accepted': 0, 'total': 1, 'result': False, 'count': 1}. So the translation is being skipped, no idea why.

KeyError: 'result' on wlc commit

Describe the issue

I'm on latest released wlc and using a relatively new self-hosted Weblate instance, and have the problem that the results don't have a "result" attribute, e.g. if I pull or commit:

wlc pull --url=XYZ project
Traceback (most recent call last):
  File "bin/wlc", line 8, in <module>
    sys.exit(main())
  File "wlc/main.py", line 833, in main
    command.run()
  File "wlc/main.py", line 514, in run
    self.check_result(result, "Failed to pull changes!")
  File "wlc/main.py", line 290, in check_result
    if not result["result"]:
KeyError: 'result'

I looked at the code here and the wlc code still expects "result", but when I skim the code in api, I couldn't find anywhere where it adds a "result" attribute. The tests don't seem to look for that attribute either. Am I missing something or is there some kind of mismatch between the command-line client and the server?

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

lock single language of a single component

Hi. Is is possible to lock a single language of a single component?
I've managed to lock a whole component, but it's too wide.

Overall, I find the doc a but confusing. Wlc is supposed to operate on "objects". But when you "wlc ls" or 'list-components", etc, it's not quite clear what is the name of the "object" that is supposed to be used on command line.

ModuleNotFoundError: No module named 'xdg.BaseDirectory'

Describe the issue

$ dpkg -l python3-xdg
ii  python3-xdg    0.26-1ubuntu1 all          Python 3 library to access freedesktop.org standards

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

Using Ubuntu 20.04.4 LTS pyxdg version.

Expected behavior

requirements.txt should put a version constraint.

Screenshots

No response

Exception traceback

No response

Additional context

It works using apt purge + pip3 install --user pyxdg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.