Skip to content

Commit

Permalink
Fixing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
cophus committed Oct 12, 2023
2 parents 86b8f94 + b35d8ec commit af9f526
Show file tree
Hide file tree
Showing 169 changed files with 17,894 additions and 14,409 deletions.
61 changes: 61 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/miniconda
{
"name": "py4dstem-dev",
"image": "mcr.microsoft.com/vscode/devcontainers/miniconda:0-3",
// "build": {
// "context": "..",
// "dockerfile": "Dockerfile"
// },

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": []

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "/opt/conda/bin/conda init && /opt/conda/bin/pip install -e /workspaces/py4DSTEM/ && /opt/conda/bin/pip install ipython ipykernel jupyter",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/opt/conda/bin/python",
"python.analysis.autoFormatStrings": true,
"python.analysis.completeFunctionParens": true,
"ruff.showNotifications": "onWarning",
"workbench.colorTheme": "Monokai",
// "editor.defaultFormatter": "ms-python.black-formatter",
"editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace",
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
"editor.minimap.renderCharacters": false,
"editor.minimap.autohide": true,
"editor.minimap.scale": 2,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
}
},
"extensions": [
"ms-python.python",
"donjayamanne.python-extension-pack",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"GitHub.codespaces",
"ms-azuretools.vscode-docker",
"DavidAnson.vscode-markdownlint",
"ms-vsliveshare.vsliveshare",
"charliermarsh.ruff",
"eamodio.gitlens",
"ms-python.black-formatter"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 5 additions & 7 deletions .github/scripts/update_version.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
"""
Script to update the patch version number of the py4DSTEM package.
Author: Tara Mishra (Quantumstud)
"""

version_file_path = "py4DSTEM/version.py"

with open(version_file_path, "r") as f:
lines = f.readlines()

line_split = lines[0].split('.')
patch_number = line_split[2].split('\'')[0]
line_split = lines[0].split(".")
patch_number = line_split[2].split("'")[0]

# Increment patch number
patch_number = str(int(patch_number) + 1)+'\''
patch_number = str(int(patch_number) + 1) + "'"


new_line = line_split[0]+'.'+line_split[1]+'.'+patch_number
new_line = line_split[0] + "." + line_split[1] + "." + patch_number

with open(version_file_path,"w") as f:
with open(version_file_path, "w") as f:
f.write(new_line)

14 changes: 14 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check code style

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
2 changes: 1 addition & 1 deletion .github/workflows/build-flake.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application
name: Check module can be imported

on:
push:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/check_install_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Install Checker Dev
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:

test-python-os-versions:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} on ${{ matrix.architecture }}
continue-on-error: ${{ matrix.allow_failure }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
allow_failure: [false]
runs-on: [ubuntu-latest]
architecture: [x86_64]
python-version: ["3.9", "3.10", "3.11",]
# include:
# - python-version: "3.12.0-beta.4"
# runs-on: ubuntu-latest
# allow_failure: true
# Currently no public runners available for this but this or arm64 should work next time
# include:
# - python-version: "3.10"
# architecture: [aarch64]
# runs-on: macos-latest
# allow_failure: true
steps:
- uses: actions/checkout@v3

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install repo
run: |
python -m pip install .
- name: Check installation
run: |
python -c "import py4DSTEM; print(py4DSTEM.__version__)"
# - name: Check machine arch
# run: |
# python -c "import platform; print(platform.machine())"
45 changes: 45 additions & 0 deletions .github/workflows/check_install_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Install Checker Main
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:

test-python-os-versions:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} on ${{ matrix.architecture }}
continue-on-error: ${{ matrix.allow_failure }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
allow_failure: [false]
runs-on: [ubuntu-latest, windows-latest, macos-latest]
architecture: [x86_64]
python-version: ["3.9", "3.10", "3.11",]
#include:
# - python-version: "3.12.0-beta.4"
# runs-on: ubuntu-latest
# allow_failure: true
# Currently no public runners available for this but this or arm64 should work next time
# include:
# - python-version: "3.10"
# architecture: [aarch64]
# runs-on: macos-latest
# allow_failure: true
steps:
- uses: actions/checkout@v3

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install repo
run: |
python -m pip install .
- name: Check installation
run: |
python -c "import py4DSTEM; print(py4DSTEM.__version__)"
- name: Check machine arch
run: |
python -c "import platform; print(platform.machine())"
45 changes: 45 additions & 0 deletions .github/workflows/check_install_quick.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Install Checker Quick
on:
push:
branches-ignore:
- main
- dev
pull_request:
branches-ignore:
- main
- dev
jobs:

test-python-os-versions:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} on ${{ matrix.architecture }}
continue-on-error: ${{ matrix.allow_failure }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
allow_failure: [false]
runs-on: [ubuntu-latest]
architecture: [x86_64]
python-version: ["3.10"]
# Currently no public runners available for this but this or arm64 should work next time
# include:
# - python-version: "3.10"
# architecture: [aarch64]
# runs-on: macos-latest
# allow_failure: true
steps:
- uses: actions/checkout@v3

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install repo
run: |
python -m pip install .
- name: Check installation
run: |
python -c "import py4DSTEM; print(py4DSTEM.__version__)"
# - name: Check machine arch
# run: |
# python -c "import platform; print(platform.machine())"
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: flake8 Lint
name: Check for errors with flake8

on:
push:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Action to check the version of the package and upload it to PyPI
# if the version is higher than the one on PyPI
# Author: @quantumstud
name: PyPI Upload

on:
Expand All @@ -22,10 +21,15 @@ jobs:
token: ${{ secrets.GH_ACTION_VERSION_UPDATE }}
- name: Get changed files
id: changed-files-specific
uses: tj-actions/changed-files@v32
uses: tj-actions/changed-files@v39
with:
files: |
py4DSTEM/version.py
- name: Debug version file change checker
run: |
echo "Checking variable..."
echo ${{ steps.changed-files-specific.outputs.any_changed }}
echo "Done"
- name: Running if py4DSTEM/version.py file is not changed
if: steps.changed-files-specific.outputs.any_changed == 'false'
run: |
Expand Down
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,42 +46,50 @@ First, download and install Anaconda: www.anaconda.com/download.
If you prefer a more lightweight conda client, you can instead install Miniconda: https://docs.conda.io/en/latest/miniconda.html.
Then open a conda terminal and run one of the following sets of commands to ensure everything is up-to-date and create a new environment for your py4DSTEM installation:


```
conda update conda
conda create -n py4dstem
conda activate py4dstem
conda install -c conda-forge py4dstem pymatgen jupyterlab
```

Next, install py4DSTEM. To simultaneously install py4DSTEM with `pymatgen` (used in some crystal structure workflows) and `jupyterlab` (providing an interface for running Python notebooks like those provided in the [py4DSTEM tutorials repository](https://github.com/py4dstem/py4DSTEM_tutorials)) run:
In order, these commands
- ensure your installation of anaconda is up-to-date
- make a virtual environment (see below)
- enter the environment
- install py4DSTEM, as well as pymatgen (used for crystal structure calculations) and JupyterLab (an interface for running Python notebooks like those in the [py4DSTEM tutorials repository](https://github.com/py4dstem/py4DSTEM_tutorials))


We've had some recent reports install of `conda` getting stuck trying to solve the environment using the above installation. If you run into this problem, you can install py4DSTEM using `pip` instead of `conda` by running:

```
conda install -c conda-forge py4dstem pymatgen jupyterlab
conda update conda
conda create -n py4dstem python=3.10
conda activate py4dstem
pip install py4dstem pymatgen
```

Or if you would prefer to install only the base modules of **py4DSTEM**, you can instead run:
Both `conda` and `pip` are programs which manage package installations, i.e. make sure different codes you're installing which depend on one another are using mutually compatible versions. Each has advantages and disadvantages; `pip` is a little more bare-bones, and we've seen this install work when `conda` doesn't. If you also want to use Jupyterlab you can then use either `pip install jupyterlab` or `conda install jupyterlab`.

If you would prefer to install only the base modules of **py4DSTEM**, and skip pymategen and Jupterlab, you can instead run:

```
conda install -c conda-forge py4dstem
```

In Windows you should then also run:
Finally, regardless of which of the above approaches you used, in Windows you should then also run:

```
conda install pywin32
```

In order, these commands
- ensure your installation of anaconda is up-to-date
- make a virtual environment (see below)
- enter the environment
- install py4DSTEM, and optionally also pymatgen and JupyterLab
- on Windows, enable python to talk to the windows API
which enables Python to talk to the Windows API.

Please note that virtual environments are used in the instructions above in order to make sure packages that have different dependencies don't conflict with one another.
Because these directions install py4DSTEM to its own virtual environment, each time you want to use py4DSTEM you'll need to activate this environment.
You can do this in the command line by running `conda activate py4dstem`, or, if you're using the Anaconda Navigator, by clicking on the Environments tab and then clicking on `py4dstem`.

Last - as of the version 0.14.4 update, we've had a few reports of problems upgrading to the newest version. We're not sure what's causing the issue yet, but have found the new version can be installed successfully in these cases using a fresh Anaconda installation.


<a id='legacyinstall'></a>
Expand Down
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
emdfile
# py4dstem
sphinx_rtd_theme
# py4dstem
Loading

0 comments on commit af9f526

Please sign in to comment.