Giter Club home page Giter Club logo

Comments (14)

klieret avatar klieret commented on May 23, 2024 1

I can confirm that. I've opened an issue for the matplotlib repository. blacken-docs worked perfectly on this one.

from hsf-training-ml-webpage.

welcome avatar welcome commented on May 23, 2024

Thanks for opening your first issue here! If you have any questions, feel free to mention one of the conveners, previous contributors, or attend our weekly meeting (see https://hepsoftwarefoundation.org/workinggroups/training.html). Also, sometimes issues go unnoticed, so don't hesitate to @mention some of us, if we do not come back to you within a few days.

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

Agreed!

from hsf-training-ml-webpage.

amanmdesai avatar amanmdesai commented on May 23, 2024

I had a question. Is there a way/package to run some code on the entire episode/lesson, and it automatically updates the python parts and formats them?

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

Yes, I think https://github.com/asottile/blacken-docs does exactly that (though it might depend a bit on which markdown syntax is being used for the code inclusion).

Feel free to try with that!

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

Yeah, I'm not sure if it understands the

~~~
import pandas as pd # to store data as dataframe
import numpy as np # for numerical calculations such as histogramming
import matplotlib.pyplot as plt # for plotting
~~~
{: .language-python}

inclusions. Can you confirm that?

from hsf-training-ml-webpage.

amanmdesai avatar amanmdesai commented on May 23, 2024

Thanks for the answer.

I tried the following test based on your question.

I tried running blacken-doc on the above test snippet which I stored in a .md file.
Nothing happens. No reformatting. It doesn't give any error.

  1. If I change the comment position by introducing a , blacken-docs will not re-format.
  2. Although it works well if we use the following:
# ~~~
import pandas as pd  # to store data as dataframe
import numpy as np  # for numerical calculations such as histogramming
import matplotlib.pyplot as plt  # for plotting
# ~~~
  1. Using black directly on the snippet, re-formats the snippet: here is the black reformatted snippet
import pandas as pd  # to store data as dataframe
import numpy as np  # for numerical calculations such as histogramming
import matplotlib.pyplot as plt  # for plotting

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

I assume the second thing is then a .py file, right?

Yes, also according to blacken-docs readme the ~~~ doesn't seem to be recognized...

I'll try to fork the project and see if we can easily hack together a version that support this

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

I've forked blacken-docs: If you install my version (by cloning the repo and then pip install .), blacken-docs will recognize the other syntax as well.

I'll see if I can bring it into the official version...

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

I've also just tested that and already fixed the issues in this webpage, but I'm sure our other repositories have similar problems...

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

So if you're interested in this @amanmdesai feel free to apply my modified blacken-docs there :)

Having best-practice formatting is definitely something that we should do!

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

I've forked blacken-docs: If you install my version (by cloning the repo and then pip install .), blacken-docs will recognize the other syntax as well.

I'll see if I can bring it into the official version...

Forgot to push. Please version as of now :)

from hsf-training-ml-webpage.

klieret avatar klieret commented on May 23, 2024

See adamchainz/blacken-docs#177

from hsf-training-ml-webpage.

amanmdesai avatar amanmdesai commented on May 23, 2024

Hi, thanks for the updates.

there seems to be one more issue:

pip install ...

does not seem to work. I see the following error on a different file.

command : blacken-docs 05-mplhep.md
Result 05-mplhep.md:27: code block parse error Cannot parse: 1:4: pip install mplhep

needs more fixing maybe?

from hsf-training-ml-webpage.

Related Issues (7)

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.