How do I extract API documentation from a Swift file? - swift

Swift has some ability to extract comments and documentation from a module.
Automatically generate the Swift interface for a compiled module
echo ":print_module CoreGraphics" | xcrun swift -deprecated-integrated-repl
How can I use these tools to print documentation for my own module?
Specifically, I'd like to use it in C.I. as a test of whether my modules are fully documented.

$ sudo gem install jazzy
$ jazzy
in the directory containing project file for the framework of your making per this: https://www.appcoda.com/swift-markdown/

Related

Obtain the version of a setup.cfg package

When using setup.py in a Python project, we can simply run
$ python3 setup.py --version
And this will give us the version field that is set in the setup.py file. This saves us using sed or something alike to read the version when we need to do so in a script.
I was wondering, is there an equivalent way in a setup.cfg project?
When you have only a setup.cfg, and no setup.py file, you can do this:
$ cat setup.cfg
[metadata]
name = mypkg
version = "0.1.2.3" # or `file: VERSION.txt` or `attr: mypkg.__version__` etc
$ python3 -c 'import setuptools; setuptools.setup()' --version
"0.1.2.3"
If the build backend is setuptools, then this approach will also work for a source tree with a pyproject.toml file.
Allow me to deviate from your actual question to offer what I thing is a better solution.
If you have to get the package version while developing (from an outside script) then you should split such information from your setup.cfg/setup.py.
You want setup.cfg (i.e, setuptools) to get that information from a file, for instance. Then, you can have the version just by reading the corresponding file.
Check the docs for details: https://setuptools.pypa.io/en/latest/userguide/declarative_config.html. Notice the #meta-1 anchor/note in that page.
Basically, you'll use attr or file attributes (in your setup.cfg metadata section) to get the version from another place:
version = file: VERSION.txt

Xcode project template and Swift Package dependencies

I'm trying to create a project template for Xcode from various sources and I wondered if it was possible to automatically add some Swift Package Manager dependencies ? I know it can be done with Cocoapod, but I didn't find anything regarding SPM.
Thanks.
Hope make sense
$ mkdir YourKit
$ cd YourKit
$ swift package init

ViennaRNA package's Perl module RNA.pm is required

I am running a toolkit named RNA Framework that requires ViennaRNA to be installed.
I have installed the ViennaRNA 2.4.14 to run a function named rf-fold, However, I constantly receive this error:
[!] Error: ViennaRNA package's Perl module RNA.pm is required.
Please ensure that `ViennaRNA package v2.2.0` (or greater) is installed and try again
When I check the missing RNA.pm module, I can see it is in this path:
/home/user/ViennaRNA/lib/site_perl/5.28.0/
when I check which Perl I am using (type: which Perl) it gives me:
/home/user/perl5/perlbrew/perls/perl-5.28.0/bin/perl
I tried different ways to install the ViennaRNA, including conda install -c bioconda viennarna, compile and make install from ViennaRNA-2.4.14.tar.gz file from the official website. But I cannot get over this error.
I saw a similar issue here and there is a solution (https://www.perlmonks.org/?node_id=1052814), but I don't fully understand the content. Thanks in advance for any help and sorry if it is a basic question!
I think the RNA.pm come with the package, when you download ViennaRNA-2.4.14.tar.gz and install following this link.
So I found my RNA.pm is in the directory:
/share/apps/ViennaRNA-2.1.7/compile-install/lib/site_perl/5.14.2/x86_64-linux-thread-multi/RNA.pm
And I modified the PERL5LIB environment variable by :
export PERL5LIB=/share/apps/ViennaRNA-2.1.7/compile-install/lib/
Problem solved!

Tcl call in perl script

I am executing a Perl script that makes use of use Tcl;. This currently invokes tcl8.4.
When I check my lib path, tcl8.5 is also found. I want use Tcl; to use tcl8.5 instead of tcl8.4. Can any one help me please?
From looking at the distro's Makefile.PL, I believe it uses a tclshX.Y found when the module is installed.
If a newer version 8.5 of Tcl has been installed since you installed the module, you could try to reinstall the module.
wget https://cpan.metacpan.org/authors/id/V/VK/VKON/Tcl-1.27.tar.gz
tar xvzf Tcl-1.27.tar.gz
cd Tcl-1.27
perl Makefile.PL
make test
make install
If that isn't sufficient, this module's Makefile.PL accepts arguments that help locate the correct tclsh. As mentioned in the distro's README file, you can see the accepted options using the following:
perl Makefile.PL --help

Swift Build no such command

python-swiftclient 3.0.0
Ubuntu 16.04.1 LTS
I type in swift build and it returns the list of swift commands and says at the end no such command. Could not find anyone describing this specific command line response.
That's because you use either python-swiftclient either your PATH is wrong.
If swift --version returns:
python-swiftclient 3.0.0
Then you aren't currently calling swift build system. Check this link and update your swift release here.
Else check that you call the right swift executable by doing:
which swift
The output is the executable you are actually calling.
Environmental variable failure
just
source ~/.bashrc
Seems that the entire swift environment is needed, so visit the swift download page, and choose your system (mine is ubuntu 18.04):
$ wget https://download.swift.org/swift-5.5.2-release/ubuntu1804/swift-5.5.2-RELEASE/swift-5.5.2-RELEASE-ubuntu18.04.tar.gz
$ tar -xf swift-5.5.2-RELEASE-ubuntu18.04.tar.gz
$ PATH=~/swift-5.5.2-RELEASE-ubuntu18.04/usr/bin:$PATH
This solution worked perfect for me.