Best organization of a Sage Project / Module - sage

I would like to organize my Sage project in a way that reflects best practices. For example, for Python projects https://www.patricksoftwareblog.com/structure-of-a-python-project/ recommends
project_name/
project_name/
__init__.py
...source code files...
test/
__init__.py
...unit test files...
docs/
...documentation files...
project_name.py
README.md
LICENSE.md
requirements.txt
.gitignore
How should this model be modified if I would like a package that can be imported to Sage and a sample jupyter notebook showcasing functionality?

The general rules for Python packages apply.
If deposited on PyPI, the package will be installable via pip with
$ pip install PACKAGE_NAME
There is a template for a Sage package at
https://github.com/sagemath/sage_sample
with a lot of tips in its README.
See also some utilities at
https://github.com/sagemath/sage-package

Related

How to test composer package in developpement, like for symfony packages

i am wondering how the contributions on framework like symfony or laravel works.
For example if i clone the symfony repository i'll have the src folder that create the package. And when this package is used there is other folder like in the symfony skeleton.
So how is it possible to develop and test the code without publishing the package ?
You can write tests for the package code and also install the package from your local directory to kind of do the integration testing. Also you can run composer require symfony/package:dev-master#<commit hash> to install specific commit package version.
This is answer would be helpful: https://stackoverflow.com/a/29995226/4620016

Source of qt5 cmake Config-file Packages

Trying to build qt5 with buildroot. I need to download the source so that everything is compiled through the cross-compiler.
One of my project relies on the 'Config-file Packages' (CMake helper config file) provided by Qt5 in the binary tarball at this location Qt5.8.0/5.8/gcc_64/lib/cmake.
Problem: I can't find that folder anywhere in the source. When I take one example file (e.g. Qt5Config.cmake), I can't find any git repo hosting it.
Had a look at Ubuntu packages and it is being distributed in qtbase5-dev. When I look at this package documentation, it says it is using qtbase-opensource-src 5.5.1+dfsg-16ubuntu7.4 as the source package. Had a look at the source package for 5.8 but the cmake files are not there.
I could upload those files in an ad-hoc git repo, but that just seems weird that those files are not hosted by the qt repo.
What am I missing?
The cmake files are generated while build. On Linux the results are installed to qt/lib/cmake.

Where does meteor stores its packages?

I have a meteor 1.0 app. I've added a bunch of packages, for example: meteor add kevohagan:ramda. But I cannot find it anywhere. I can't even find it on my system.
In my project:
$> meteor list
kevohagan:ramda 0.1.2 A practical functional library for Javascript programmers.
meteor-platform 1.2.0 Include a standard set of Meteor packages in your app
...
$> ls packages
ls: packages: No such file or directory
$> mdfind ramda.js # file added by the package
# no results
Where are they ?
If you add a package via meteor add author:pkg it will be added to the meteor installation (e.g. ~/.meteor/packages); here you can find different versions of the package. In your project home, the package name will be added to the .meteor/packages file.
Later, if run your project, the package will be added to the build directory (and of course only one version can be found here).
I think that they all are in
.meteor/local/build/programs/server/packages
but they are ninified, and the file names are changed, like "kevohagan_ramda.js" or "meteor-platform.js"
If you check out your project folder then you'll find two 'packages' folders. One at the root of your project and the other deep down inside .meteor. Below I've listed both of them.
.meteor/packages //this consist of the packages that you built yourself or other top-level packages like spinner & iron:router
.meteor/local/build/programs/server/packages //other packages

How do I build my own phar archive for PHPUnit?

I've downloaded the current version of PHPUnit from Github and made a small customization. I now want to create my own phar archive for it. I see there is a build.xml file included with PHPUnit that looks like it contains the directives needed for creation of the phar archive, but after reading up on phar for a bit, it's still not clear to me what the commands are to make it happen for PHPUnit. Any advise is appreciated!
Cloning the repo. I guess you have this already but to be complete
$ git clone https://github.com/sebastianbergmann/phpunit
Change into it
$ cd phpunit
A build.xml files means (mostly) that Ant is used as build management system. To figure out which targets the project (-p) provides just ask ant itself:
$ ant -p
Then you should get this output:
Buildfile: /private/tmp/phpunit/build.xml
Main targets:
clean Cleanup build artifacts
composer Install dependencies with Composer
pdepend Calculate software metrics using PHP_Depend
pear Create PEAR package of PHPUnit and all its dependencies (release)
phar Create PHAR archive of PHPUnit and all its dependencies (release)
phar-alpha Create PHAR archive of PHPUnit and all its dependencies (alpha)
phar-beta Create PHAR archive of PHPUnit and all its dependencies (beta)
phpab Generate autoloader script
phpcpd Find duplicate code using PHPCPD
phpcs Find coding standard violations using PHP_CodeSniffer
phpcs-ci Find coding standard violations using PHP_CodeSniffer
phpdox Generate software project documentation using phpDox
phploc Measure project size using PHPLOC
phpmd Perform project mess detection using PHPMD
phpmd-ci Perform project mess detection using PHPMD
phpunit Run unit tests with PHPUnit
prepare Prepare for build
Default target: build
The rest is simple - just type
$ ant phar
The task will install Composer (even if you already have it, but copies it into the current folder) and downloads all dependencies.

Unable to find Lucene contrib jar in maven repository

This is probably a very basic question, but I am unable to find Lucene contrib jar in Apache's Maven repository. For e.g. I looked here, but there's only a .pom, there's no jar file, same with repositories mentioned here.
Am I missing anything obvious?
You can download the jars for maven repositories in here: http://mvnrepository.com/artifact/org.apache.lucene/lucene-core/4.4.0
For the contrib package there is a .jar only for the 3.0.2 and not 3.0.3 (don't know why):
http://mvnrepository.com/artifact/org.apache.lucene/lucene-contrib
Also, you can still download de source code and generate the .jar yourself. Should be as easy as running mvn package.
I found out the answer. Except for couple of versions mentioned by Felipe Hummel, there is not single contrib jar. Contrib contains multiple components such as analyzers, highlighters, etc. and each of them have a JAR.

Resources