Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version with Python support? #9

Open
501st-alpha1 opened this issue Apr 16, 2020 · 8 comments
Open

Version with Python support? #9

501st-alpha1 opened this issue Apr 16, 2020 · 8 comments

Comments

@501st-alpha1
Copy link
Contributor

Would it be possible to get a version of this image with Python support? Or would that depend on getting a version with Python support built as an Alpine package?

I assume not everyone would want to include Python support, so I'd be content with using a separate tag for that.

@alberto56
Copy link
Contributor

Hi @501st-alpha1 I'm not sure it's a good idea to include Python support in this image. The Docker approach is generally to use different images/containers if you need different software, something like. Unless I'm missing something, I would suggest you use the official python image, something like this:

Let's say you have a Python script called your-script.py in your folder which generates a file called sample.dat, you could something like this:

docker run -it --rm --name my-running-script \
  -v "$PWD":/usr/src/myapp -w /usr/src/myapp \
  python:3 python your-script.py
docker run --rm -v $PWD:/data \
  dcycle/ledger:1 -f /data/sample.dat reg

If you still think you need python in this image, please provide a detailed usecase which cannot be met by using the official python docker image.

@501st-alpha1
Copy link
Contributor Author

Sorry, I wasn't clear. I meant could we get an image that has Ledger built with Python support. Ledger supports embedding Python within your Ledger file.

Sorry for the confusion.

@alberto56
Copy link
Contributor

Thanks for the clarification! Yes that would definitely be a good addition, I added a new branch dev/9 and this pull request. The automated tests are passing so can you please test this and see if it works?

@alberto56
Copy link
Contributor

Also, I normally like to add some examples and run automated tests on them, at https://github.com/dcycle/docker-ledger/tree/master/examples

Perhaps you can suggest a very simple example which uses python, which we can add to the examples, and the automated tests to make sure this works.

@501st-alpha1
Copy link
Contributor Author

Sure, I can take a look at that when I get a chance, and can see about adding some examples.

However, I don't think the PR will work as is, because Ledger also has to be built with Python support. I think it's ./acprep --python or something if building from source; I don't think the current Alpine package was built with that enabled.

@alberto56
Copy link
Contributor

I updated the pull request with a simple test that should pass, and like you said, it fails with:

While parsing file "/data/python.dat", line 4:
Error: 'python' directive seen, but Python support is missing
While parsing file "/data/python.dat", line 16:
While evaluating value expression:
  check_path(value)
  ^^^^^^^^^^^^^^^^^

as can be seen in the failing test report

I opened ledger/ledger#1886 to get more guidance on this, as I cannot find instructions online. If you figure out how to do this, please let me know and I'll install it, seems like a great feature.

@501st-alpha1
Copy link
Contributor Author

Yeah I can't remember now where I learned how to build it with Python support, and I don't see any obvious instructions in the README or the docs. But I do have it working in my locally built-from-source version of Ledger, so presumably I could figure out how to do it again.

The main question is whether you'd prefer to have a Dockerfile that builds Ledger from source, or if you want to try to get an official Alpine package built that way. I don't have much experience with Alpine packaging, so I'm not sure what's involved in the latter, but if you want to try the former, I might be able to get that working.

@alberto56
Copy link
Contributor

The former (built from source) is fine; feel free to try a pull request which looks a bit like dev/9 but where tests pass, or paste your instructions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants