pax_global_header00006660000000000000000000000064146705046420014522gustar00rootroot0000000000000052 comment=6238085b7ef56202b2bf2d830b69e40fb588ea86 freesas-2024.9.0/000077500000000000000000000000001467050464200134105ustar00rootroot00000000000000freesas-2024.9.0/.github/000077500000000000000000000000001467050464200147505ustar00rootroot00000000000000freesas-2024.9.0/.github/workflows/000077500000000000000000000000001467050464200170055ustar00rootroot00000000000000freesas-2024.9.0/.github/workflows/pylint.yml000066400000000000000000000011031467050464200210420ustar00rootroot00000000000000name: Pylint on: [push] jobs: build: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.12"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pylint - name: Analysing the code with pylint run: | pylint $(git ls-files '*.py') freesas-2024.9.0/.github/workflows/python-package-mac.yml000066400000000000000000000035141467050464200232030ustar00rootroot00000000000000# This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: Python package Mac on: push: pull_request: jobs: build: runs-on: macos-latest strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] xcode-version: [latest-stable, 14] steps: - uses: actions/checkout@v3 - name: Configure xcode ${{ matrix.xcode-version }} uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: ${{ matrix.xcode-version }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install flake8 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Build and install with pip run: | pip install . - name: Test of run_tests.py run: | python run_tests.py - name: Run end to end tests with e2etest.py run: | mkdir empty cd empty pip install -r ../e2etest/requirements_e2e.txt python ../e2etest/e2etest.py freesas-2024.9.0/.github/workflows/python-package-ubuntu.yml000066400000000000000000000035041467050464200237640ustar00rootroot00000000000000# This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: Python package Ubuntu on: push: pull_request: jobs: build: defaults: run: working-directory: . runs-on: ubuntu-latest strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Set up Perl version for package build uses: shogo82148/actions-setup-perl@v1 with: perl-version: "5.32" - name: Install dependencies run: | python -m pip install --upgrade pip pip install flake8 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Build and install with pip run: | pip install . - name: Test of run_tests.py run: | python run_tests.py - name: Run end to end tests with e2etest.py run: | mkdir empty cd empty pip install -r ../e2etest/requirements_e2e.txt python ../e2etest/e2etest.py freesas-2024.9.0/.github/workflows/release.yml000066400000000000000000000132011467050464200211450ustar00rootroot00000000000000name: Build wheel and deploy on PyPI on: workflow_dispatch: release: types: - published jobs: build_sdist: name: Build source distribution runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" cache: "pip" - name: Install dependencies run: | python -m pip install --upgrade pip pip install build twine pillow - name: Build sdist run: python -m build --sdist - name: Check the package run: python -m twine check dist/* - uses: actions/upload-artifact@v4 with: name: cibw-sdist path: dist/*.tar.gz test_sdist: needs: [build_sdist] name: Test source distribution runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" cache: "pip" - uses: actions/download-artifact@v4 with: name: cibw-sdist path: dist - name: Install from sdist run: pip install "$(ls dist/freesas-*.tar.gz)" - name: Run tests env: WITH_QT_TEST: "False" # skip GUI tests PYFAI_OPENCL: "False" # skip GPU tests PYFAI_LOW_MEM: "True" # skip all tests >100Mb WITH_GL_TEST: "False" # disable tests using OpenGL run: python -c "import freesas.test, sys; sys.exit(freesas.test.run_tests())" build_doc: name: Build documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" cache: "pip" - name: Install pandoc&graphviz run: sudo apt-get install pandoc graphviz - name: Install freesas run: pip install . - name: Install documentation dependencies run: pip install -r ci/requirements_rtd.txt - name: Build doc env: READTHEDOCS: "True" # To skip checking that freesas is installed locally run: | export FREESAS_VERSION="$(python -c 'import freesas; print(freesas.strictversion)')" sphinx-build doc/source/ "freesas-${FREESAS_VERSION}_documentation/" zip -r "freesas-${FREESAS_VERSION}_documentation.zip" "freesas-${FREESAS_VERSION}_documentation/" - uses: actions/upload-artifact@v4 with: name: documentation path: freesas-*_documentation.zip build_wheels: name: Build wheels on ${{ matrix.os }}-${{ matrix.cibw_archs }} runs-on: ${{ matrix.os }} strategy: # Ensure that a wheel builder finishes even if another fails fail-fast: false matrix: include: - os: ubuntu-20.04 cibw_archs: "auto64" # - os: ubuntu-20.04 # cibw_archs: "aarch64" # - os: ubuntu-20.04 # cibw_archs: "ppc64le" - os: windows-2022 cibw_archs: "auto64" - os: macos-12 cibw_archs: "x86_64" macos_target: "10.9" - os: macos-14 cibw_archs: "arm64" macos_target: "11.0" steps: - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3 if: runner.os == 'Linux' with: platforms: all - uses: ilammy/msvc-dev-cmd@v1 # - name: Install Ubuntu dependencies # run: | # sudo apt-get update # sudo apt-get install -y libopenblas-dev libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libhdf5-dev ccache - uses: pypa/cibuildwheel@v2.16.5 env: # Use silx wheelhouse: needed for ppc64le CIBW_ENVIRONMENT_LINUX: "PIP_FIND_LINKS=https://www.silx.org/pub/wheelhouse/ PIP_TRUSTED_HOST=www.silx.org" #CIBW_ENVIRONMENT_WINDOWS: "PYFAI_WITH_OPENMP=False" CIBW_BUILD_FRONTEND_WINDOWS: "build; args: -C setup-args=-Duse_openmp=disabled" #CIBW_BEFORE_BUILD_WINDOWS: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"' CIBW_BUILD_VERBOSITY: 1 CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* # Do not build for pypy and muslinux CIBW_SKIP: pp* *-musllinux_* CIBW_ARCHS: ${{ matrix.cibw_archs }} MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}" # Install test dependencies CIBW_TEST_COMMAND: python -c "import freesas.test, sys; sys.exit(freesas.test.run_tests())" # Skip tests for emulated architectures CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} cp312-win_amd64" WITH_QT_TEST: "False" # skip GUI tests PYFAI_OPENCL: "False" # skip GPU tests PYFAI_LOW_MEM: "True" # skip all tests >100Mb WITH_GL_TEST: "False" # disable tests using OpenGL - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl pypi-publish: needs: [build_doc, build_sdist, build_wheels, test_sdist] name: Upload release to PyPI runs-on: ubuntu-latest environment: name: pypi permissions: id-token: write if: github.event_name == 'release' && github.event.action == 'published' # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/download-artifact@v4 with: pattern: cibw-* path: dist merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1 freesas-2024.9.0/.gitignore000066400000000000000000000014471467050464200154060ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] # C extensions *.so *.c # Distribution / packaging .Python env/ venv/ build/ develop-eggs/ dist/ downloads/ eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .mypy_cache/ .coverage .cache nosetests.xml coverage.xml coverage.rst # Translations *.mo *.pot # Django stuff: *.log # Sphinx documentation docs/_build/ # PyBuilder target/ #IDEs workspace.code-workspace .ipynb_checkpoints/ # OS files .DS_Store .vscode/settings.json freesas-2024.9.0/.pylintrc000066400000000000000000000403301467050464200152550ustar00rootroot00000000000000[MASTER] # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code. extension-pkg-whitelist= # Specify a score threshold to be exceeded before program exits with error. fail-under=8.0 # Add files or directories to the blacklist. They should be base names, not # paths. ignore=CVS # Add files or directories matching the regex patterns to the blacklist. The # regex matches against base names, not paths. ignore-patterns= # Python code to execute, usually for sys.path manipulation such as # pygtk.require(). #init-hook= # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the # number of processors available to use. jobs=1 # Control the amount of potential inferred values when inferring a single # object. This can help the performance when dealing with large functions or # complex, nested conditions. limit-inference-results=100 # List of plugins (as comma separated values of python module names) to load, # usually to register additional checkers. load-plugins= # Pickle collected data for later comparisons. persistent=yes # When enabled, pylint would attempt to guess common misconfiguration and emit # user-friendly hints instead of false-positive error messages. suggestion-mode=yes # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no [MESSAGES CONTROL] # Only show warnings with the listed confidence levels. Leave empty to show # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. confidence= # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifiers separated by comma (,) or put this # option multiple times (only on the command line, not in the configuration # file where it should appear only once). You can also use "--disable=all" to # disable everything first and then reenable specific checks. For example, if # you want to run only the similarities checker, you can use "--disable=all # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use "--disable=all --enable=classes # --disable=W". disable=raw-checker-failed, bad-inline-option, locally-disabled, file-ignored, suppressed-message, useless-suppression, deprecated-pragma, use-symbolic-message-instead, consider-using-f-string, too-many-lines, missing-function-docstring, line-too-long, trailing-whitespace, duplicate-code, # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). See also the "--disable" option for examples. enable=c-extension-no-member [REPORTS] # Python expression which should return a score less than or equal to 10. You # have access to the variables 'error', 'warning', 'refactor', and 'convention' # which contain the number of messages in each category, as well as 'statement' # which is the total number of statements analyzed. This score is used by the # global evaluation report (RP0004). evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) # Template used to display messages. This is a python new-style format string # used to format the message information. See doc for all details. #msg-template= # Set the output format. Available formats are text, parseable, colorized, json # and msvs (visual studio). You can also give a reporter class, e.g. # mypackage.mymodule.MyReporterClass. output-format=text # Tells whether to display a full report or only the messages. reports=no # Activate the evaluation score. score=yes [REFACTORING] # Maximum number of nested blocks for function / method body max-nested-blocks=5 # Complete name of functions that never returns. When checking for # inconsistent-return-statements if a never returning function is called then # it will be considered as an explicit return statement and no message will be # printed. never-returning-functions=sys.exit [LOGGING] # The type of string formatting that logging methods do. `old` means using % # formatting, `new` is for `{}` formatting. logging-format-style=old # Logging modules to check that the string format arguments are in logging # function parameter format. logging-modules=logging [SPELLING] # Limits count of emitted suggestions for spelling mistakes. max-spelling-suggestions=4 # Spelling dictionary name. Available dictionaries: none. To make it work, # install the python-enchant package. spelling-dict= # List of comma separated words that should not be checked. spelling-ignore-words= # A path to a file that contains the private dictionary; one word per line. spelling-private-dict-file= # Tells whether to store unknown words to the private dictionary (see the # --spelling-private-dict-file option) instead of raising a message. spelling-store-unknown-words=no [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. notes=FIXME, XXX, TODO # Regular expression of note tags to take in consideration. #notes-rgx= [TYPECHECK] # List of decorators that produce context managers, such as # contextlib.contextmanager. Add to this list to register other decorators that # produce valid context managers. contextmanager-decorators=contextlib.contextmanager # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E1101 when accessed. Python regular # expressions are accepted. generated-members= # Tells whether missing members accessed in mixin class should be ignored. A # mixin class is detected if its name ends with "mixin" (case insensitive). ignore-mixin-members=yes # Tells whether to warn about missing members when the owner of the attribute # is inferred to be None. ignore-none=yes # This flag controls whether pylint should warn about no-member and similar # checks whenever an opaque object is returned when inferring. The inference # can return multiple potential results while evaluating a Python object, but # some branches might not be evaluated, which results in partial inference. In # that case, it might be useful to still emit no-member and other checks for # the rest of the inferred objects. ignore-on-opaque-inference=yes # List of class names for which member attributes should not be checked (useful # for classes with dynamically set attributes). This supports the use of # qualified names. ignored-classes=optparse.Values,thread._local,_thread._local # List of module names for which member attributes should not be checked # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis). It # supports qualified module names, as well as Unix pattern matching. ignored-modules= # Show a hint with possible names when a member name was not found. The aspect # of finding the hint is based on edit distance. missing-member-hint=yes # The minimum edit distance a name should have in order to be considered a # similar match for a missing member name. missing-member-hint-distance=1 # The total number of similar names that should be taken in consideration when # showing a hint for a missing member. missing-member-max-choices=1 # List of decorators that change the signature of a decorated function. signature-mutators= [VARIABLES] # List of additional names supposed to be defined in builtins. Remember that # you should avoid defining new builtins when possible. additional-builtins= # Tells whether unused global variables should be treated as a violation. allow-global-unused-variables=yes # List of strings which can identify a callback function by name. A callback # name must start or end with one of those strings. callbacks=cb_, _cb # A regular expression matching the name of dummy variables (i.e. expected to # not be used). dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ # Argument names that match this expression will be ignored. Default to name # with leading underscore. ignored-argument-names=_.*|^ignored_|^unused_ # Tells whether we should check for unused import in __init__ files. init-import=no # List of qualified module names which can have objects that can redefine # builtins. redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io [FORMAT] # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. expected-line-ending-format= # Regexp for a line that is allowed to be longer than the limit. ignore-long-lines=^\s*(# )??$ # Number of spaces of indent required inside a hanging or continued line. indent-after-paren=4 # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 # tab). indent-string=' ' # Maximum number of characters on a single line. max-line-length=100 # Maximum number of lines in a module. max-module-lines=1000 # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no # Allow the body of an if to be on the same line as the test if there is no # else. single-line-if-stmt=no [SIMILARITIES] # Ignore comments when computing similarities. ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes # Ignore imports when computing similarities. ignore-imports=no # Minimum lines number of a similarity. min-similarity-lines=4 [BASIC] # Naming style matching correct argument names. argument-naming-style=snake_case # Regular expression matching correct argument names. Overrides argument- # naming-style. #argument-rgx= # Naming style matching correct attribute names. attr-naming-style=snake_case # Regular expression matching correct attribute names. Overrides attr-naming- # style. #attr-rgx= # Bad variable names which should always be refused, separated by a comma. bad-names=foo, bar, baz, toto, tutu, tata # Bad variable names regexes, separated by a comma. If names match any regex, # they will always be refused bad-names-rgxs= # Naming style matching correct class attribute names. class-attribute-naming-style=any # Regular expression matching correct class attribute names. Overrides class- # attribute-naming-style. #class-attribute-rgx= # Naming style matching correct class names. class-naming-style=PascalCase # Regular expression matching correct class names. Overrides class-naming- # style. #class-rgx= # Naming style matching correct constant names. const-naming-style=UPPER_CASE # Regular expression matching correct constant names. Overrides const-naming- # style. #const-rgx= # Minimum line length for functions/classes that require docstrings, shorter # ones are exempt. docstring-min-length=-1 # Naming style matching correct function names. function-naming-style=snake_case # Regular expression matching correct function names. Overrides function- # naming-style. #function-rgx= # Good variable names which should always be accepted, separated by a comma. good-names=i, j, k, ex, Run, _, testSuite, test_rg_of_SASDFX7_is_23Å, test_curate_data_BM29_bsa, I0,I,I_one, T, qr, q, p, r, Dmax, R0, x,y,w, # Good variable names regexes, separated by a comma. If names match any regex, # they will always be accepted good-names-rgxs= # Include a hint for the correct naming format with invalid-name. include-naming-hint=no # Naming style matching correct inline iteration names. inlinevar-naming-style=any # Regular expression matching correct inline iteration names. Overrides # inlinevar-naming-style. #inlinevar-rgx= # Naming style matching correct method names. method-naming-style=snake_case # Regular expression matching correct method names. Overrides method-naming- # style. #method-rgx= # Naming style matching correct module names. module-naming-style=snake_case # Regular expression matching correct module names. Overrides module-naming- # style. #module-rgx= # Colon-delimited sets of names that determine each other's naming style when # the name regexes allow several styles. name-group= # Regular expression which should only match function or class names that do # not require a docstring. no-docstring-rgx=^_ # List of decorators that produce properties, such as abc.abstractproperty. Add # to this list to register other decorators that produce valid properties. # These decorators are taken in consideration only for invalid-name. property-classes=abc.abstractproperty # Naming style matching correct variable names. variable-naming-style=snake_case # Regular expression matching correct variable names. Overrides variable- # naming-style. #variable-rgx= [STRING] # This flag controls whether inconsistent-quotes generates a warning when the # character used as a quote delimiter is used inconsistently within a module. check-quote-consistency=no # This flag controls whether the implicit-str-concat should generate a warning # on implicit string concatenation in sequences defined over several lines. check-str-concat-over-line-jumps=no [IMPORTS] # List of modules that can be imported at any level, not just the top level # one. allow-any-import-level= # Allow wildcard imports from modules that define __all__. allow-wildcard-with-all=no # Analyse import fallback blocks. This can be used to support both Python 2 and # 3 compatible code, which means that the block might have code that exists # only in one or another interpreter, leading to false positives when analysed. analyse-fallback-blocks=no # Deprecated modules which should not be used, separated by a comma. deprecated-modules=optparse,tkinter.tix # Create a graph of external dependencies in the given file (report RP0402 must # not be disabled). ext-import-graph= # Create a graph of every (i.e. internal and external) dependencies in the # given file (report RP0402 must not be disabled). import-graph= # Create a graph of internal dependencies in the given file (report RP0402 must # not be disabled). int-import-graph= # Force import order to recognize a module as part of the standard # compatibility libraries. known-standard-library= # Force import order to recognize a module as part of a third party library. known-third-party=enchant # Couples of modules and preferred modules, separated by a comma. preferred-modules= [CLASSES] # Warn about protected attribute access inside special methods check-protected-access-in-special-methods=no # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__, __new__, setUp, __post_init__ # List of member names, which should be excluded from the protected access # warning. exclude-protected=_asdict, _fields, _replace, _source, _make # List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls # List of valid names for the first argument in a metaclass class method. valid-metaclass-classmethod-first-arg=cls [DESIGN] # Maximum number of arguments for function / method. max-args=5 # Maximum number of attributes for a class (see R0902). max-attributes=7 # Maximum number of boolean expressions in an if statement (see R0916). max-bool-expr=5 # Maximum number of branch for function / method body. max-branches=12 # Maximum number of locals for function / method body. max-locals=15 # Maximum number of parents for a class (see R0901). max-parents=7 # Maximum number of public methods for a class (see R0904). max-public-methods=20 # Maximum number of return / yield for function / method body. max-returns=6 # Maximum number of statements in function / method body. max-statements=50 # Minimum number of public methods for a class (see R0903). min-public-methods=2 [EXCEPTIONS] # Exceptions that will emit a warning when being caught. Defaults to # "BaseException, Exception". overgeneral-exceptions=BaseException, Exception freesas-2024.9.0/.readthedocs.yml000066400000000000000000000011051467050464200164730ustar00rootroot00000000000000# .readthedocs.yml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Build documentation in the docs/ directory with Sphinx sphinx: configuration: doc/source/conf.py # Optionally build your docs in additional formats such as PDF #formats: # - pdf # Optionally set the version of Python and requirements required to build your docs python: version: 3.7 install: - requirements: requirements.txt - requirements: ci/requirements_rtd.txt - method: setuptools path: . freesas-2024.9.0/.travis.yml000066400000000000000000000044141467050464200155240ustar00rootroot00000000000000language: python jobs: include: - name: "Python 3.6.0 on Xenial Linux" python: 3.6 # this works for Linux but is ignored on macOS or Windows - name: "Python 3.7.0 on Xenial Linux" python: 3.7 # this works for Linux but is ignored on macOS or Windows - name: "Python 3.8.0 on Xenial Linux" python: 3.8 # this works for Linux but is ignored on macOS or Windows - name: "Python 3.9.0 on Xenial Linux" python: 3.9 # this works for Linux but is ignored on macOS or Windows - name: "Python 3.10.0 on Xenial Linux" python: 3.10 # this works for Linux but is ignored on macOS or Windows - name: "xcode 10.2 on macOS" os: osx osx_image: xcode10.2 language: shell # 'language: python' is an error on Travis CI macOS - name: "xcode 9.4 on macOS" os: osx osx_image: xcode9.4 language: shell # 'language: python' is an error on Travis CI macOS - name: "xcode 11.2 on macOS" os: osx osx_image: xcode11.2 language: shell # 'language: python' is an error on Travis CI macOS cache: apt: true directories: - $HOME/.cache/pip addons: apt: packages: - libhdf5-dev before_install: # activate env for mac - if [[ "$OSTYPE" == "darwin"* ]]; then python3 -m venv env && source env/bin/activate; fi install: # Upgrade distribution modules - "pip3 install --upgrade setuptools" - "pip3 install --upgrade pip" # Install build dependencies - "pip3 install wheel" - "pip3 install --trusted-host www.silx.org --trusted-host www.edna-site.org -r ci/requirement_travis.txt --upgrade --find-links http://www.silx.org/pub/wheelhouse" # Print Python info - "python3 ci/info_platform.py" - "pip3 freeze" # Build - "python3 setup.py build" - "python3 setup.py bdist_wheel" - "ls dist" # Install generated wheel - "pip3 install --pre --find-links dist/ --trusted-host www.silx.org --trusted-host www.edna-site.org --find-links http://www.silx.org/pub/wheelhouse freesas" script: # Print Python info - "python3 ci/info_platform.py" - "pip3 freeze" - "python3 --version" - "gcc --version" # Run the tests - "python3 setup.py build test" - "python3 run_tests.py" #Run end to end tests - "mkdir empty" - "cd empty" - "python3 ../e2etest/e2etest.py" freesas-2024.9.0/CHANGELOG.txt000066400000000000000000000000341467050464200154350ustar00rootroot00000000000000see doc/source/changelog.rstfreesas-2024.9.0/LICENSE000066400000000000000000000020721467050464200144160ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014 Jerome Kieffer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. freesas-2024.9.0/MANIFEST.in000066400000000000000000000010171467050464200151450ustar00rootroot00000000000000include README.md include CHANGELOG.rst include copyright include LICENSE recursive-include freesas *.pxd *.h *.pyx *.pxi include MANIFEST.in include run_tests.py recursive-include testdata *.pdb *.dat include run_tests.py include version.py include stdeb.cfg include build-deb.sh include requirements.txt include requirements-dev.txt recursive-include doc/source *.py *.rst *.png *.ico *.ipynb global-exclude .ipynb_checkpoints/* recursive-include examples * recursive-include package * recursive-include freesas/resources * freesas-2024.9.0/README.md000066400000000000000000000031201467050464200146630ustar00rootroot00000000000000[![Build Status](https://travis-ci.org/kif/freesas.svg)](https://travis-ci.org/kif/freesas) [![Build status](https://ci.appveyor.com/api/projects/status/uq4xtv5tvx4k6kox?svg=true)](https://ci.appveyor.com/project/kif/freesas) [![Documentation Status](https://readthedocs.org/projects/freesas/badge/?version=latest)](https://freesas.readthedocs.io/en/latest/?badge=latest) FreeSAS ======= Small angle scattering tools ... but unlike most others, free and written in Python (3.9+) The FreeSAS tool suite is licensed under the MIT license. Most features are described in [J. Synchrotron Rad. (2022). 29, 1318-1328](https://scripts.iucr.org/cgi-bin/paper?ju5045) Available tools ---------------- * supycomb: a re-implementation of supcomb as described in [J. Appl. Cryst. (2001). 34, 33-41](http://dx.doi.org/10.1107/S0021889800014126) * autorg: automatic guess of the Guinier region in a SAXS curve, based on [BioXTAS-RAW](https://doi.org/10.1107/S1600576717011438) * auto_guinier automatic guess of the Guinier region in a SAXS curve, based on [J. Appl. Cryst. (2007). 40, s223-s228](http://scripts.iucr.org/cgi-bin/paper?S0021889807002853) * auto_gpa: automatic Guinier peak analysis, based on [J Appl Cryst. (2016). 49, 1412–1419.](https://dx.doi.org/10.1107%2FS1600576716010906) * bift: an Bayesian inverse Fourier transform, based on [J. Appl. Cryst. (2006). 39, 797-804 & BioXtas-RAW](https://scripts.iucr.org/cgi-bin/paper?wf5022) * cormap: a tool to assess the similarity of saxs curves, based on [Nature Methods volume 12, pages 419–422 (2015)](https://www.nature.com/articles/nmeth.3358) freesas-2024.9.0/all_testdata.json000066400000000000000000000001751467050464200167470ustar00rootroot00000000000000[ "bsa_005_sub.dat", "dammif-01.pdb", "dammif-02.pdb", "model-01.pdb", "SASDFX7.dat", "SASDF52.dat" ]freesas-2024.9.0/bootstrap.py000077500000000000000000000173641467050464200160150ustar00rootroot00000000000000#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Bootstrap helps you to test scripts without installing them by patching your PYTHONPATH on the fly example: ./bootstrap.py ipython """ __authors__ = ["Frédéric-Emmanuel Picca", "Jérôme Kieffer"] __contact__ = "jerome.kieffer@esrf.eu" __license__ = "MIT" __date__ = "12/07/2024" import sys import os import subprocess import logging if sys.version_info[:2] < (3, 11): import tomli else: import tomllib as tomli logging.basicConfig() logger = logging.getLogger("bootstrap") LIBPATH = "" def get_project_name(root_dir): """Retrieve project name by running python setup.py --name in root_dir. :param str root_dir: Directory where to run the command. :return: The name of the project stored in root_dir """ logger.debug("Getting project name in %s", root_dir) with open("pyproject.toml") as f: pyproject = tomli.loads(f.read()) return pyproject.get("project", {}).get("name") def build_project(name, root_dir): """Build locally the project using meson :param str name: Name of the project. :param str root_dir: Root directory of the project :return: The path to the directory were build was performed """ extra = [] libdir = "lib" if sys.platform == "win32": libdir = "Lib" # extra = ["--buildtype", "plain"] build = os.path.join(root_dir, "build") if not(os.path.isdir(build) and os.path.isdir(os.path.join(build, name))): p = subprocess.Popen(["meson", "setup", "build"], shell=False, cwd=root_dir, env=os.environ) p.wait() p = subprocess.Popen(["meson", "configure", "--prefix", "/"] + extra, shell=False, cwd=build, env=os.environ) p.wait() p = subprocess.Popen(["meson", "install", "--destdir", "."], shell=False, cwd=build, env=os.environ) logger.debug("meson install ended with rc= %s", p.wait()) home = None if os.environ.get("PYBUILD_NAME") == name: # we are in the debian packaging way home = os.environ.get("PYTHONPATH", "").split(os.pathsep)[-1] if not home: if os.environ.get("BUILDPYTHONPATH"): home = os.path.abspath(os.environ.get("BUILDPYTHONPATH", "")) else: if sys.platform == "win32": home = os.path.join(build, libdir, "site-packages") else: python_version = f"python{sys.version_info.major}.{sys.version_info.minor}" home = os.path.join(build, libdir, python_version, "site-packages") home = os.path.abspath(home) cnt = 0 while not os.path.isdir(home): cnt += 1 home = os.path.split(home)[0] for _ in range(cnt): n = os.listdir(home)[0] home = os.path.join(home, n) logger.warning("Building %s to %s", name, home) return home def execfile(fullpath, globals=None, locals=None): "Python3 implementation for execfile" with open(fullpath) as f: try: data = f.read() except UnicodeDecodeError: raise SyntaxError("Not a Python script") code = compile(data, fullpath, 'exec') exec(code, globals, locals) def run_file(filename, argv): """ Execute a script trying first to use execfile, then a subprocess :param str filename: Script to execute :param list[str] argv: Arguments passed to the filename """ full_args = [filename] full_args.extend(argv) try: logger.info("Execute target using exec") # execfile is considered as a local call. # Providing globals() as locals will force to feed the file into # globals() (for examples imports). # Without this any function call from the executed file loses imports old_argv = sys.argv sys.argv = full_args logger.info("Patch the sys.argv: %s", sys.argv) logger.info("Executing %s.main()", filename) print("########### EXECFILE ###########") module_globals = globals().copy() module_globals['__file__'] = filename try: execfile(filename, module_globals, module_globals) finally: sys.argv = old_argv except SyntaxError as error: logger.error(error) logger.info("Execute target using subprocess") env = os.environ.copy() env.update({"PYTHONPATH": LIBPATH + os.pathsep + os.environ.get("PYTHONPATH", ""), "PATH": os.environ.get("PATH", "")}) print("########### SUBPROCESS ###########") run = subprocess.Popen(full_args, shell=False, env=env) run.wait() def run_entry_point(target_name, entry_point, argv): """ Execute an entry_point using the current python context :param str entry_point: A string identifying a function from a module (NAME = PACKAGE.MODULE:FUNCTION) :param argv: list of arguments """ import importlib elements = entry_point.split(":") module_name = elements[0].strip() function_name = elements[1].strip() logger.info("Execute target %s (function %s from module %s) using importlib", target_name, function_name, module_name) full_args = [target_name] full_args.extend(argv) old_argv = sys.argv sys.argv = full_args print("########### IMPORTLIB ###########") try: module = importlib.import_module(module_name) if hasattr(module, function_name): func = getattr(module, function_name) func() else: logger.info("Function %s not found", function_name) finally: sys.argv = old_argv def find_executable(target): """Find a filename from a script name. - Check the script name as file path, - Then checks if the name is a target of the setup.py - Then search the script from the PATH environment variable. :param str target: Name of the script :returns: Returns a tuple: kind, name. """ if os.path.isfile(target): return ("path", os.path.abspath(target)) # search the executable in pyproject.toml with open(os.path.join(PROJECT_DIR, "pyproject.toml")) as f: pyproject = tomli.loads(f.read()) scripts = {} scripts.update(pyproject.get("project", {}).get("scripts", {})) scripts.update(pyproject.get("project", {}).get("gui-scripts", {})) for script, entry_point in scripts.items(): if script == target: print(script, entry_point) return ("entry_point", target, entry_point) return None, None PROJECT_DIR = os.path.dirname(os.path.abspath(__file__)) PROJECT_NAME = get_project_name(PROJECT_DIR) logger.info("Project name: %s", PROJECT_NAME) if __name__ == "__main__": LIBPATH = build_project(PROJECT_NAME, PROJECT_DIR) if len(sys.argv) < 2: logger.warning("usage: ./bootstrap.py